redde 0.3.11 → 0.3.12

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: 9ee9c12645cc53a3675c450f41c7c03b4a7996fb
4
- data.tar.gz: 9075982586a39f0613bfd16104ce28bf6a0976ff
3
+ metadata.gz: 6223aa27718ba7b312a123c5857c21aa37230ce0
4
+ data.tar.gz: a3654c84d19fef5d7ba239d8641cc090726a7e79
5
5
  SHA512:
6
- metadata.gz: 6ae3d469cdcb9281fd6c3ee760b327fbea46a451ba7e6b3da28659d51df737b6facf306ad51a4e2dccfa8660e062916e0b83433312bb80b4887833e5a6c353f5
7
- data.tar.gz: bdc2fde36b52b309343cb21fae9bf3fc13a9b325f695aadf947f995068450bf329fd1014d6db15909e7829d58df514d1a410c3d371bd5a4d2b86e378ad5daa2b
6
+ metadata.gz: 5efd5966f8872605b7b316a244a737852c4538dbe4b731066dbf3143db711944e18a4b736982b6164f3864b462db1d5dbe6d8acf6d0c15e1d9e5ff43e0918389
7
+ data.tar.gz: bfd75da454ecdb75a8a1827e8cb337c994cafed91b33cd17b7225877960dbea0ee9cb10c8a5eed00bbf55314c7827d9a1dcb25af1d4bcdc0ce690ab4a250cec4
@@ -11,7 +11,7 @@ module Redde::IndexHelper
11
11
  model_name.columns.select { |i| i.type == :string }.first
12
12
  end
13
13
 
14
- def list_table res_collection, &block
14
+ def list_table(res_collection, &block)
15
15
  render layout: 'admin/redde/list', locals: { res_collection: res_collection } do
16
16
  res_collection.each do |item|
17
17
  concat list_table_row( item, &block )
@@ -19,7 +19,7 @@ module Redde::IndexHelper
19
19
  end
20
20
  end
21
21
 
22
- def list_table_row item, &block
22
+ def list_table_row(item, &block)
23
23
  render layout: 'admin/redde/row', locals: { item: item } do
24
24
  index_columns.each do |column|
25
25
  concat list_table_cell(item, column, &block)
@@ -27,7 +27,7 @@ module Redde::IndexHelper
27
27
  end
28
28
  end
29
29
 
30
- def list_table_cell item, column, &block
30
+ def list_table_cell(item, column, &block)
31
31
  case column
32
32
  when 'position'
33
33
  content_tag(:td, "", class: 'list__cell _handle', 'data-sortable-handle' => "")
@@ -64,13 +64,13 @@ module Redde::IndexHelper
64
64
  end
65
65
 
66
66
  def index_columns
67
- return model_name.INDEX_COLUMNS if defined?(model_name.INDEX_COLUMNS)
67
+ return model_name::INDEX_COLUMNS if defined?(model_name::INDEX_COLUMNS)
68
68
  column_names
69
69
  end
70
70
 
71
71
  def form_column_names
72
- return model_name.FORM_COLUMNS if defined?(model_name.FORM_COLUMNS)
73
- return model_name.INDEX_COLUMNS if defined?(model_name.INDEX_COLUMNS)
72
+ return model_name::FORM_COLUMNS if defined?(model_name::FORM_COLUMNS)
73
+ return model_name::INDEX_COLUMNS if defined?(model_name::INDEX_COLUMNS)
74
74
  column_names.select { |i| !IGNORED_COLUMNS.include?(i) }
75
75
  end
76
76
 
@@ -133,4 +133,12 @@ module Redde::IndexHelper
133
133
  end
134
134
  result
135
135
  end
136
+
137
+ def render_item_column(item, column)
138
+ case item.send(column).class
139
+ when Time then l(item.send(column), format: '%d %b %Y, %H:%M')
140
+ else
141
+ item.send(column)
142
+ end
143
+ end
136
144
  end
@@ -3,8 +3,4 @@
3
3
  - res_collection = instance_variable_get("@#{collection}")
4
4
 
5
5
  = list_table res_collection do |item, column|
6
- %td.list__cell
7
- - if item.send(column).is_a?(Time)
8
- = l item.send(column), format: '%d %b %Y, %H:%M'
9
- - else
10
- = item.send(column)
6
+ %td.list__cell= render_item_column(item, column)
@@ -2,14 +2,14 @@
2
2
  %table.list{list_table_options}
3
3
  %colgroup
4
4
  %col.list__col
5
- - column_names.each do |column|
5
+ - index_columns.each do |column|
6
6
  %col.list__col
7
7
  %col.list__col._del
8
8
  %col.list__col
9
9
  %thead
10
10
  %tr
11
11
  %th.list__head
12
- - column_names.each_with_index do |column, index|
12
+ - index_columns.each_with_index do |column, index|
13
13
  - if ['position', 'visible'].include? column
14
14
  %th.list__head.list__head_empty
15
15
  - else
data/lib/redde/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Redde
2
- VERSION = '0.3.11'.freeze
2
+ VERSION = '0.3.12'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redde
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.11
4
+ version: 0.3.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Bovykin