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 +4 -4
- data/app/helpers/redde/index_helper.rb +14 -6
- data/app/views/admin/base/index.html.haml +1 -5
- data/app/views/admin/redde/_list.html.haml +2 -2
- data/lib/redde/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6223aa27718ba7b312a123c5857c21aa37230ce0
|
4
|
+
data.tar.gz: a3654c84d19fef5d7ba239d8641cc090726a7e79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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
|
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
|
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
|
73
|
-
return model_name
|
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
|
-
-
|
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
|
-
-
|
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