active_list 6.5.1 → 6.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/active_list.rb +11 -11
  3. data/lib/active_list/definition.rb +0 -2
  4. data/lib/active_list/definition/abstract_column.rb +4 -9
  5. data/lib/active_list/definition/action_column.rb +49 -57
  6. data/lib/active_list/definition/association_column.rb +26 -28
  7. data/lib/active_list/definition/attribute_column.rb +6 -11
  8. data/lib/active_list/definition/check_box_column.rb +0 -5
  9. data/lib/active_list/definition/data_column.rb +17 -24
  10. data/lib/active_list/definition/empty_column.rb +0 -4
  11. data/lib/active_list/definition/field_column.rb +0 -4
  12. data/lib/active_list/definition/status_column.rb +0 -4
  13. data/lib/active_list/definition/table.rb +31 -37
  14. data/lib/active_list/definition/text_field_column.rb +0 -4
  15. data/lib/active_list/exporters.rb +0 -4
  16. data/lib/active_list/exporters/abstract_exporter.rb +15 -19
  17. data/lib/active_list/exporters/csv_exporter.rb +5 -11
  18. data/lib/active_list/exporters/excel_csv_exporter.rb +7 -13
  19. data/lib/active_list/exporters/open_document_spreadsheet_exporter.rb +29 -35
  20. data/lib/active_list/generator.rb +27 -32
  21. data/lib/active_list/generator/finder.rb +35 -50
  22. data/lib/active_list/helpers.rb +6 -8
  23. data/lib/active_list/rails/engine.rb +3 -3
  24. data/lib/active_list/rails/integration.rb +2 -10
  25. data/lib/active_list/renderers.rb +0 -4
  26. data/lib/active_list/renderers/abstract_renderer.rb +2 -7
  27. data/lib/active_list/renderers/simple_renderer.rb +58 -71
  28. data/lib/active_list/version.rb +1 -3
  29. data/test/active_list_test.rb +4 -6
  30. data/test/code_generation_test.rb +0 -2
  31. data/test/dummy/Gemfile +1 -2
  32. data/test/dummy/app/controllers/contacts_controller.rb +10 -10
  33. data/test/dummy/app/controllers/people_controller.rb +10 -11
  34. data/test/dummy/config.ru +1 -1
  35. data/test/dummy/config/application.rb +2 -2
  36. data/test/dummy/config/boot.rb +1 -1
  37. data/test/dummy/config/environments/test.rb +6 -3
  38. data/test/dummy/config/initializers/session_store.rb +1 -1
  39. data/test/dummy/config/initializers/wrap_parameters.rb +1 -1
  40. data/test/dummy/db/seeds.rb +5 -5
  41. data/test/dummy/script/rails +2 -2
  42. data/test/people_controller_test.rb +11 -15
  43. data/test/table_test.rb +0 -1
  44. data/test/test_helper.rb +6 -7
  45. metadata +3 -4
@@ -1,12 +1,12 @@
1
1
  module ActiveList
2
2
  module Rails
3
3
  class Engine < ::Rails::Engine
4
- engine_name "active_list"
5
- initializer "active_list.integrate_methods" do |app|
4
+ engine_name 'active_list'
5
+ initializer 'active_list.integrate_methods' do |_app|
6
6
  ::ActionController::Base.send(:include, ActiveList::Rails::Integration::ActionController)
7
7
  ::ActionView::Base.send(:include, ActiveList::Rails::Integration::ViewsHelper)
8
8
  # Adds locales
9
- for file in Dir.glob(Pathname.new(__FILE__).dirname.join("..", "locales", "*.yml"))
9
+ for file in Dir.glob(Pathname.new(__FILE__).dirname.join('..', 'locales', '*.yml'))
10
10
  ::I18n.load_path << file unless ::I18n.load_path.include?(file)
11
11
  end
12
12
  end
@@ -1,15 +1,12 @@
1
1
  module ActiveList
2
2
  module Rails
3
3
  module Integration
4
-
5
4
  module ActionController
6
-
7
5
  def self.included(base) #:nodoc:
8
6
  base.extend(ClassMethods)
9
7
  end
10
8
 
