active_list 7.0.0 → 7.1.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81ce03aaece14d5f38d557ccc43ab2d1252aa1b9
|
4
|
+
data.tar.gz: 58f4a6bfc926669b9aa8b7022655141f25c16959
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae364e886416828ab7c632e871e4a7bbb8ab5b94c58ca50902fcff74ccddbb4face3ae8aae6064490e217ad806f7c0fef712ba79627cd45aad296fbbf6ff45ae
|
7
|
+
data.tar.gz: 71ec9909171eaba5b35562600e72da60d2e618eb8b13c6acda5d72a7fccb3f92fc2198a8b22842c172021bf088f57d52c3319cc1bb151c3ab8eb7aee3c9c5358
|
@@ -95,7 +95,7 @@ module ActiveList
|
|
95
95
|
url.delete_if { |_k, v| v.nil? }
|
96
96
|
cases << "#{record}.#{@name} == #{expected.inspect}\nlink_to(content_tag(:i) + h(#{url[:action].inspect}.t(scope: 'rest.actions'))"\
|
97
97
|
', {' + url.collect { |k, v| "#{k}: " + urlify(v, record) }.join(', ') + format + '}' \
|
98
|
-
", {class: '#{@name}'" + link_options + '}'\
|
98
|
+
", {class: '#{@options[:icon_name] || @name}'" + link_options + '}'\
|
99
99
|
")\n"
|
100
100
|
end
|
101
101
|
|
@@ -109,7 +109,7 @@ module ActiveList
|
|
109
109
|
url[:redirect] ||= 'params[:redirect]'.c
|
110
110
|
url.delete_if { |_k, v| v.nil? }
|
111
111
|
url = '{' + url.collect { |k, v| "#{k}: " + urlify(v, record) }.join(', ') + format + '}'
|
112
|
-
code = "{class: '#{@name}'" + link_options + '}'
|
112
|
+
code = "{class: '#{@options[:icon_name] || @name}'" + link_options + '}'
|
113
113
|
code = "link_to(content_tag(:i) + h(' ' + :#{action}.t(scope: 'rest.actions')), " + url + ', ' + code + ')'
|
114
114
|
end
|
115
115
|
if @options[:if]
|
@@ -11,13 +11,7 @@ module ActiveList
|
|
11
11
|
else
|
12
12
|
@label_method.to_s.gsub('human_', '').to_sym
|
13
13
|
end
|
14
|
-
|
15
|
-
@sort_column = if @table.model.columns_hash[@label_method.to_s]
|
16
|
-
@label_method
|
17
|
-
elsif @table.model.columns_hash[@name.to_s]
|
18
|
-
@name
|
19
|
-
end
|
20
|
-
end
|
14
|
+
@sort_column = get_sort_column
|
21
15
|
@computation_method = options[:on_select]
|
22
16
|
@column = @table.model.columns_hash[@label_method.to_s]
|
23
17
|
end
|
@@ -51,6 +45,24 @@ module ActiveList
|
|
51
45
|
code.c
|
52
46
|
end
|
53
47
|
|
48
|
+
def get_sort_column
|
49
|
+
selects = @table.options[:select] || {}
|
50
|
+
selects_label = selects.find { |sql_name, name| name.to_s == @label_method.to_s }&.last
|
51
|
+
selects_name = selects.find { |sql_name, name| name.to_s == @name.to_s }&.last
|
52
|
+
if (selects_label || selects_name) && options[:sort].blank?
|
53
|
+
sort_column = (selects_label || selects_name)
|
54
|
+
else
|
55
|
+
sort_column = options[:sort]
|
56
|
+
sort_column ||= if @table.model.columns_hash[@label_method.to_s]
|
57
|
+
@label_method
|
58
|
+
elsif @table.model.columns_hash[@name.to_s]
|
59
|
+
@name
|
60
|
+
end
|
61
|
+
sort_column &&= "#{@table.model.table_name}.#{sort_column}"
|
62
|
+
end
|
63
|
+
sort_column
|
64
|
+
end
|
65
|
+
|
54
66
|
# Returns the class name of the used model
|
55
67
|
def class_name
|
56
68
|
table.model.name
|
@@ -70,7 +82,7 @@ module ActiveList
|
|
70
82
|
end
|
71
83
|
|
72
84
|
def sort_expression
|
73
|
-
|
85
|
+
@sort_column
|
74
86
|
end
|
75
87
|
end
|
76
88
|
end
|
@@ -34,7 +34,6 @@ module ActiveList
|
|
34
34
|
else
|
35
35
|
"#{var_name(:count)} = #{query_code}.count\n"
|
36
36
|
end
|
37
|
-
|
38
37
|
query_code << ".group(#{@table.options[:group].inspect})" unless @table.options[:group].blank?
|
39
38
|
query_code << ".reorder(#{var_name(:order)})"
|
40
39
|
|
@@ -133,7 +132,7 @@ module ActiveList
|
|
133
132
|
code << 'DISTINCT ' if @table.options[:distinct]
|
134
133
|
if @table.options[:select]
|
135
134
|
# code << @table.options[:select].collect { |k, v| ", #{k[0].to_s + '.' + k[1].to_s} AS #{v}" }.join
|
136
|
-
code << @table.options[:select].collect do |k, v|
|
135
|
+
code << @table.options[:select].collect do |k, v|
|
137
136
|
c = if k.is_a? Array
|
138
137
|
k[0].to_s + '.' + k[1].to_s
|
139
138
|
else
|
@@ -314,7 +314,7 @@ module ActiveList
|
|
314
314
|
end
|
315
315
|
table.columns.each do |column|
|
316
316
|
next if column.is_a?(ActiveList::Definition::ActionColumn) && !column.use_single?
|
317
|
-
code << "<th data-list-column=\"#{column.sort_id}\""
|
317
|
+
code << "<th data-list-column=\"#{column.options[:icon_name] || column.sort_id}\""
|
318
318
|
code << " data-list-column-cells=\"#{column.short_id}\""
|
319
319
|
code << " data-list-column-sort=\"'+(#{var_name(:params)}[:sort] != '#{column.sort_id}' ? 'asc' : #{var_name(:params)}[:dir] == 'asc' ? 'desc' : 'asc')+'\"" if column.sortable?
|
320
320
|
code << " data-list-column-computation=\"#{column.computation_method}\"" if column.computable?
|
data/lib/active_list/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brice Texier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|