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

#attribute_name_fully_qualified_for_all_but_main_table_columns, #auto_reloading_input_with_negation_checkbox?, #capable_of_hosting_filter_related_icons?, #detachness, #filter_shown?, #filter_shown_in_main_table?, #form_parameter_name_id_and_query, #fully_qualified_attribute_name, #has_auto_reloading_calendar?, #has_auto_reloading_input?, #initialize, #render_filter, #table_alias_or_table_name, #yield_javascript

Methods included from ActionView::Helpers::TagHelper

#tag_options

Constructor Details

This class inherits a constructor from Wice::ViewColumn

Instance Attribute Details

#custom_filterObject

Returns the value of attribute custom_filter


237
238
239
# File 'lib/view_columns.rb', line 237

def custom_filter
  @custom_filter
end

#filter_all_labelObject

Returns the value of attribute filter_all_label


236
237
238
# File 'lib/view_columns.rb', line 236

def filter_all_label
  @filter_all_label
end

Instance Method Details

#has_auto_reloading_select?Boolean

:nodoc:

Returns:

  • (Boolean)

284
285
286
# File 'lib/view_columns.rb', line 284

def has_auto_reloading_select? #:nodoc:
  auto_reload
end

#render_filter_internal(params) ⇒ Object

:nodoc:


239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/view_columns.rb', line 239

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:


279
280
281
282
# File 'lib/view_columns.rb', line 279

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