edgarj 4.04.01 → 4.05.00
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/edgarj/drawer/base.rb +15 -3
- data/app/helpers/edgarj/form_drawer.rb +27 -31
- data/lib/edgarj/version.rb +1 -1
- metadata +69 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 752addae3c0f24a5262cdd684758c30ff23bc03a
|
4
|
+
data.tar.gz: 43e8070d61914fd360be71fead1543fbad84bdc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c7fc86cda66c605669a55a973917250883eb84364dcf37e4fd29ce1512fa7e51a2efcec7136bb1b5cb559e0ed303485c950f97e0e2212f341b927ed448effca
|
7
|
+
data.tar.gz: 0a98356064af29f8853e242a802447959a5fa772947b3dd18b68425ad9d1ef4f50824c8bb41e9ca80e511c5f08fc7c48c90e03c580446a982c2fef3648908b34
|
@@ -4,9 +4,10 @@ module Edgarj
|
|
4
4
|
module Drawer
|
5
5
|
# Column-info classes to provide the following common methods:
|
6
6
|
#
|
7
|
-
# * label
|
8
|
-
# * sort_key
|
9
|
-
# * column_value
|
7
|
+
# * label - for column header label in the list
|
8
|
+
# * sort_key - to sort list
|
9
|
+
# * column_value - cell text for the column in the list
|
10
|
+
# * field - for the form
|
10
11
|
#
|
11
12
|
# and the following optional methods:
|
12
13
|
# * tag_options
|
@@ -21,6 +22,7 @@ module Edgarj
|
|
21
22
|
module ColumnInfo
|
22
23
|
# Abstract class for all of ColumnInfo
|
23
24
|
class Base
|
25
|
+
# for column header label in the list
|
24
26
|
def label(vc)
|
25
27
|
raise 'derived should implement'
|
26
28
|
end
|
@@ -29,12 +31,22 @@ module Edgarj
|
|
29
31
|
raise 'derived should implement'
|
30
32
|
end
|
31
33
|
|
34
|
+
# cell text for the column in the list
|
35
|
+
#
|
32
36
|
# @param rec [AR]
|
33
37
|
# @param drawer [Edgarj::Drawer::Base]
|
34
38
|
def column_value(rec, drawer)
|
35
39
|
rec.inspect
|
36
40
|
end
|
37
41
|
|
42
|
+
# input field for form
|
43
|
+
#
|
44
|
+
# @param rec [AR]
|
45
|
+
# @param form_drawer [Edgarj::FormDrawer::Base]
|
46
|
+
def field(rec, form_drawer)
|
47
|
+
form_drawer.draw_field(rec, self)
|
48
|
+
end
|
49
|
+
|
38
50
|
# HTML tag options (e.g. css-class) in Hash
|
39
51
|
def tag_options
|
40
52
|
{}
|
@@ -11,6 +11,7 @@ module Edgarj
|
|
11
11
|
# 1. Next, when draw_ATTR() is defined, it is called. See ModelPermissionControllerHelper for example.
|
12
12
|
# 1. Then, consider to overwrite draw_ATTR() method.
|
13
13
|
class Base
|
14
|
+
attr_accessor :vc, :f
|
14
15
|
|
15
16
|
# === INPUTS
|
16
17
|
# drawer:: Edgarj::Drawer instance
|
@@ -44,38 +45,33 @@ module Edgarj
|
|
44
45
|
# 1. 'belongs_to' column uses:
|
45
46
|
# ** I18n.t('activerecord.attributes.MODEL.EXT_ID')
|
46
47
|
# ** parent.human_name
|
47
|
-
|
48
|
-
# TODO: draw_field() 層があってもよい
|
49
|
-
# form.draw() と form._draw_field(), form._draw_belongs_to_field ... は
|
50
|
-
# あるけど、抽象化層の form.draw_field がない
|
51
48
|
def draw()
|
52
|
-
adrs_field = {}
|
53
49
|
@vc.content_tag(:table) do
|
54
50
|
@left = true
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
html << if self.class.method_defined?(draw_method) then
|
59
|
-
send(draw_method, col)
|
60
|
-
#elsif edgarj_address?(col)
|
61
|
-
# draw_address(col)
|
62
|
-
#elsif edgarj_file?(col)
|
63
|
-
# draw_file(col)
|
64
|
-
elsif (enum = get_enum(col))
|
65
|
-
draw_enum(col, enum)
|
66
|
-
elsif (bitset = get_bitset(col))
|
67
|
-
draw_bitset(col, bitset)
|
68
|
-
else
|
69
|
-
parent_model = @vc.model.belongs_to_AR(col)
|
70
|
-
if parent_model
|
71
|
-
_draw_belongs_to_field(parent_model, col)
|
72
|
-
else
|
73
|
-
_draw_field(col)
|
74
|
-
end
|
51
|
+
@vc.capture do
|
52
|
+
for col in columns do
|
53
|
+
@vc.concat col.field(@record, self)
|
75
54
|
end
|
55
|
+
@vc.concat('<td colspan=3></td>'.html_safe) if !@left
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def draw_field(rec, col)
|
61
|
+
draw_method = "draw_#{col.name}"
|
62
|
+
if self.class.method_defined?(draw_method) then
|
63
|
+
send(draw_method, col)
|
64
|
+
elsif (enum = get_enum(col))
|
65
|
+
draw_enum(col, enum)
|
66
|
+
elsif (bitset = get_bitset(col))
|
67
|
+
draw_bitset(col, bitset)
|
68
|
+
else
|
69
|
+
parent_model = @vc.model.belongs_to_AR(col)
|
70
|
+
if parent_model
|
71
|
+
_draw_belongs_to_field(parent_model, col)
|
72
|
+
else
|
73
|
+
_draw_field(col)
|
76
74
|
end
|
77
|
-
html << '<td colspan=3></td>'.html_safe if !@left
|
78
|
-
html.html_safe
|
79
75
|
end
|
80
76
|
end
|
81
77
|
|
@@ -110,9 +106,9 @@ module Edgarj
|
|
110
106
|
|
111
107
|
# flip field to left-lane or right-lane
|
112
108
|
def _draw_2_lane(&block)
|
113
|
-
result = @left ?
|
109
|
+
result = @left ? @vc.tag(:tr, nil, true) : ''.html_safe
|
114
110
|
result += yield
|
115
|
-
result += '</tr>' if !@left
|
111
|
+
result += '</tr>'.html_safe if !@left
|
116
112
|
@left = !@left # flip it
|
117
113
|
result
|
118
114
|
end
|
@@ -232,7 +228,7 @@ module Edgarj
|
|
232
228
|
#
|
233
229
|
def _draw_head(col, label=nil, &block)
|
234
230
|
_draw_2_lane{
|
235
|
-
sprintf("<th>%s</th><td>", label || @vc.column_label(col)) +
|
231
|
+
sprintf("<th>%s</th><td>", label || @vc.column_label(col)).html_safe +
|
236
232
|
|
237
233
|
# add operator for appropreate data type.
|
238
234
|
if col.name == 'id'
|
@@ -244,7 +240,7 @@ module Edgarj
|
|
244
240
|
else
|
245
241
|
''
|
246
242
|
end
|
247
|
-
end + '</td><td>' + yield + '</td>'
|
243
|
+
end + '</td><td>'.html_safe + yield + '</td>'.html_safe
|
248
244
|
}
|
249
245
|
end
|
250
246
|
|
data/lib/edgarj/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edgarj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.05.00
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fuminori Ido
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -359,96 +359,96 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
359
359
|
version: '0'
|
360
360
|
requirements: []
|
361
361
|
rubyforge_project:
|
362
|
-
rubygems_version: 2.
|
362
|
+
rubygems_version: 2.5.2
|
363
363
|
signing_key:
|
364
364
|
specification_version: 4
|
365
365
|
summary: Scaffold with Ajax, search, sort, 'belongs_to' popup, and more.
|
366
366
|
test_files:
|
367
|
-
- test/
|
368
|
-
- test/
|
369
|
-
- test/
|
370
|
-
- test/
|
371
|
-
- test/models/edgarj/user_group_test.rb
|
372
|
-
- test/models/edgarj/page_info_test.rb
|
373
|
-
- test/models/edgarj/model_permission_test.rb
|
374
|
-
- test/integration/navigation_test.rb
|
375
|
-
- test/support/edgarj/controller_supporter.rb
|
376
|
-
- test/controllers/edgarj/user_group_users_controller_test.rb
|
377
|
-
- test/controllers/edgarj/edgarj_controller_test.rb
|
378
|
-
- test/controllers/edgarj/model_permissions_controller_test.rb
|
379
|
-
- test/edgarj_test.rb
|
380
|
-
- test/test_helper.rb
|
367
|
+
- test/dummy/config.ru
|
368
|
+
- test/dummy/test/controllers/books_controller_test.rb
|
369
|
+
- test/dummy/test/controllers/authors_controller_test.rb
|
370
|
+
- test/dummy/test/controllers/authors_popup_controller_test.rb
|
381
371
|
- test/dummy/test/helpers/authors_helper_test.rb
|
382
|
-
- test/dummy/test/models/book_test.rb
|
383
372
|
- test/dummy/test/models/author_test.rb
|
384
373
|
- test/dummy/test/models/rails_config_test.rb
|
385
|
-
- test/dummy/test/
|
386
|
-
- test/dummy/
|
387
|
-
- test/dummy/
|
388
|
-
- test/dummy/
|
389
|
-
- test/dummy/
|
390
|
-
- test/dummy/
|
391
|
-
- test/dummy/
|
392
|
-
- test/dummy/
|
393
|
-
- test/dummy/
|
394
|
-
- test/dummy/
|
395
|
-
- test/dummy/
|
396
|
-
- test/dummy/
|
397
|
-
- test/dummy/
|
374
|
+
- test/dummy/test/models/book_test.rb
|
375
|
+
- test/dummy/app/assets/javascripts/application.js
|
376
|
+
- test/dummy/app/assets/javascripts/authors.js
|
377
|
+
- test/dummy/app/assets/stylesheets/authors.css
|
378
|
+
- test/dummy/app/assets/stylesheets/scaffold.css
|
379
|
+
- test/dummy/app/assets/stylesheets/application.css
|
380
|
+
- test/dummy/app/decorators/models/edgarj/user_group_decorator.rb
|
381
|
+
- test/dummy/app/controllers/authors_popup_controller.rb
|
382
|
+
- test/dummy/app/controllers/dummy_auth_mixin.rb
|
383
|
+
- test/dummy/app/controllers/application_controller.rb
|
384
|
+
- test/dummy/app/controllers/books_controller.rb
|
385
|
+
- test/dummy/app/controllers/authors_controller.rb
|
386
|
+
- test/dummy/app/helpers/authors_popup_helper.rb
|
387
|
+
- test/dummy/app/helpers/authors_helper.rb
|
388
|
+
- test/dummy/app/helpers/books_helper.rb
|
389
|
+
- test/dummy/app/helpers/application_helper.rb
|
390
|
+
- test/dummy/app/models/author.rb
|
391
|
+
- test/dummy/app/models/user.rb
|
392
|
+
- test/dummy/app/models/book.rb
|
393
|
+
- test/dummy/app/views/layouts/application.html.erb
|
394
|
+
- test/dummy/app/views/layouts/login.html.erb
|
398
395
|
- test/dummy/Rakefile
|
399
|
-
- test/dummy/config/routes.rb
|
400
|
-
- test/dummy/config/boot.rb
|
401
|
-
- test/dummy/config/environment.rb
|
402
396
|
- test/dummy/config/database.yml
|
403
397
|
- test/dummy/config/settings.yml
|
404
|
-
- test/dummy/config/
|
405
|
-
- test/dummy/config/
|
406
|
-
- test/dummy/config/environments/development.rb
|
407
|
-
- test/dummy/config/application.rb
|
398
|
+
- test/dummy/config/boot.rb
|
399
|
+
- test/dummy/config/environment.rb
|
408
400
|
- test/dummy/config/settings/production.yml
|
409
401
|
- test/dummy/config/settings/development.yml
|
410
402
|
- test/dummy/config/settings/test.yml
|
411
|
-
- test/dummy/config/
|
403
|
+
- test/dummy/config/routes.rb
|
404
|
+
- test/dummy/config/application.rb
|
412
405
|
- test/dummy/config/locales/en.yml
|
413
406
|
- test/dummy/config/locales/ja.yml
|
414
|
-
- test/dummy/config/initializers/
|
415
|
-
- test/dummy/config/initializers/
|
407
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
408
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
416
409
|
- test/dummy/config/initializers/wrap_parameters.rb
|
417
|
-
- test/dummy/config/initializers/session_store.rb
|
418
410
|
- test/dummy/config/initializers/secret_token.rb
|
419
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
420
411
|
- test/dummy/config/initializers/mime_types.rb
|
421
|
-
- test/dummy/config/initializers/
|
422
|
-
- test/dummy/
|
412
|
+
- test/dummy/config/initializers/session_store.rb
|
413
|
+
- test/dummy/config/initializers/inflections.rb
|
414
|
+
- test/dummy/config/initializers/config.rb
|
415
|
+
- test/dummy/config/edgarj/menu_config.rb
|
416
|
+
- test/dummy/config/environments/production.rb
|
417
|
+
- test/dummy/config/environments/development.rb
|
418
|
+
- test/dummy/config/environments/test.rb
|
423
419
|
- test/dummy/public/404.html
|
424
|
-
- test/dummy/public/
|
420
|
+
- test/dummy/public/favicon.ico
|
425
421
|
- test/dummy/public/500.html
|
426
|
-
- test/dummy/
|
427
|
-
- test/dummy/
|
428
|
-
- test/dummy/
|
429
|
-
- test/dummy/
|
430
|
-
- test/dummy/
|
431
|
-
- test/dummy/
|
432
|
-
- test/dummy/
|
433
|
-
- test/dummy/
|
434
|
-
- test/dummy/
|
435
|
-
- test/dummy/
|
436
|
-
- test/
|
437
|
-
- test/
|
438
|
-
- test/
|
439
|
-
- test/
|
440
|
-
- test/
|
441
|
-
- test/dummy/app/controllers/authors_controller.rb
|
442
|
-
- test/dummy/app/controllers/books_controller.rb
|
443
|
-
- test/dummy/app/controllers/dummy_auth_mixin.rb
|
444
|
-
- test/dummy/app/controllers/application_controller.rb
|
445
|
-
- test/dummy/app/controllers/authors_popup_controller.rb
|
422
|
+
- test/dummy/public/422.html
|
423
|
+
- test/dummy/README.rdoc
|
424
|
+
- test/dummy/bin/bundle
|
425
|
+
- test/dummy/bin/rake
|
426
|
+
- test/dummy/bin/rails
|
427
|
+
- test/dummy/db/schema.rb
|
428
|
+
- test/dummy/db/migrate/20140807065420_create_users.rb
|
429
|
+
- test/dummy/db/migrate/20131218011851_create_books.rb
|
430
|
+
- test/dummy/db/migrate/20131107120635_create_authors.rb
|
431
|
+
- test/dummy/db/migrate/20140201000000_add_user_group_id_to_authors.rb
|
432
|
+
- test/test_helper.rb
|
433
|
+
- test/integration/navigation_test.rb
|
434
|
+
- test/controllers/edgarj/user_group_users_controller_test.rb
|
435
|
+
- test/controllers/edgarj/edgarj_controller_test.rb
|
436
|
+
- test/controllers/edgarj/model_permissions_controller_test.rb
|
446
437
|
- test/fixtures/authors.yml
|
438
|
+
- test/fixtures/books.yml
|
447
439
|
- test/fixtures/users.yml
|
448
|
-
- test/fixtures/edgarj/page_infos.yml
|
449
440
|
- test/fixtures/edgarj/user_group_users.yml
|
450
441
|
- test/fixtures/edgarj/user_groups.yml
|
451
|
-
- test/fixtures/edgarj/
|
442
|
+
- test/fixtures/edgarj/page_infos.yml
|
452
443
|
- test/fixtures/edgarj/sssns.yml
|
453
|
-
- test/fixtures/
|
444
|
+
- test/fixtures/edgarj/model_permissions.yml
|
445
|
+
- test/edgarj_test.rb
|
446
|
+
- test/support/edgarj/controller_supporter.rb
|
447
|
+
- test/models/helpers/edgarj/model_permissions_helper_test.rb
|
448
|
+
- test/models/helpers/edgarj/user_group_users_helper_test.rb
|
449
|
+
- test/models/edgarj/user_group_test.rb
|
450
|
+
- test/models/edgarj/sssn_test.rb
|
451
|
+
- test/models/edgarj/model_permission_test.rb
|
452
|
+
- test/models/edgarj/page_info_test.rb
|
453
|
+
- test/models/edgarj/user_group_user_test.rb
|
454
454
|
has_rdoc:
|