11
9
  module ClassMethods
12
-
13
10
  # Permits to define and generate methods to manage dynamic
14
11
  # table ActiveList
15
12
  def list(*args, &block)
@@ -20,27 +17,22 @@ module ActiveList
20
17
  class_eval(generator.controller_method_code, __FILE__, __LINE__)
21
18
  ActionView::Base.send(:class_eval, generator.view_method_code, __FILE__, __LINE__)
22
19
  end
23
-
24
20
  end
25
-
26
21
  end
27
22
 
28
23
  module ViewsHelper
29
-
30
24
  # Calls the generated view helper
31
25
  def list(*args, &block)
32
26
  options = args.extract_options!
33
27
  name = args.shift
34
- kontroller = self.controller.class
28
+ kontroller = controller.class
35
29
  begin
36
30
  helper_method = "_#{kontroller.controller_name}_#{__method__}_#{name || kontroller.controller_name}_tag".to_sym
37
31
  kontroller = kontroller.superclass
38
32
  end until self.respond_to?(helper_method)
39
- return self.send(helper_method, options, &block)
33
+ send(helper_method, options, &block)
40
34
  end
41
-
42
35
  end
43
-
44
36
  end
45
37
  end
46
38
  end
@@ -1,9 +1,7 @@
1
1
  # require 'active_support/core_ext/module/attribute_accessors'
2
2
 
3
3
  module ActiveList
4
-
5
4
  module Renderers
6
-
7
5
  def self.[](name)
8
6
  ActiveList.renderers[name]
9
7
  end
@@ -11,6 +9,4 @@ module ActiveList
11
9
  autoload :AbstractRenderer, 'active_list/renderers/abstract_renderer'
12
10
  autoload :SimpleRenderer, 'active_list/renderers/simple_renderer'
13
11
  end
14
-
15
12
  end
16
-
@@ -1,7 +1,5 @@
1
1
  module ActiveList
2
-
3
2
  module Renderers
4
-
5
3
  class AbstractRenderer
6
4
  attr_reader :generator, :table
7
5
 
@@ -15,15 +13,12 @@ module ActiveList
15
13
  end
16
14
 
17
15
  def remote_update_code
18
- raise NotImplementedError, "#{self.class.name}#remote_update_code is not implemented."
16
+ fail NotImplementedError, "#{self.class.name}#remote_update_code is not implemented."
19
17
  end
20
18
 
21
19
  def build_data_code
22
- raise NotImplementedError, "#{self.class.name}#build_table_code is not implemented."
20
+ fail NotImplementedError, "#{self.class.name}#build_table_code is not implemented."
23
21
  end
24
-
25
22
  end
26
-
27
23
  end
28
-
29
24
  end
@@ -1,11 +1,8 @@
1
1
  module ActiveList
2
-
3
2
  module Renderers
4
-
5
3
  class SimpleRenderer < AbstractRenderer
6
4
  include ActiveList::Helpers
7
5
 
8
-
9
6
  DATATYPE_ABBREVIATION = {
10
7
  binary: :bin,
11
8
  boolean: :bln,
@@ -22,7 +19,7 @@ module ActiveList
22
19
  }
23
20
 
24
21
  def remote_update_code
25
- code = "if params[:column] and params[:visibility]\n"
22
+ code = "if params[:column] && params[:visibility]\n"
26
23
  code << " column = params[:column].to_sym\n"
27
24
  # Removes potentially unwanted columns
28
25
  code << " #{var_name(:params)}[:hidden_columns].delete_if{|c| !#{table.data_columns.map(&:name).inspect}.include?(c)}\n"
@@ -34,18 +31,18 @@ module ActiveList
34
31
  code << "else\n"
35
32
  code << " render(inline: '<%=#{generator.view_method_name}-%>')\n"
36
33
  code << "end\n"
37
- return code
34
+ code
38
35
  end
39
36
 
40
37
  def build_table_code
41
- record = "r"
42
- child = "c"
38
+ record = 'r'
39
+ child = 'c'
43
40
 
44
41
  # colgroup = columns_definition_code
45
42
  header = header_code
46
43
  extras = extras_codes
47
44
 
48
- code = generator.select_data_code
45
+ code = generator.select_data_code
49
46
  code << "#{var_name(:tbody)} = '<tbody data-total=\"' + #{var_name(:count)}.to_s + '\""
50
47
  if table.paginate?
51
48
  code << " data-per-page=\"' + #{var_name(:limit)}.to_s + '\""
@@ -74,12 +71,12 @@ module ActiveList
74
71
  # end
75
72
  code << " end\n"
76
73
  code << "else\n"
77
- code << " #{var_name(:tbody)} << '<tr class=\"empty\"><td colspan=\"#{table.columns.size+1}\">' + ::I18n.translate('list.no_records') + '</td></tr>'\n"
74
+ code << " #{var_name(:tbody)} << '<tr class=\"empty\"><td colspan=\"#{table.columns.size + 1}\">' + ::I18n.translate('list.no_records') + '</td></tr>'\n"
78
75
  code << "end\n"
79
76
 
80
77
  code << "#{var_name(:tbody)} << '</tbody>'\n"
81
78
  code << "return #{var_name(:tbody)}.html_safe if options[:only] == 'table-body'\n"
82
-
79
+
83
80
  # Build content
84
81
  code << "#{var_name(:content)} = ''\n"
85
82
  if extras.any?
@@ -103,23 +100,21 @@ module ActiveList
103
100
  code << ">'\n"
104
101
  code << "#{var_name(:content)} << (#{header})\n"
105
102
  code << "if block_given?\n"
106
- code << " #{var_name(:content)} << '<tfoot>' + capture(" + table.columns.collect{|c| {name: c.name, id: c.id}}.inspect + ", &block).to_s + '</tfoot>'\n"
103
+ code << " #{var_name(:content)} << '<tfoot>' + capture(" + table.columns.collect { |c| { name: c.name, id: c.id } }.inspect + ", &block).to_s + '</tfoot>'\n"
107
104
  code << "end\n"
108
105
  code << "#{var_name(:content)} << #{var_name(:tbody)}\n"
109
106
  code << "#{var_name(:content)} << '</table></div>'\n"
110
107
  # code << "return #{var_name(:content)}.html_safe if options[:only] == 'content'\n"
111
108
 
112
109
  # Build whole
113
- code << "return ('<div id=\"#{self.uid}\" data-list-source=\"'+h(url_for(options.merge(:action => '#{generator.controller_method_name}')))+'\" data-list-redirect=\"' + params[:redirect].to_s + '\" class=\"active-list\">' + #{var_name(:content)} + '</div>').html_safe\n"
114
- return code
110
+ code << "return ('<div id=\"#{uid}\" data-list-source=\"'+h(url_for(options.merge(:action => '#{generator.controller_method_name}')))+'\" data-list-redirect=\"' + params[:redirect].to_s + '\" class=\"active-list\">' + #{var_name(:content)} + '</div>').html_safe\n"
111
+ code
115
112
  end
116
113
 
117
-
118
-
119
- def columns_to_cells(nature, options={})
114
+ def columns_to_cells(nature, options = {})
120
115
  code = ''
121
116
  unless [:body, :children].include?(nature)
122
- raise ArgumentError, "Nature is invalid"
117
+ fail ArgumentError, 'Nature is invalid'
123
118
  end
124
119
  record = options[:record] || 'record_of_the_death'
125
120
  if table.selectable?
@@ -130,7 +125,7 @@ module ActiveList
130
125
 
131
126
  children_mode = !!(nature == :children)
132
127
  for column in table.columns
133
- value_code = ""
128
+ value_code = ''
134
129
  if column.is_a? ActiveList::Definition::EmptyColumn
135
130
  value_code = 'nil'
136
131
  elsif column.is_a? ActiveList::Definition::StatusColumn
@@ -139,23 +134,23 @@ module ActiveList
139
134
  levels = %w(go caution stop)
140
135
  lights = levels.collect do |light|
141
136
  "content_tag(:span, '', :class => #{light.inspect})"
142
- end.join(" + ")
137
+ end.join(' + ')
143
138
  # Expected value are :valid, :warning, :error
144
139
  value_code = "content_tag(:span, #{lights}, :class => 'lights lights-' + (#{levels.inspect}.include?(#{value_code}.to_s) ? #{value_code}.to_s : 'undefined'))"
145
140
 
146
141
  elsif column.is_a? ActiveList::Definition::DataColumn
147
- if column.options[:children].is_a? FalseClass and children_mode
142
+ if column.options[:children].is_a?(FalseClass) && children_mode
148
143
  value_code = 'nil'
149
144
  else
150
145
  value_code = column.datum_code(record, children_mode)
151
146
  if column.datatype == :boolean
152
- value_code = "content_tag(:div, '', :class => 'checkbox-'+("+value_code.to_s+" ? 'true' : 'false'))"
147
+ value_code = "content_tag(:div, '', :class => 'checkbox-'+(" + value_code.to_s + " ? 'true' : 'false'))"
153
148
  elsif [:date, :datetime, :timestamp, :measure].include? column.datatype
154
149
  value_code = "(#{value_code}.nil? ? '' : #{value_code}.l)"
155
150
  elsif [:item].include? column.datatype
156
151
  value_code = "(#{value_code}.nil? ? '' : #{value_code}.human_name)"
157
152
  end
158
- if !column.options[:currency].is_a?(FalseClass) and currency = column.options[:currency]
153
+ if !column.options[:currency].is_a?(FalseClass) && currency = column.options[:currency]
159
154
  currency = currency[nature] if currency.is_a?(Hash)
160
155
  currency = :currency if currency.is_a?(TrueClass)
161
156
  # currency = "#{record}.#{currency}".c if currency.is_a?(Symbol)
@@ -166,25 +161,25 @@ module ActiveList
166
161
  elsif column.enumerize?
167
162
  value_code = "(#{value_code}.nil? ? '' : #{value_code}.text)"
168
163
  end
169
- if column.options[:url] and nature == :body
164
+ if column.options[:url] && nature == :body
170
165
  column.options[:url] = {} unless column.options[:url].is_a?(Hash)
171
- column.options[:url][:id] ||= (column.record_expr(record)+'.id').c
166
+ column.options[:url][:id] ||= (column.record_expr(record) + '.id').c
172
167
  column.options[:url][:action] ||= :show
173
168
  column.options[:url][:controller] ||= column.class_name.tableize.to_sym # (self.generator.collection? ? "RECORD.class.name.tableize".c : column.class_name.tableize.to_sym)
174
169
  # column.options[:url][:controller] ||= "#{value_code}.class.name.tableize".c
175
- url = column.options[:url].collect{|k, v| "#{k}: " + urlify(v, record)}.join(", ")
170
+ url = column.options[:url].collect { |k, v| "#{k}: " + urlify(v, record) }.join(', ')
176
171
  value_code = "(#{value_code}.blank? ? '' : link_to(#{value_code}.to_s, #{url}))"
177
- elsif column.options[:mode]||column.label_method == :email
172
+ elsif column.options[:mode] || column.label_method == :email
178
173
  value_code = "(#{value_code}.blank? ? '' : mail_to(#{value_code}))"
179
- elsif column.options[:mode]||column.label_method == :website
180
- value_code = "(#{value_code}.blank? ? '' : link_to("+value_code+", "+value_code+"))"
174
+ elsif column.options[:mode] || column.label_method == :website
175
+ value_code = "(#{value_code}.blank? ? '' : link_to(" + value_code + ', ' + value_code + '))'
181
176
  elsif column.label_method == :color
182
- value_code = "content_tag(:div, #{column.datum_code(record)}, style: 'background: #'+"+column.datum_code(record)+")"
183
- elsif column.label_method.to_s.match(/(^|\_)currency$/) and column.datatype == :string
177
+ value_code = "content_tag(:div, #{column.datum_code(record)}, style: 'background: #'+" + column.datum_code(record) + ')'
178
+ elsif column.label_method.to_s.match(/(^|\_)currency$/) && column.datatype == :string
184
179
  value_code = "(Nomen::Currencies[#{value_code}] ? Nomen::Currencies[#{value_code}].human_name : #{value_code})"
