active-list 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/active-list/columns/action_column.rb +6 -4
- data/lib/active-list/compass/stylesheets/_active-list.scss +1 -1
- data/lib/active-list/compass/stylesheets/active-list/_minimal.scss +2 -4
- data/lib/active-list/compass/stylesheets/active-list/_theme.scss +52 -24
- data/lib/active-list/renderers/simple_renderer.rb +7 -7
- data/lib/assets/stylesheets/active-list.css.scss +1 -1
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.1.
|
1
|
+
4.1.1
|
@@ -18,8 +18,8 @@ module ActiveList
|
|
18
18
|
|
19
19
|
|
20
20
|
def operation(record='record')
|
21
|
-
@options[:method] = :delete if @name.to_s == "destroy"
|
22
|
-
@options[:confirm] =
|
21
|
+
@options[:method] = :delete if @name.to_s == "destroy" and !@options.has_key?(:method)
|
22
|
+
@options[:confirm] = :are_you_sure_you_want_to_delete if @name.to_s == "destroy" and !@options.has_key?(:confirm)
|
23
23
|
link_options = ""
|
24
24
|
if @options['data-confirm'] or @options[:confirm]
|
25
25
|
link_options << ", 'data-confirm' => ::I18n.translate('labels.#{@options['data-confirm']||@options[:confirm]}')"
|
@@ -49,7 +49,8 @@ module ActiveList
|
|
49
49
|
v = a[1][:action].to_s.split('_')[-1]
|
50
50
|
cases << record+"."+@name.to_s+".to_s=="+a[0].inspect+"\nlink_to(::I18n.translate('labels.#{v}')"+
|
51
51
|
", {"+(a[1][:controller] ? ':controller=>:'+a[1][:controller].to_s+', ' : '')+":action=>'"+a[1][:action].to_s+"', :id=>"+record+".id"+format+"}"+
|
52
|
-
", {:id=>'"+@name.to_s+"_'+"+record+".id.to_s"+link_options+"
|
52
|
+
# ", {:id=>'"+@name.to_s+"_'+"+record+".id.to_s"+link_options+"}"+
|
53
|
+
", {:class=>'#{@name}'"+link_options+"}"+
|
53
54
|
")\n"
|
54
55
|
end
|
55
56
|
|
@@ -61,7 +62,8 @@ module ActiveList
|
|
61
62
|
url[:id] ||= "RECORD.id"
|
62
63
|
url.delete_if{|k, v| v.nil?}
|
63
64
|
url = "{"+url.collect{|k, v| ":#{k}=>"+(v.is_a?(String) ? v.gsub(/RECORD/, record) : v.inspect)}.join(", ")+format+"}"
|
64
|
-
code = "{:id=>'"+@name.to_s+"_'+"+record+".id.to_s"+link_options+"
|
65
|
+
# code = "{:id=>'"+@name.to_s+"_'+"+record+".id.to_s"+link_options+"}"
|
66
|
+
code = "{:class=>'#{@name}'"+link_options+"}"
|
65
67
|
code = "link_to(::I18n.translate('labels.#{action}'), "+url+", "+code+")"
|
66
68
|
end
|
67
69
|
code = "if ("+@options[:if].gsub('RECORD', record)+")\n"+code+"\n end" if @options[:if]
|
@@ -29,26 +29,24 @@ div[data-list-source] {
|
|
29
29
|
top: 20px;
|
30
30
|
padding: 1px;
|
31
31
|
margin:0;
|
32
|
-
|
32
|
+
& { right: -1px;}
|
33
33
|
html[dir="rtl"] & { left: -1px;}
|
34
34
|
li {
|
35
35
|
&[data-list-change-page-size], &[data-list-toggle-column] {
|
36
36
|
cursor: pointer;
|
37
37
|
display: block;
|
38
|
-
padding: 0.3ex;
|
39
38
|
}
|
40
39
|
list-style-type: none;
|
41
40
|
width: 25ex;
|
42
41
|
position: relative;
|
43
42
|
a {
|
44
43
|
display: block;
|
45
|
-
padding: 0.3ex;
|
46
44
|
}
|
47
45
|
ul {
|
48
46
|
display: none;
|
49
47
|
position: absolute;
|
50
48
|
top: -2px;
|
51
|
-
|
49
|
+
& { right: 25ex; }
|
52
50
|
html[dir="rtl"] & { left: 25ex; }
|
53
51
|
&:hover { display:block; }
|
54
52
|
}
|
@@ -2,6 +2,8 @@
|
|
2
2
|
@import "compass/css3";
|
3
3
|
@import "compass/typography/text/replacement";
|
4
4
|
|
5
|
+
|
6
|
+
|
5
7
|
// Because Compass sprites do not seems to work well in gems
|
6
8
|
@mixin active-list-sprite($name, $size: 16px) {
|
7
9
|
background-image: image-url("active-list.png");
|
@@ -20,6 +22,7 @@
|
|
20
22
|
|
21
23
|
@mixin active-list-theme($theme-color: #777777) {
|
22
24
|
$default-border-color: mix($theme-color, #FFF, 30%);
|
25
|
+
$menu-width: 250px;
|
23
26
|
table.list {
|
24
27
|
border-collapse: collapse;
|
25
28
|
width: 100%;
|
@@ -42,7 +45,7 @@
|
|
42
45
|
&.sor[data-list-column-sort="asc"] .icon {
|
43
46
|
@include active-list-sprite(sort-up); }
|
44
47
|
}
|
45
|
-
|
48
|
+
& { text-align: left; }
|
46
49
|
html[dir="rtl"] & { text-align: right; }
|
47
50
|
&.spe {
|
48
51
|
width: 16px;
|
@@ -54,7 +57,7 @@
|
|
54
57
|
padding: 2px;
|
55
58
|
width: 16px;
|
56
59
|
height: 16px;
|
57
|
-
.icon { @include active-list-sprite(menu); }
|
60
|
+
.icon { @include active-list-sprite(menu); display: block; }
|
58
61
|
.text { display: none; }
|
59
62
|
}
|
60
63
|
&:hover {
|
@@ -64,39 +67,64 @@
|
|
64
67
|
}
|
65
68
|
}
|
66
69
|
ul {
|
70
|
+
width: $menu-width;
|
67
71
|
border: 1px solid $default-border-color;
|
68
72
|
background: #FFF;
|
69
73
|
@include box-shadow(0 0 5px rgba(0, 0, 0, 0.3));
|
70
74
|
li {
|
71
|
-
$menu-width: 290px;
|
72
75
|
width: $menu-width;
|
76
|
+
padding: 0;
|
73
77
|
ul {
|
74
|
-
|
78
|
+
& { right: $menu-width; }
|
75
79
|
html[dir="rtl"] & { left: $menu-width; }
|
76
80
|
}
|
77
81
|
}
|
78
82
|
}
|
79
|
-
|
83
|
+
& > ul {
|
84
|
+
top: 19px;
|
85
|
+
}
|
86
|
+
li {
|
87
|
+
padding: 0;
|
80
88
|
display: block;
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
89
|
+
a {
|
90
|
+
display: block;
|
91
|
+
padding: 2px;
|
92
|
+
.icon {
|
93
|
+
@include inline-block;
|
94
|
+
height:16px;
|
95
|
+
width: 16px;
|
96
|
+
& { margin-right: 4px; }
|
97
|
+
html[dir="rtl"] & { margin-left: 4px; }
|
98
|
+
}
|
99
|
+
.text {
|
100
|
+
@include inline-block;
|
101
|
+
width: $menu-width - 24px;
|
102
|
+
line-height: 18px;
|
103
|
+
font-weight: normal;
|
104
|
+
}
|
105
|
+
& * {
|
106
|
+
vertical-align: middle;
|
107
|
+
}
|
108
|
+
&.pages .icon { @include active-list-sprite(pages); }
|
109
|
+
&.columns .icon { @include active-list-sprite(columns); }
|
88
110
|
}
|
89
|
-
&.pages .icon { @include active-list-sprite(pages); }
|
90
111
|
&.export .icon { @include active-list-sprite(export); }
|
91
112
|
&.check .icon { @include active-list-sprite(check); }
|
92
|
-
&.columns .icon { @include active-list-sprite(columns); }
|
93
113
|
&.checked .icon { @include active-list-sprite(true); }
|
94
114
|
&.unchecked .icon { @include active-list-sprite(false); }
|
115
|
+
&:hover {
|
116
|
+
text-decoration: none;
|
117
|
+
background: mix($theme-color, #FFF, 10%);
|
118
|
+
}
|
119
|
+
&.separator {
|
120
|
+
padding: 0;
|
121
|
+
height: 1px;
|
122
|
+
width: $menu-width - 6px;
|
123
|
+
margin: 3px;
|
124
|
+
background: $default-border-color;
|
125
|
+
}
|
95
126
|
}
|
96
|
-
|
97
|
-
text-decoration: none;
|
98
|
-
background: mix($theme-color, #FFF, 10%);
|
99
|
-
}
|
127
|
+
|
100
128
|
}
|
101
129
|
}
|
102
130
|
}
|
@@ -111,7 +139,7 @@
|
|
111
139
|
border-right: none;
|
112
140
|
&.chk,&.act, &.dld, &.bln, &.dat, &.web { text-align:center }
|
113
141
|
&.dec, &.flt, &.int {
|
114
|
-
|
142
|
+
& { text-align: right; }
|
115
143
|
html[dir="rtl"] & { text-align: left; }
|
116
144
|
}
|
117
145
|
&.country { white-space: nowrap; }
|
@@ -129,7 +157,7 @@
|
|
129
157
|
z-index: 0;
|
130
158
|
@include background(transparentize(mix($theme-color, #FFF, 40%), 0.7));
|
131
159
|
.pagination {
|
132
|
-
|
160
|
+
& { text-align: left; }
|
133
161
|
html[dir="rtl"] & { text-align: right; }
|
134
162
|
& > * {
|
135
163
|
margin: 0 2px;
|
@@ -138,16 +166,16 @@
|
|
138
166
|
@include inline-block;
|
139
167
|
@include squish-text;
|
140
168
|
}
|
141
|
-
html[dir="rtl"] & .last-page,
|
169
|
+
html[dir="rtl"] & .last-page, & .first-page {
|
142
170
|
@include active-list-sprite(first-page);
|
143
171
|
}
|
144
|
-
html[dir="rtl"] & .first-page,
|
172
|
+
html[dir="rtl"] & .first-page, & .last-page {
|
145
173
|
@include active-list-sprite(last-page);
|
146
174
|
}
|
147
|
-
html[dir="rtl"] & .next-page,
|
175
|
+
html[dir="rtl"] & .next-page, & .previous-page {
|
148
176
|
@include active-list-sprite(previous-page);
|
149
177
|
}
|
150
|
-
html[dir="rtl"] & .previous-page,
|
178
|
+
html[dir="rtl"] & .previous-page, & .next-page {
|
151
179
|
@include active-list-sprite(next-page);
|
152
180
|
}
|
153
181
|
.separator {
|
@@ -50,7 +50,7 @@ module ActiveList
|
|
50
50
|
code << "if #{table.records_variable_name}_count > 0\n"
|
51
51
|
code << " reset_cycle('list')\n"
|
52
52
|
code << " for #{record} in #{table.records_variable_name}\n"
|
53
|
-
line_class = "cycle('odd', 'even', :name=>'list')"
|
53
|
+
line_class = "cycle('odd', 'even', :name=>'list')+' r'+#{record}.id.to_s"
|
54
54
|
line_class << "+' '+("+table.options[:line_class].to_s.gsub(/RECORD/, record)+').to_s' unless table.options[:line_class].nil?
|
55
55
|
code << " tbody << content_tag(:tr, (#{tbody}).html_safe, :class=>#{line_class})\n"
|
56
56
|
if table.options[:children].is_a? Symbol
|
@@ -69,8 +69,8 @@ module ActiveList
|
|
69
69
|
|
70
70
|
code << "html = ''\n"
|
71
71
|
code << "html << '<div id=\"#{table.name}\" data-list-source=\"'+h(url_for({:action => '#{table.controller_method_name}'}))+'\" class=\"active-list\""
|
72
|
-
code << "data-list-current-page=\"' + #{table.records_variable_name}_page.to_s + '\" data-list-page-size=\"' + #{table.records_variable_name}_limit.to_s + '\""
|
73
|
-
code << "data-list-sort-by=\"' + list_params[:sort].to_s + '\" data-list-sort-dir=\"' + list_params[:dir].to_s + '\""
|
72
|
+
code << " data-list-current-page=\"' + #{table.records_variable_name}_page.to_s + '\" data-list-page-size=\"' + #{table.records_variable_name}_limit.to_s + '\""
|
73
|
+
code << " data-list-sort-by=\"' + list_params[:sort].to_s + '\" data-list-sort-dir=\"' + list_params[:dir].to_s + '\""
|
74
74
|
code << ">'\n"
|
75
75
|
code << "html << '<table class=\"list\">'\n"
|
76
76
|
code << "html << (#{header})\n"
|
@@ -198,7 +198,7 @@ module ActiveList
|
|
198
198
|
menu << "<li class=\"parent\">"
|
199
199
|
menu << "<a class=\"pages\"><span class=\"icon\"></span><span class=\"text\">' + ::I18n.translate('list.items_per_page').gsub(/\'/,''') + '</span></a><ul>"
|
200
200
|
for n in list
|
201
|
-
menu << "<li data-list-change-page-size=\"#{n}\" '+(list_params[:per_page] == #{n} ? ' class=\"check\"' : '')+'><span class=\"icon\"></span><span class=\"text\">'+h(::I18n.translate('list.x_per_page', :count=>#{n}))+'</span></li>"
|
201
|
+
menu << "<li data-list-change-page-size=\"#{n}\" '+(list_params[:per_page] == #{n} ? ' class=\"check\"' : '')+'><a><span class=\"icon\"></span><span class=\"text\">'+h(::I18n.translate('list.x_per_page', :count=>#{n}))+'</span></a></li>"
|
202
202
|
end
|
203
203
|
menu << "</ul></li>"
|
204
204
|
end
|
@@ -207,7 +207,7 @@ module ActiveList
|
|
207
207
|
menu << "<li class=\"parent\">"
|
208
208
|
menu << "<a class=\"columns\"><span class=\"icon\"></span><span class=\"text\">' + ::I18n.translate('list.columns').gsub(/\'/,''') + '</span></a><ul>"
|
209
209
|
for column in table.data_columns
|
210
|
-
menu << "<li data-list-toggle-column=\"#{column.id}\" class=\"'+(list_params[:hidden_columns].include?('#{column.id}') ? 'unchecked' : 'checked')+'\"><span class=\"icon\"></span><span class=\"text\">'+h(#{column.header_code})+'</span></li>"
|
210
|
+
menu << "<li data-list-toggle-column=\"#{column.id}\" class=\"'+(list_params[:hidden_columns].include?('#{column.id}') ? 'unchecked' : 'checked')+'\"><a><span class=\"icon\"></span><span class=\"text\">'+h(#{column.header_code})+'</span></a></li>"
|
211
211
|
end
|
212
212
|
menu << "</ul></li>"
|
213
213
|
|
@@ -215,7 +215,7 @@ module ActiveList
|
|
215
215
|
menu << "<li class=\"separator\"></li>"
|
216
216
|
# Exports
|
217
217
|
for format, exporter in ActiveList.exporters
|
218
|
-
menu << "<li class=\"export #{exporter.name}\">' + link_to(params.merge(:action=>:#{table.controller_method_name}, :sort=>list_params[:sort], :dir=>list_params[:dir], :format=>'#{format}')
|
218
|
+
menu << "<li class=\"export #{exporter.name}\">' + link_to(params.merge(:action=>:#{table.controller_method_name}, :sort=>list_params[:sort], :dir=>list_params[:dir], :format=>'#{format}')) { '<span class=\"icon\"></span>'.html_safe + content_tag('span', ::I18n.translate('list.export_as', :exported=>::I18n.translate('list.export.formats.#{format}')).gsub(/\'/,'''), :class=>'text')} + '</li>"
|
219
219
|
end
|
220
220
|
menu << "</ul></div>"
|
221
221
|
return menu
|
@@ -261,7 +261,7 @@ module ActiveList
|
|
261
261
|
|
262
262
|
pagination << "<span class=\"separator\"></span>"
|
263
263
|
|
264
|
-
pagination << "<span class=\"status\">'+::I18n.translate('list.pagination.showing_x_to_y_of_total', :x => (#{table.records_variable_name}_offset + 1), :y => (#{table.records_variable_name}_offset+#{table.records_variable_name}_limit), :total => #{table.records_variable_name}_count)+'</span>"
|
264
|
+
pagination << "<span class=\"status\">'+::I18n.translate('list.pagination.showing_x_to_y_of_total', :x => (#{table.records_variable_name}_offset + 1), :y => ((#{table.records_variable_name}_last==#{table.records_variable_name}_page) ? #{table.records_variable_name}_count : #{table.records_variable_name}_offset+#{table.records_variable_name}_limit), :total => #{table.records_variable_name}_count)+'</span>"
|
265
265
|
pagination << "</div>"
|
266
266
|
|
267
267
|
code = "(#{table.records_variable_name}_last > 1 ? '<div class=\"extras\">#{pagination}</div>' : '').html_safe"
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: !binary |-
|
5
|
+
NC4xLjE=
|
5
6
|
prerelease:
|
6
7
|
platform: ruby
|
7
8
|
authors:
|
@@ -9,7 +10,7 @@ authors:
|
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
13
|
+
date: 2012-07-24 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: rails
|