Class: Wice::ViewColumnCustomDropdown

Inherits:
ViewColumn show all
Includes:
ActionView::Helpers::FormOptionsHelper
Defined in:
lib/view_columns.rb

Overview

:nodoc:

Direct Known Subclasses

ViewColumnBoolean

Constant Summary

Constants inherited from ViewColumn

Wice::ViewColumn::FIELDS

Instance Attribute Summary collapse

Attributes inherited from ViewColumn

#cell_rendering_block, #contains_a_text_input, #css_class, #grid, #main_table, #model_class, #table_name

Instance Method Summary collapse

Methods inherited from ViewColumn

#auto_reloading_input_with_negation_checkbox?, #capable_of_hosting_filter_related_icons?, #config, #controller, #detachness, #filter_shown?, #filter_shown_in_main_table?, #form_parameter_name_id_and_query, #has_auto_reloading_calendar?, #has_auto_reloading_input?, #initialize, #render_filter, #yield_javascript

Constructor Details

This class inherits a constructor from Wice::ViewColumn

Instance Attribute Details

#custom_filterObject

Returns the value of attribute custom_filter.



222
223
224
# File 'lib/view_columns.rb', line 222

def custom_filter
  @custom_filter
end

#filter_all_labelObject

Returns the value of attribute filter_all_label.



221
222
223
# File 'lib/view_columns.rb', line 221

def filter_all_label
  @filter_all_label
end

Instance Method Details

#has_auto_reloading_select?Boolean

:nodoc:

Returns:

  • (Boolean)


269
270
271
# File 'lib/view_columns.rb', line 269

def has_auto_reloading_select? #:nodoc:
  auto_reload
end

#render_filter_internal(params) ⇒ Object

:nodoc:



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/view_columns.rb', line 224

def render_filter_internal(params) #:nodoc:
  @query, @query_without_equals_sign, @parameter_name, @dom_id = form_parameter_name_id_and_query('')
  @query_without_equals_sign += '%5B%5D='

  @custom_filter = @custom_filter.call if @custom_filter.kind_of? Proc

  if @custom_filter.kind_of? Array

    @custom_filter = [[@filter_all_label, nil]] + @custom_filter.map{|label, value|
      [label.to_s, value.to_s]
    }

  end

  select_options = {:name => @parameter_name, :id => @dom_id, :class => 'custom_dropdown'}

  if @turn_off_select_toggling
    select_toggle = ''
  else
    if self.allow_multiple_selection
      select_options[:multiple] = params.is_a?(Array) && params.size > 1
      select_toggle = (:a,
        tag(:img, :alt => 'Expand/Collapse', :src => Defaults::TOGGLE_MULTI_SELECT_ICON),
        :href => "javascript: toggle_multi_select('#{@dom_id}', this, 'Expand', 'Collapse');", # TO DO: to locales
        :class => 'toggle_multi_select_icon', :title => 'Expand')
    else
      select_options[:multiple] = false
      select_toggle = ''
    end
  end

  if auto_reload
    select_options[:class] += ' auto_reload'
  end

  '<span class="custom_dropdown_container">'.html_safe_if_necessary +
  (:select, options_for_select(@custom_filter, params), select_options) +
  select_toggle.html_safe_if_necessary + '</span>'.html_safe_if_necessary
end

#yield_declaration_of_column_filterObject

:nodoc:



264
265
266
267
# File 'lib/view_columns.rb', line 264

def yield_declaration_of_column_filter #:nodoc:
  %$templates : ['#{@query_without_equals_sign}'],
      ids : ['#{@dom_id}']  $
end