185
- elsif column.label_method.to_s.match(/(^|\_)language$/) and column.datatype == :string
180
+ elsif column.label_method.to_s.match(/(^|\_)language$/) && column.datatype == :string
186
181
  value_code = "(Nomen::Languages[#{value_code}] ? Nomen::Languages[#{value_code}].human_name : #{value_code})"
187
- elsif column.label_method.to_s.match(/(^|\_)country$/) and column.datatype == :string
182
+ elsif column.label_method.to_s.match(/(^|\_)country$/) && column.datatype == :string
188
183
  value_code = "(Nomen::Countries[#{value_code}] ? (image_tag('countries/' + #{value_code}.to_s + '.png') + ' ' + Nomen::Countries[#{value_code}].human_name).html_safe : #{value_code})"
189
184
  else # if column.datatype == :string
190
185
  value_code = "h(#{value_code}.to_s)"
@@ -195,7 +190,7 @@ module ActiveList
195
190
  elsif column.is_a?(ActiveList::Definition::CheckBoxColumn)
196
191
  if nature == :body
197
192
  form_name = column.form_name || "'#{table.name}[' + #{record}.id.to_s + '][#{column.name}]'".c
198
- value = "nil"
193
+ value = 'nil'
199
194
  if column.form_value
200
195
  value = recordify(column.form_value, record)
201
196
  else
@@ -204,14 +199,14 @@ module ActiveList
204
199
  end
205
200
  value_code << "check_box_tag(#{form_name.inspect}, #{value}, #{recordify!(column.options[:value] || column.name, record)})" # , id: '#{table.name}_'+#{record}.id.to_s+'_#{column.name}'
206
201
  else
207
- value_code << "nil"
202
+ value_code << 'nil'
208
203
  end
209
204
  elsif column.is_a?(ActiveList::Definition::TextFieldColumn)
210
205
  form_name = column.form_name || "'#{table.name}[' + #{record}.id.to_s + '][#{column.name}]'".c
211
- value_code = (nature == :body ? "text_field_tag(#{form_name.inspect}, #{recordify!(column.options[:value] || column.name, record)}#{column.options[:size] ? ', size: ' + column.options[:size].to_s : ''})" : "nil") # , id: '#{table.name}_'+#{record}.id.to_s + '_#{column.name}'
206
+ value_code = (nature == :body ? "text_field_tag(#{form_name.inspect}, #{recordify!(column.options[:value] || column.name, record)}#{column.options[:size] ? ', size: ' + column.options[:size].to_s : ''})" : 'nil') # , id: '#{table.name}_'+#{record}.id.to_s + '_#{column.name}'
212
207
  elsif column.is_a?(ActiveList::Definition::ActionColumn)
213
208
  next unless column.use_single?
214
- value_code = (nature == :body ? column.operation(record) : "nil")
209
+ value_code = (nature == :body ? column.operation(record) : 'nil')
215
210
  else
216
211
  value_code = "'&#160;&#8709;&#160;'.html_safe"
217
212
  end
@@ -227,15 +222,14 @@ module ActiveList
227
222
 
228
223
  code << "''.html_safe"
229
224
  # code << "content_tag(:td)"
230
- return code.c
225
+ code.c
231
226
  end
232
227
 
233
-
234
228
  # Produces main menu code
235
229
  def menu_code
236
- menu = "<span class=\"list-settings\" data-list-ref=\"#{self.uid}\">"
230
+ menu = "<span class=\"list-settings\" data-list-ref=\"#{uid}\">"
237
231
  menu << "<a class=\"settings-start\"><i></i>' + h('list.menu'.t) + '</a>"
238
- menu << "<ul>"
232
+ menu << '<ul>'
239
233
  if table.paginate?
240
234
  # Per page
241
235
  list = [5, 10, 20, 50, 100, 200]
@@ -246,7 +240,7 @@ module ActiveList
246
240
  for n in list
247
241
  menu << "<li data-list-change-page-size=\"#{n}\" '+(#{var_name(:params)}[:per_page] == #{n} ? ' class=\"check\"' : '') + '><a><i></i>' + h('list.x_per_page'.t(count: #{n})) + '</a></li>"
248
242
  end
249
- menu << "</ul></li>"
243
+ menu << '</ul></li>'
250
244
  end
251
245
 
252
246
  # Column selector
@@ -255,7 +249,7 @@ module ActiveList
255
249
  for column in table.data_columns
256
250
  menu << "<li data-list-toggle-column=\"#{column.name}\" class=\"' + (#{var_name(:params)}[:hidden_columns].include?(:#{column.name}) ? 'unchecked' : 'checked') + '\"><a><i></i>' + h(#{column.header_code}) + '</a></li>"
257
251
  end
258
- menu << "</ul></li>"
252
+ menu << '</ul></li>'
259
253
 
260
254
  # Separator
261
255
  menu << "<li class=\"separator\"></li>"
@@ -263,31 +257,29 @@ module ActiveList
263
257
  for format, exporter in ActiveList.exporters
264
258
  menu << "<li class=\"export export-#{format}\">' + link_to(content_tag(:i) + h('list.export_as'.t(exported: :#{format}.t(scope: 'list.export.formats'))), params.merge(action: :#{generator.controller_method_name}, sort: #{var_name(:params)}[:sort], dir: #{var_name(:params)}[:dir], format: '#{format}')) + '</li>"
265
259
  end
266
- menu << "</ul></span>"
267
- return menu
260
+ menu << '</ul></span>'
261
+ menu
268
262
  end
269
263
 
270
264
  # Produces the code to create the header line using top-end menu for columns
271
265
  # and pagination management
272
266
  def header_code
273
267
  code = "'<thead><tr>"
274
- if table.selectable?
275
- code << "<th class=\"list-selector\"></th>"
276
- end
268
+ code << "<th class=\"list-selector\"></th>" if table.selectable?
277
269
  for column in table.columns
278
- next if column.is_a?(ActiveList::Definition::ActionColumn) and !column.use_single?
270
+ next if column.is_a?(ActiveList::Definition::ActionColumn) && !column.use_single?
279
271
  code << "<th data-list-column=\"#{column.sort_id}\""
280
272
  code << " data-list-column-cells=\"#{column.short_id}\""
281
273
  code << " data-list-column-sort=\"'+(#{var_name(:params)}[:sort] != '#{column.sort_id}' ? 'asc' : #{var_name(:params)}[:dir] == 'asc' ? 'desc' : 'asc')+'\"" if column.sortable?
282
274
  code << " class=\"#{column_classes(column, true, true)}\""
283
- code << ">"
275
+ code << '>'
284
276
  code << "' + h(#{column.header_code}) + '"
285
- code << "<i></i>"
286
- code << "</th>"
277
+ code << '<i></i>'
278
+ code << '</th>'
287
279
  end
288
280
  # code << "<th class=\"spe\">#{menu_code}</th>"
289
281
  code << "</tr></thead>'"
290
- return code
282
+ code
291
283
  end
292
284
 
293
285
  # Produces the code to create bottom menu and pagination
@@ -296,11 +288,11 @@ module ActiveList
296
288
 
297
289
  codes = {}
298
290
  if table.global_action_columns.any?
299
-
300
- actions = ""
301
- actions << "<span class=\"list-actions\" data-list-ref=\"#{self.uid}\">'"
291
+
292
+ actions = ''
293
+ actions << "<span class=\"list-actions\" data-list-ref=\"#{uid}\">'"
302
294
  for column in table.global_action_columns
303
- actions << " + link_to(content_tag(:i) + h(' ' + :#{column.name.to_s}.t(scope: 'rest.actions')), #{column.default_url.inspect}, class: 'btn btn-#{column.name}'#{', style: "display: none"' unless column.use_none?}#{', method: "' + column.options[:method].to_s + '"' if column.options[:method]}, data: {list_actioner: :#{column.use_none? ? 'none' : 'many'}#{', confirm: :' + column.options[:confirm].to_s + '.t(scope: "labels")' if column.options[:confirm]}})"
295
+ actions << " + link_to(content_tag(:i) + h(' ' + :#{column.name}.t(scope: 'rest.actions')), #{column.default_url.inspect}, class: 'btn btn-#{column.name}'#{', style: "display: none"' unless column.use_none?}#{', method: "' + column.options[:method].to_s + '"' if column.options[:method]}, data: {list_actioner: :#{column.use_none? ? 'none' : 'many'}#{', confirm: :' + column.options[:confirm].to_s + '.t(scope: "labels")' if column.options[:confirm]}})"
304
296
  end
305
297
  actions << " + '</span>"
306
298
  code << "'#{actions}'"
@@ -312,11 +304,11 @@ module ActiveList
312
304
  codes[:settings] = "'#{menu_code}'"
313
305
 
314
306
  if table.paginate?
315
- pagination = ""
307
+ pagination = ''
316
308
  current_page = "#{var_name(:page)}"
317
309
  last_page = "#{var_name(:last)}"
318
310
 
319
- pagination << "<span class=\"list-pagination\" data-list-ref=\"#{self.uid}\">"
311
+ pagination << "<span class=\"list-pagination\" data-list-ref=\"#{uid}\">"
320
312
  pagination << "<span class=\"status\">' + 'list.pagination.x_to_y_of_total'.t(x: (#{var_name(:offset)} + (#{var_name(:count)} > 0 ? 1 : 0)), y: ((#{var_name(:last)} == #{var_name(:page)}) ? #{var_name(:count)} : #{var_name(:offset)} + #{var_name(:limit)}), total: #{var_name(:count)}) + '</span>"
321
313
 
322
314
  pagination << "<span class=\"paginator\">"
@@ -326,9 +318,9 @@ module ActiveList
326
318
  y = '@@PAGE-COUNT@@'
327
319
 
328
320
  pagination << "<a href=\"#\" data-list-move-to-page=\"' + (#{current_page} + 1).to_s + '\" class=\"btn next-page\"' + (#{current_page} != #{last_page} ? '' : ' disabled=\"true\"') + '><i></i>' + ::I18n.translate('list.pagination.next')+'</a>"
329
- pagination << "</span>"
321
+ pagination << '</span>'
330
322
 
331
- pagination << "</span>"
323
+ pagination << '</span>'
332
324
 
333
325
  code << "'#{pagination}'"
334
326
  codes[:pagination] = "'#{pagination}'"
@@ -339,14 +331,13 @@ module ActiveList
339
331
  code = "content_tag(:div, (#{code.join(' + ')}).html_safe, class: 'list-control')"
340
332
  end
341
333
 
342
- return code
334
+ code
343
335
  end
344
336
 
345
337
  def uid
346
338
  "#{table.name}-list"
347
339
  end
348
340
 
349
-
350
341
  # # Not used
351
342
  # def columns_definition_code
352
343
  # code = table.columns.collect do |column|
@@ -357,7 +348,8 @@ module ActiveList
357
348
 
358
349
  # Finds all default styles for column
359
350
  def column_classes(column, without_id = false, without_interpolation = false)
360
- classes, conds = [], []
351
+ classes = []
352
+ conds = []
361
353
  conds << [:sor, "#{var_name(:params)}[:sort] == '#{column.sort_id}'".c] if column.sortable?
362
354
  conds << [:hidden, "#{var_name(:params)}[:hidden_columns].include?(:#{column.name})".c] if column.is_a? ActiveList::Definition::DataColumn
363
355
  classes << column.options[:class].to_s.strip unless column.options[:class].blank?
@@ -373,9 +365,9 @@ module ActiveList
373
365
  classes << column.label_method if [:code, :color].include? column.label_method.to_sym
374
366
  if column.options[:mode] == :download
375
367
  classes << :dld
376
- elsif column.options[:mode]||column.label_method == :email
368
+ elsif column.options[:mode] || column.label_method == :email
377
369
  classes << :eml
378
- elsif column.options[:mode]||column.label_method == :website
370
+ elsif column.options[:mode] || column.label_method == :website
379
371
  classes << :web
380
372
  end
381
373
  elsif column.is_a? ActiveList::Definition::TextFieldColumn
@@ -399,13 +391,8 @@ module ActiveList
399
391
  end.join
400
392
  end
401
393
  end
402
- return html
394
+ html
403
395
  end
404
-
405
-
406
396
  end
407
-
408
-
409
397
  end
410
-
411
398
  end