edgarj 0.01.26 → 0.01.27

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: 2e10562392e96ef62e5743ea5647dbc1e9a16a41
4
- data.tar.gz: 38d611e3f70002175a4161ab5feb28c7635e9ac6
3
+ metadata.gz: e6af6ab6ec407b632cd5c3de8af5d1d98e73d493
4
+ data.tar.gz: 1d28796fbafe41afcd8b0a5d66e06130dd496f99
5
5
  SHA512:
6
- metadata.gz: 22ec7ee34ccebb1dc7501da2987b835f770e67697f6584fba5af13949d2a22a2394481bfc0b248c1b31f78176023859b83c5f08aa0eb5230962fa08ee12824a2
7
- data.tar.gz: 88e1c61f4279feb740eb2b93598c63e82efda93b9a5e7f2e302ffeaa23ab07461826799a99986f051e2dae5cf81b0a29dd52b25cb666ea43af53b2fa8b465366
6
+ metadata.gz: a043d93250f226f6d8ea2c13d032351b744b54d72db5e923f38ebd31fdf3cc290a13ecdea64c3669c052df7cb3f4d0abafd31f8560e072f8c28f57d9fb142e0d
7
+ data.tar.gz: b101146580ec426101ba42731d8115e1179b8f2f9fe03ad5d9f89cdf10cd0c2548b77d032a779faa380cbff97cb8b675bb1e6834dc07a6d8915bd3d82626c032
@@ -119,12 +119,16 @@ module Edgarj
119
119
  end
120
120
  =end
121
121
 
122
- # 1. column I18n is used if defined
123
- # 2. else, parent.human_name is used.
122
+ # 1. t('view.CONTROLLER.label.MODEL.COLUMN') if exists.
123
+ # 1. column I18n is used if exists.
124
+ # 1. else, parent.human_name is used.
124
125
  def draw_belongs_to_label_sub(model, col_name, parent_model)
126
+ @controller_model ||= controller.send(:model)
125
127
  I18n.t(col_name,
126
- scope: "activerecord.attributes.#{model.to_s.underscore}",
127
- default: parent_model.human_name)
128
+ scope: "view.#{controller_path}.#{@controller_model.name.underscore}",
129
+ default: I18n.t(col_name,
130
+ scope: "activerecord.attributes.#{model.to_s.underscore}",
131
+ default: parent_model.human_name))
128
132
  end
129
133
 
130
134
  =begin
@@ -33,5 +33,15 @@ module Edgarj
33
33
  nil
34
34
  end
35
35
  end
36
+
37
+ # column label with the following fallback order:
38
+ # 1. t('view.CONTROLLER.label.MODEL.COLUMN') if exists.
39
+ # 1. model.human_attribute_name(col.name)
40
+ def column_label(col)
41
+ @controller_model ||= controller.send(:model)
42
+ I18n.t(col.name,
43
+ scope: "view.#{controller_path}.#{@controller_model.name.underscore}",
44
+ default: @controller_model.human_attribute_name(col.name))
45
+ end
36
46
  end
37
47
  end
@@ -122,7 +122,7 @@ module Edgarj
122
122
  #
123
123
  def _draw_head(col, label=nil, &block)
124
124
  _draw_2_lane{
125
- html = @vc.content_tag(:th, label || @record.class.human_attribute_name(col.name))
125
+ html = @vc.content_tag(:th, label || @vc.column_label(col))
126
126
  html << @vc.content_tag(:td, '')
127
127
  html << (@vc.content_tag(:td) do yield end)
128
128
  html
@@ -225,7 +225,7 @@ module Edgarj
225
225
  #
226
226
  def _draw_head(col, label=nil, &block)
227
227
  _draw_2_lane{
228
- sprintf("<th>%s</th><td>", label || @record.klass.human_attribute_name(col.name)) +
228
+ sprintf("<th>%s</th><td>", label || @vc.column_label(col)) +
229
229
 
230
230
  # add operator for appropreate data type.
231
231
  if col.name == 'id'
@@ -98,7 +98,7 @@ module Edgarj
98
98
  # col:: column data
99
99
  # options:: options to url_for
100
100
  def draw_sort(col, options={})
101
- label = @drawer.model.human_attribute_name(col.name)
101
+ label = @vc.column_label(col)
102
102
  dir = 'asc'
103
103
  if @drawer.page_info.order_by == @drawer.fullname(col)
104
104
  # toggle direction
@@ -1,3 +1,3 @@
1
1
  module Edgarj
2
- VERSION = "0.01.26"
2
+ VERSION = "0.01.27"
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: 0.01.26
4
+ version: 0.01.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fuminori Ido
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-03 00:00:00.000000000 Z
11
+ date: 2015-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails