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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6bf27254600b6b45051cceeaa5207bb4444ed1f
4
- data.tar.gz: 6e771d6939ffa603da365fd7cd4868590ef4e80d
3
+ metadata.gz: 752addae3c0f24a5262cdd684758c30ff23bc03a
4
+ data.tar.gz: 43e8070d61914fd360be71fead1543fbad84bdc8
5
5
  SHA512:
6
- metadata.gz: fa01bedc497c6cab13a28fdbae2d5eefed989eb700ff550d3aedaf439042725f9fb1376dcf4aa43aed8ee6a0641712b7c550322dea38c15c616d860703f340cc
7
- data.tar.gz: d1ac0b607e0602fb0149467ce411cfeeb75270ae3894301dce9a51f960b8afef6feda23ff8eb0cb081f93b7e16c0f42d8918f8974f9d05120a175fea4ff882b9
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
- html = ''
56
- for col in columns do
57
- draw_method = "draw_#{col.name}"
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 ? '<tr>' : ''
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
 
@@ -1,3 +1,3 @@
1
1
  module Edgarj
2
- VERSION = '4.04.01'
2
+ VERSION = '4.05.00'
3
3
  end
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.04.01
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-28 00:00:00.000000000 Z
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.6.4
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/models/helpers/edgarj/model_permissions_helper_test.rb
368
- - test/models/helpers/edgarj/user_group_users_helper_test.rb
369
- - test/models/edgarj/user_group_user_test.rb
370
- - test/models/edgarj/sssn_test.rb
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/controllers/authors_controller_test.rb
386
- - test/dummy/test/controllers/books_controller_test.rb
387
- - test/dummy/test/controllers/authors_popup_controller_test.rb
388
- - test/dummy/README.rdoc
389
- - test/dummy/config.ru
390
- - test/dummy/bin/bundle
391
- - test/dummy/bin/rake
392
- - test/dummy/bin/rails
393
- - test/dummy/db/schema.rb
394
- - test/dummy/db/migrate/20131218011851_create_books.rb
395
- - test/dummy/db/migrate/20140807065420_create_users.rb
396
- - test/dummy/db/migrate/20140201000000_add_user_group_id_to_authors.rb
397
- - test/dummy/db/migrate/20131107120635_create_authors.rb
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/environments/test.rb
405
- - test/dummy/config/environments/production.rb
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/edgarj/menu_config.rb
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/config.rb
415
- - test/dummy/config/initializers/inflections.rb
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/backtrace_silencers.rb
422
- - test/dummy/public/favicon.ico
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/422.html
420
+ - test/dummy/public/favicon.ico
425
421
  - test/dummy/public/500.html
426
- - test/dummy/app/views/layouts/login.html.erb
427
- - test/dummy/app/views/layouts/application.html.erb
428
- - test/dummy/app/decorators/models/edgarj/user_group_decorator.rb
429
- - test/dummy/app/helpers/authors_helper.rb
430
- - test/dummy/app/helpers/books_helper.rb
431
- - test/dummy/app/helpers/application_helper.rb
432
- - test/dummy/app/helpers/authors_popup_helper.rb
433
- - test/dummy/app/models/book.rb
434
- - test/dummy/app/models/author.rb
435
- - test/dummy/app/models/user.rb
436
- - test/dummy/app/assets/javascripts/authors.js
437
- - test/dummy/app/assets/javascripts/application.js
438
- - test/dummy/app/assets/stylesheets/scaffold.css
439
- - test/dummy/app/assets/stylesheets/authors.css
440
- - test/dummy/app/assets/stylesheets/application.css
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/model_permissions.yml
442
+ - test/fixtures/edgarj/page_infos.yml
452
443
  - test/fixtures/edgarj/sssns.yml
453
- - test/fixtures/books.yml
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: