wice_grid 3.5.0 → 3.6.0.pre1

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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/.inch.yml +3 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +181 -0
  5. data/.travis.yml +22 -0
  6. data/{CHANGELOG → CHANGELOG.md} +95 -31
  7. data/Gemfile +4 -1
  8. data/README.md +1517 -0
  9. data/Rakefile +51 -7
  10. data/{SAVED_QUERIES_HOWTO.rdoc → SAVED_QUERIES_HOWTO.md} +34 -31
  11. data/TODO.md +16 -0
  12. data/lib/generators/wice_grid/add_migration_for_serialized_queries_generator.rb +4 -6
  13. data/lib/generators/wice_grid/install_generator.rb +2 -5
  14. data/lib/generators/wice_grid/templates/create_wice_grid_serialized_queries.rb +1 -0
  15. data/lib/generators/wice_grid/templates/wice_grid_config.rb +29 -34
  16. data/lib/wice/active_record_column_wrapper.rb +36 -17
  17. data/lib/wice/columns.rb +53 -52
  18. data/lib/wice/columns/column_action.rb +11 -13
  19. data/lib/wice/columns/column_boolean.rb +9 -11
  20. data/lib/wice/columns/column_bootstrap_datepicker.rb +48 -0
  21. data/lib/wice/columns/column_custom_dropdown.rb +22 -23
  22. data/lib/wice/columns/column_float.rb +2 -6
  23. data/lib/wice/columns/column_html5_datepicker.rb +31 -0
  24. data/lib/wice/columns/column_integer.rb +9 -13
  25. data/lib/wice/columns/column_jquery_datepicker.rb +49 -0
  26. data/lib/wice/columns/column_processor_index.rb +18 -13
  27. data/lib/wice/columns/column_rails_date_helper.rb +41 -0
  28. data/lib/wice/columns/column_rails_datetime_helper.rb +40 -0
  29. data/lib/wice/columns/column_range.rb +7 -11
  30. data/lib/wice/columns/column_string.rb +24 -20
  31. data/lib/wice/columns/common_date_datetime_mixin.rb +20 -0
  32. data/lib/wice/columns/common_js_date_datetime_conditions_generator_mixin.rb +39 -0
  33. data/lib/wice/columns/common_js_date_datetime_mixin.rb +15 -0
  34. data/lib/wice/columns/{column_date.rb → common_rails_date_datetime_conditions_generator_mixin.rb} +4 -22
  35. data/lib/wice/columns/common_standard_helper_date_datetime_mixin.rb +22 -0
  36. data/lib/wice/grid_output_buffer.rb +19 -10
  37. data/lib/wice/grid_renderer.rb +146 -85
  38. data/lib/wice/helpers/bs_calendar_helpers.rb +6 -7
  39. data/lib/wice/helpers/js_calendar_helpers.rb +19 -17
  40. data/lib/wice/helpers/wice_grid_misc_view_helpers.rb +18 -18
  41. data/lib/wice/helpers/wice_grid_serialized_queries_view_helpers.rb +44 -49
  42. data/lib/wice/helpers/wice_grid_view_helpers.rb +131 -134
  43. data/lib/wice/kaminari_monkey_patching.rb +3 -1
  44. data/lib/wice/table_column_matrix.rb +23 -8
  45. data/lib/wice/wice_grid_controller.rb +12 -16
  46. data/lib/wice/wice_grid_core_ext.rb +12 -20
  47. data/lib/wice/wice_grid_misc.rb +131 -53
  48. data/lib/wice/wice_grid_serialized_queries_controller.rb +10 -11
  49. data/lib/wice/wice_grid_serialized_query.rb +4 -3
  50. data/lib/wice/wice_grid_spreadsheet.rb +19 -18
  51. data/lib/wice_grid.rb +144 -135
  52. data/spec/schema.rb +9 -0
  53. data/spec/spec_helper.rb +75 -0
  54. data/spec/support/active_record.rb +11 -0
  55. data/spec/support/wice_grid_test_config.rb +172 -0
  56. data/spec/wice/grid_output_buffer_spec.rb +41 -0
  57. data/spec/wice/table_column_matrix_spec.rb +38 -0
  58. data/spec/wice/wice_grid_misc_spec.rb +159 -0
  59. data/spec/wice/wice_grid_spreadsheet_spec.rb +14 -0
  60. data/test/readme.txt +1 -1
  61. data/vendor/assets/javascripts/wice_grid_init.js.coffee +14 -8
  62. data/vendor/assets/stylesheets/wice_grid.scss +84 -0
  63. data/wice_grid.gemspec +32 -16
  64. metadata +217 -25
  65. data/README.rdoc +0 -1325
  66. data/lib/generators/wice_grid/templates/wice_grid.scss +0 -140
  67. data/lib/wice/columns/column_datetime.rb +0 -171
  68. data/vendor/assets/images/icons/grid/arrow_down.gif +0 -0
  69. data/vendor/assets/images/icons/grid/arrow_up.gif +0 -0
  70. data/vendor/assets/images/icons/grid/calendar_view_month.png +0 -0
  71. data/vendor/assets/images/icons/grid/collapse.gif +0 -0
  72. data/vendor/assets/images/icons/grid/delete.png +0 -0
  73. data/vendor/assets/images/icons/grid/expand.gif +0 -0
  74. data/vendor/assets/images/icons/grid/page_white_excel.png +0 -0
  75. data/vendor/assets/images/icons/grid/page_white_find.png +0 -0
  76. data/vendor/assets/images/icons/grid/table.png +0 -0
  77. data/vendor/assets/images/icons/grid/table_refresh.png +0 -0
  78. data/vendor/assets/images/icons/grid/tick_all.png +0 -0
  79. data/vendor/assets/images/icons/grid/untick_all.png +0 -0
data/lib/wice/columns.rb CHANGED
@@ -1,37 +1,32 @@
1
+ # encoding: utf-8
1
2
  module Wice #:nodoc:
2
-
3
3
  module Columns #:nodoc:
4
-
5
4
  mattr_reader :handled_type_view, :handled_type_conditions_generator
6
5
 
7
6
  class << self #:nodoc:
8
-
9
7
  def load_column_processors #:nodoc:
10
-
11
8
  require_columns
12
9
 
13
- loaded_view_column_processors = Hash.new
14
-
15
10
  @@handled_type_view = build_table_of_processors 'view'
16
11
  @@handled_type_conditions_generator = build_table_of_processors 'conditions_generator'
17
12
 
18
13
  if Wice::Defaults.const_defined?(:ADDITIONAL_COLUMN_PROCESSORS)
19
14
 
20
- common_error_prefix = "Error loading Wice::Defaults::ADDITIONAL_COLUMN_PROCESSORS. "
15
+ common_error_prefix = 'Error loading Wice::Defaults::ADDITIONAL_COLUMN_PROCESSORS. '
21
16
 
22
17
  Wice::Defaults::ADDITIONAL_COLUMN_PROCESSORS.each do |key, value|
23
18
  unless key.is_a?(Symbol)
24
- raise common_error_prefix + "A key of Wice::Defaults::ADDITIONAL_COLUMN_PROCESSORS should be a Symbol!"
19
+ fail common_error_prefix + 'A key of Wice::Defaults::ADDITIONAL_COLUMN_PROCESSORS should be a Symbol!'
25
20
  end
26
21
 
27
- if @@handled_type_view.has_key?(key)
28
- raise common_error_prefix +
22
+ if @@handled_type_view.key?(key)
23
+ fail common_error_prefix +
29
24
  "Column with key \"#{key}\" already exists in WiceGrid, overwriting existing columns is forbidden, please choose another key!"
30
25
  end
31
26
 
32
- if ! value.is_a?(Array) || value.size != 2
33
- raise common_error_prefix +
34
- "A value of Wice::Defaults::ADDITIONAL_COLUMN_PROCESSORS should be a a 2-element array!"
27
+ if !value.is_a?(Array) || value.size != 2
28
+ fail common_error_prefix +
29
+ 'A value of Wice::Defaults::ADDITIONAL_COLUMN_PROCESSORS should be a a 2-element array!'
35
30
  end
36
31
 
37
32
  view_processor, conditions_generator = value.map(&:to_s).map do |klass|
@@ -43,22 +38,19 @@ module Wice #:nodoc:
43
38
  end
44
39
 
45
40
  unless view_processor.ancestors.include?(::Wice::Columns::ViewColumn)
46
- raise common_error_prefix +
41
+ fail common_error_prefix +
47
42
  "#{view_processor} should be inherited from Wice::Columns::ViewColumn!"
48
43
  end
49
44
 
50
-
51
45
  unless conditions_generator.ancestors.include?(::Wice::Columns::ConditionsGeneratorColumn)
52
- raise common_error_prefix +
46
+ fail common_error_prefix +
53
47
  "#{conditions_generator} should be inherited from Wice::Columns::ConditionsGeneratorColumn!"
54
48
  end
55
49
 
56
50
  @@handled_type_view[key] = view_processor
57
51
  @@handled_type_conditions_generator[key] = conditions_generator
58
-
59
52
  end
60
53
  end
61
-
62
54
  end
63
55
 
64
56
  def get_view_column_processor(column_type) #:nodoc:
@@ -67,22 +59,21 @@ module Wice #:nodoc:
67
59
 
68
60
  def get_conditions_generator_column_processor(column_type) #:nodoc:
69
61
  column_type = column_type.intern if column_type.is_a? String
70
- @@handled_type_conditions_generator[column_type] || raise("Could not find conditions generator processor for column_type #{column_type}")
62
+ @@handled_type_conditions_generator[column_type] || fail("Could not find conditions generator processor for column_type #{column_type}")
71
63
  end
72
64
 
73
-
74
65
  private
75
66
 
76
67
  def build_table_of_processors(prefix)
77
- Hash.new.tap do |processor_table|
78
- loaded_processors = Hash.new
68
+ {}.tap do |processor_table|
69
+ loaded_processors = {}
79
70
 
80
71
  Wice::Columns::COLUMN_PROCESSOR_INDEX.each do |column_type, column_source_file|
81
72
  unless loaded_processors[column_source_file]
82
73
  processor_class_name = "#{prefix}_#{column_source_file}".classify
83
74
 
84
75
  unless Wice::Columns.const_defined?(processor_class_name.intern)
85
- raise "#{column_source_file}.rb is expected to define #{processor_class_name}!"
76
+ fail "#{column_source_file}.rb is expected to define #{processor_class_name}!"
86
77
  end
87
78
  processor_class = eval("Wice::Columns::#{processor_class_name}")
88
79
 
@@ -99,12 +90,9 @@ module Wice #:nodoc:
99
90
  require "wice/columns/#{column_source_file}.rb"
100
91
  end
101
92
  end
102
-
103
93
  end
104
94
 
105
95
  class ViewColumn #:nodoc:
106
-
107
-
108
96
  include ActionView::Helpers::FormTagHelper
109
97
  include ActionView::Helpers::TagHelper
110
98
  include ActionView::Helpers::JavaScriptHelper
@@ -112,12 +100,29 @@ module Wice #:nodoc:
112
100
 
113
101
  # fields defined from the options parameter
114
102
  FIELDS = [:attribute, :name, :html, :filter, :model, :allow_multiple_selection,
115
- :in_html, :in_csv, :helper_style, :table_alias, :custom_order, :detach_with_id, :ordering, :auto_reload]
103
+ :in_html, :in_csv, :table_alias, :custom_order, :detach_with_id, :ordering, :auto_reload]
104
+
105
+ attr_accessor(*FIELDS)
106
+
107
+ # a Proc object which would return contents of one cell
108
+ attr_accessor :cell_rendering_block
109
+
110
+ # reference to the WiceGrid instance
111
+ attr_accessor :grid
112
+
113
+ # name of the table
114
+ attr_accessor :table_name
116
115
 
117
- attr_accessor *FIELDS
116
+ # name of the main table (first argument to initialize_grid)
117
+ attr_accessor :main_table
118
118
 
119
- attr_accessor :cell_rendering_block, :grid, :table_name, :main_table, :model, :custom_filter
119
+ # attr_accessor :model
120
120
 
121
+ # specification for a custom filter: an array of option label + option value pairs for the select, or a Proc object which returns this array.
122
+ # Or nil if it is not a custom filter
123
+ attr_accessor :custom_filter
124
+
125
+ # A boolean flag: whether a column has a text input or not
121
126
  attr_reader :contains_a_text_input
122
127
 
123
128
  def initialize(block, options, grid_obj, tname, mtable, cfilter, view) #:nodoc:
@@ -133,8 +138,7 @@ module Wice #:nodoc:
133
138
  end
134
139
  end
135
140
 
136
-
137
- def add_css_class(klass_value)
141
+ def add_css_class(klass_value) #:nodoc:
138
142
  self.html ||= {}
139
143
  if html[:class].nil?
140
144
  html[:class] = klass_value
@@ -157,7 +161,7 @@ module Wice #:nodoc:
157
161
  end
158
162
 
159
163
  def detachness #:nodoc:
160
- (! detach_with_id.blank?).to_s
164
+ (!detach_with_id.blank?).to_s
161
165
  end
162
166
 
163
167
  def yield_declaration #:nodoc:
@@ -171,7 +175,6 @@ module Wice #:nodoc:
171
175
  end
172
176
  end
173
177
 
174
-
175
178
  def config #:nodoc:
176
179
  @view.config
177
180
  end
@@ -180,22 +183,21 @@ module Wice #:nodoc:
180
183
  @view.controller
181
184
  end
182
185
 
183
-
184
186
  def render_filter #:nodoc:
185
187
  params = @grid.filter_params(self)
186
188
  render_filter_internal(params)
187
189
  end
188
190
 
189
- def render_filter_internal(params) #:nodoc:
191
+ def render_filter_internal(_params) #:nodoc:
190
192
  '<!-- implement me! -->'
191
193
  end
192
194
 
193
195
  def form_parameter_name_id_and_query(v) #:nodoc:
194
196
  query = form_parameter_template(v)
195
- query_without_equals_sign = query.sub(/=$/,'')
197
+ query_without_equals_sign = query.sub(/=$/, '')
196
198
  parameter_name = CGI.unescape(query_without_equals_sign)
197
199
  dom_id = id_out_of_name(parameter_name)
198
- return query, query_without_equals_sign, parameter_name, dom_id.tr('.', '_')
200
+ [query, query_without_equals_sign, parameter_name, dom_id.tr('.', '_')]
199
201
  end
200
202
 
201
203
  # bad name, because for the main table the name is not really 'fully_qualified'
@@ -207,22 +209,20 @@ module Wice #:nodoc:
207
209
  table_alias_or_table_name + '.' + attribute
208
210
  end
209
211
 
210
-
211
212
  def filter_shown? #:nodoc:
212
213
  self.attribute && self.filter
213
214
  end
214
215
 
215
216
  def filter_shown_in_main_table? #:nodoc:
216
- filter_shown? && ! self.detach_with_id
217
+ filter_shown? && !self.detach_with_id
217
218
  end
218
219
 
219
-
220
220
  def table_alias_or_table_name #:nodoc:
221
221
  table_alias || table_name
222
222
  end
223
223
 
224
224
  def capable_of_hosting_filter_related_icons? #:nodoc:
225
- self.attribute.blank? && self.name.blank? && ! self.filter_shown?
225
+ self.attribute.blank? && self.name.blank? && !self.filter_shown?
226
226
  end
227
227
 
228
228
  def has_auto_reloading_input? #:nodoc:
@@ -244,7 +244,7 @@ module Wice #:nodoc:
244
244
  protected
245
245
 
246
246
  def form_parameter_template(v) #:nodoc:
247
- {@grid.name => {f: {self.attribute_name_fully_qualified_for_all_but_main_table_columns => v}}}.to_query
247
+ { @grid.name => { f: { self.attribute_name_fully_qualified_for_all_but_main_table_columns => v } } }.to_query
248
248
  end
249
249
 
250
250
  def form_parameter_name(v) #:nodoc:
@@ -252,24 +252,25 @@ module Wice #:nodoc:
252
252
  end
253
253
 
254
254
  def name_out_of_template(s) #:nodoc:
255
- CGI.unescape(s).sub(/=$/,'')
255
+ CGI.unescape(s).sub(/=$/, '')
256
256
  end
257
257
 
258
258
  def id_out_of_name(s) #:nodoc:
259
- s.gsub(/[\[\]]+/,'_').sub(/_+$/, '')
259
+ s.gsub(/[\[\]]+/, '_').sub(/_+$/, '')
260
260
  end
261
-
262
261
  end
263
262
 
264
-
265
263
  class ConditionsGeneratorColumn #:nodoc:
266
-
267
- def initialize(column_wrapper) #:nodoc:
264
+ def initialize(column_wrapper, column_type = nil) #:nodoc:
265
+ # Wice::ActiveRecordColumnWrapper
268
266
  @column_wrapper = column_wrapper
267
+ @column_type = column_type
269
268
  end
270
- end
271
-
272
- end
273
269
 
270
+ def generate_conditions(_table_alias, _opts) #:nodoc:
271
+ fail('implement me')
272
+ end
274
273
 
275
- end
274
+ end
275
+ end
276
+ end
@@ -1,11 +1,9 @@
1
+ # encoding: utf-8
1
2
  module Wice
2
-
3
3
  module Columns #:nodoc:
4
-
5
-
6
4
  class ViewColumnAction < ViewColumn #:nodoc:
7
5
  def initialize(grid_obj, html, param_name, select_all_buttons, object_property, html_check_box, view, block = nil) #:nodoc:
8
- @view = view
6
+ @view = view
9
7
  @html_check_box = html_check_box
10
8
  @select_all_buttons = select_all_buttons
11
9
  self.grid = grid_obj
@@ -14,7 +12,7 @@ module Wice
14
12
  grid_name = self.grid.name
15
13
  @param_name = param_name
16
14
  @cell_rendering_block = lambda do |object, params|
17
- if block && ! block.call(object)
15
+ if block && !block.call(object)
18
16
  ''
19
17
  else
20
18
  selected = params[grid_name] && params[grid_name][param_name] && params[grid_name][param_name].index(object.send(object_property).to_s)
@@ -35,20 +33,20 @@ module Wice
35
33
  return '' unless @select_all_buttons
36
34
 
37
35
  if @html_check_box
38
- check_box_tag :select_all, 1, false, {class: 'wg-select-all'}
36
+ check_box_tag :select_all, 1, false, class: 'wg-select-all'
39
37
  else
40
- content_tag(:div, '',
38
+ content_tag(:div,
39
+ content_tag(:i, '', class: 'fa fa-check-square-o'),
41
40
  class: 'clickable select-all',
42
41
  title: NlMessage['select_all']) + ' ' +
43
- content_tag(:div, '',
44
- class: 'clickable deselect-all',
45
- title: NlMessage['deselect_all'])
42
+ content_tag(:div,
43
+ content_tag(:i, '', class: 'fa fa-square-o'),
44
+ class: 'clickable deselect-all',
45
+ title: NlMessage['deselect_all'])
46
46
  end
47
-
48
47
  end
49
-
50
48
  end
51
49
 
52
50
  ConditionsGeneratorColumnAction = ConditionsGeneratorColumn #:nodoc:
53
51
  end
54
- end
52
+ end
@@ -1,11 +1,14 @@
1
+ # encoding: utf-8
1
2
  module Wice
2
-
3
3
  module Columns #:nodoc:
4
-
5
4
  class ViewColumnBoolean < ViewColumnCustomDropdown #:nodoc:
6
5
  include ActionView::Helpers::FormOptionsHelper
7
6
 
8
- attr_accessor :boolean_filter_true_label, :boolean_filter_false_label
7
+ # Text for the true value
8
+ attr_accessor :boolean_filter_true_label
9
+
10
+ # Text for the false value
11
+ attr_accessor :boolean_filter_false_label
9
12
 
10
13
  def render_filter_internal(params) #:nodoc:
11
14
  @custom_filter = {
@@ -19,10 +22,9 @@ module Wice
19
22
  end
20
23
  end
21
24
 
22
-
23
25
  class ConditionsGeneratorColumnBoolean < ConditionsGeneratorColumn #:nodoc:
24
26
  def generate_conditions(table_alias, opts) #:nodoc:
25
- unless (opts.kind_of?(Array) && opts.size == 1)
27
+ unless opts.is_a?(Array) && opts.size == 1
26
28
  Wice.log "invalid parameters for the grid boolean filter - must be an one item array: #{opts.inspect}"
27
29
  return false
28
30
  end
@@ -31,12 +33,8 @@ module Wice
31
33
  [" (#{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} = ? or #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} is null) ", false]
32
34
  elsif opts == 't'
33
35
  [" #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} = ?", true]
34
- else
35
- nil
36
- end
36
+ end
37
37
  end
38
38
  end
39
-
40
39
  end
41
-
42
- end
40
+ end
@@ -0,0 +1,48 @@
1
+ # encoding: utf-8
2
+ module Wice
3
+ module Columns #:nodoc:
4
+ class ViewColumnBootstrapDatepicker < ViewColumn #:nodoc:
5
+
6
+ include Wice::BsCalendarHelpers
7
+ include Wice::Columns::CommonDateDatetimeMixin
8
+ include Wice::Columns::CommonJsDateDatetimeMixin
9
+
10
+ def do_render(params) #:nodoc:
11
+ calendar_data_from = prepare_data_for_bscalendar(
12
+ initial_date: params[:fr],
13
+ name: @name1,
14
+ fire_event: auto_reload,
15
+ grid_name: self.grid.name
16
+ )
17
+
18
+ calendar_data_to = prepare_data_for_bscalendar(
19
+ initial_date: params[:to],
20
+ name: @name2,
21
+ fire_event: auto_reload,
22
+ grid_name: self.grid.name
23
+ )
24
+
25
+ calendar_data_from.the_other_datepicker_id_to = calendar_data_to.dom_id
26
+ calendar_data_to.the_other_datepicker_id_from = calendar_data_from.dom_id
27
+
28
+ html1 = date_calendar_bs calendar_data_from
29
+
30
+ html2 = date_calendar_bs calendar_data_to
31
+
32
+ %(<div class="date-filter wg-bootstrap-datepicker">#{html1}#{html2}</div>)
33
+ end
34
+
35
+
36
+ def has_auto_reloading_calendar? #:nodoc:
37
+ auto_reload
38
+ end
39
+
40
+ end
41
+
42
+ class ConditionsGeneratorColumnBootstrapDatepicker < ConditionsGeneratorColumn #:nodoc:
43
+
44
+ include Wice::Columns::CommonJsDateDatetimeConditionsGeneratorMixin
45
+
46
+ end
47
+ end
48
+ end
@@ -1,26 +1,28 @@
1
+ # encoding: utf-8
1
2
  module Wice
2
-
3
3
  module Columns #:nodoc:
4
-
5
4
  class ViewColumnCustomDropdown < ViewColumn #:nodoc:
6
5
  include ActionView::Helpers::FormOptionsHelper
7
6
 
7
+ # text in the filter dropdown for an empty <option><option>
8
8
  attr_accessor :filter_all_label
9
+
10
+ # contains an array of option label + option value pairs for the select, or a Proc object which returns this array
9
11
  attr_accessor :custom_filter
10
12
 
11
13
  def render_filter_internal(params) #:nodoc:
12
14
  @query, @query_without_equals_sign, @parameter_name, @dom_id = form_parameter_name_id_and_query('')
13
15
  @query_without_equals_sign += '%5B%5D='
14
16
 
15
- @custom_filter = @custom_filter.call if @custom_filter.kind_of? Proc
17
+ @custom_filter = @custom_filter.call if @custom_filter.is_a? Proc
16
18
 
17
- if @custom_filter.kind_of? Array
18
- @custom_filter = [[@filter_all_label, nil]] + @custom_filter.map{|label, value|
19
+ if @custom_filter.is_a? Array
20
+ @custom_filter = [[@filter_all_label, nil]] + @custom_filter.map do|label, value|
19
21
  [label.to_s, value.to_s]
20
- }
22
+ end
21
23
  end
22
24
 
23
- select_options = {name: @parameter_name + '[]', id: @dom_id, class: 'custom-dropdown form-control'}
25
+ select_options = { name: @parameter_name + '[]', id: @dom_id, class: 'custom-dropdown form-control' }
24
26
 
25
27
  if @turn_off_select_toggling
26
28
  select_toggle = ''
@@ -31,12 +33,16 @@ module Wice
31
33
  expand_icon_style, collapse_icon_style = nil, 'display: none'
32
34
  expand_icon_style, collapse_icon_style = collapse_icon_style, expand_icon_style if select_options[:multiple]
33
35
 
34
- select_toggle = content_tag(:span, '',
36
+ select_toggle = content_tag(
37
+ :span,
38
+ content_tag(:i, '', class: 'fa fa-plus'),
35
39
  title: NlMessage['expand'],
36
40
  class: 'expand-multi-select-icon clickable',
37
41
  style: expand_icon_style
38
42
  ) +
39
- content_tag(:span, '',
43
+ content_tag(
44
+ :span,
45
+ content_tag(:i, '', class: 'fa fa-minus'),
40
46
  title: NlMessage['collapse'],
41
47
  class: 'collapse-multi-select-icon clickable',
42
48
  style: collapse_icon_style
@@ -55,11 +61,10 @@ module Wice
55
61
 
56
62
  '<div class="custom-dropdown-container">'.html_safe +
57
63
  content_tag(:select,
58
- options_for_select(@custom_filter, params_for_select),
59
- select_options) + select_toggle.html_safe + '</div>'.html_safe
64
+ options_for_select(@custom_filter, params_for_select),
65
+ select_options) + select_toggle.html_safe + '</div>'.html_safe
60
66
  end
61
67
 
62
-
63
68
  def yield_declaration_of_column_filter #:nodoc:
64
69
  {
65
70
  templates: [@query_without_equals_sign],
@@ -67,23 +72,20 @@ module Wice
67
72
  }
68
73
  end
69
74
 
70
-
71
75
  def has_auto_reloading_select? #:nodoc:
72
76
  auto_reload
73
77
  end
74
78
  end
75
79
 
76
-
77
80
  class ConditionsGeneratorColumnCustomDropdown < ConditionsGeneratorColumn #:nodoc:
78
-
79
81
  def generate_conditions(table_alias, opts) #:nodoc:
80
82
  if opts.empty? || (opts.is_a?(Array) && opts.size == 1 && opts[0].blank?)
81
83
  return false
82
84
  end
83
- opts = (opts.kind_of?(Array) && opts.size == 1) ? opts[0] : opts
85
+ opts = (opts.is_a?(Array) && opts.size == 1) ? opts[0] : opts
84
86
 
85
- if opts.kind_of?(Array)
86
- opts_with_special_values, normal_opts = opts.partition{|v| ::Wice::GridTools.special_value(v)}
87
+ if opts.is_a?(Array)
88
+ opts_with_special_values, normal_opts = opts.partition { |v| ::Wice::GridTools.special_value(v) }
87
89
 
88
90
  conditions_ar = if normal_opts.size > 0
89
91
  [" #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} IN ( " + (['?'] * normal_opts.size).join(', ') + ' )'] + normal_opts
@@ -92,7 +94,7 @@ module Wice
92
94
  end
93
95
 
94
96
  if opts_with_special_values.size > 0
95
- special_conditions = opts_with_special_values.collect{|v| " #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} is " + v}.join(' or ')
97
+ special_conditions = opts_with_special_values.collect { |v| " #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} is " + v }.join(' or ')
96
98
  if conditions_ar.size > 0
97
99
  conditions_ar[0] = " (#{conditions_ar[0]} or #{special_conditions} ) "
98
100
  else
@@ -108,9 +110,6 @@ module Wice
108
110
  end
109
111
  end
110
112
  end
111
-
112
113
  end
113
-
114
114
  end
115
-
116
- end
115
+ end