Class: Wice::Columns::ViewColumnCustomDropdown
- Inherits:
-
ViewColumn
- Object
- ViewColumn
- Wice::Columns::ViewColumnCustomDropdown
- Includes:
- ActionView::Helpers::FormOptionsHelper
- Defined in:
- lib/wice/columns/column_custom_dropdown.rb
Overview
:nodoc:
Direct Known Subclasses
Constant Summary
Constants inherited from ViewColumn
Wice::Columns::ViewColumn::FIELDS
Instance Attribute Summary collapse
-
#custom_filter ⇒ Object
contains an array of option label + option value pairs for the select, or a Proc object which returns this array.
-
#filter_all_label ⇒ Object
text in the filter dropdown for an empty <option><option>.
Attributes inherited from ViewColumn
#cell_rendering_block, #contains_a_text_input, #filter_control_options, #grid, #main_table, #table_name
Instance Method Summary collapse
-
#has_auto_reloading_select? ⇒ Boolean
:nodoc:.
-
#render_filter_internal(params) ⇒ Object
:nodoc:.
-
#yield_declaration_of_column_filter ⇒ Object
:nodoc:.
Methods inherited from ViewColumn
#add_css_class, #attribute_name_fully_qualified_for_all_but_main_table_columns, #auto_reloading_input_with_negation_checkbox?, #capable_of_hosting_filter_related_icons?, #config, #controller, #css_class, #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_declaration
Methods included from ActionView::Helpers::TagHelper
Constructor Details
This class inherits a constructor from Wice::Columns::ViewColumn
Instance Attribute Details
#custom_filter ⇒ Object
contains an array of option label + option value pairs for the select, or a Proc object which returns this array
10 11 12 |
# File 'lib/wice/columns/column_custom_dropdown.rb', line 10 def custom_filter @custom_filter end |
#filter_all_label ⇒ Object
text in the filter dropdown for an empty <option><option>
7 8 9 |
# File 'lib/wice/columns/column_custom_dropdown.rb', line 7 def filter_all_label @filter_all_label end |
Instance Method Details
#has_auto_reloading_select? ⇒ Boolean
:nodoc:
74 75 76 |
# File 'lib/wice/columns/column_custom_dropdown.rb', line 74 def has_auto_reloading_select? #:nodoc: auto_reload end |
#render_filter_internal(params) ⇒ Object
:nodoc:
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/wice/columns/column_custom_dropdown.rb', line 12 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.is_a? Proc if @custom_filter.is_a? Array @custom_filter = [[@filter_all_label, nil]] + @custom_filter.map do|label, value| [label.to_s, value.to_s] end end = { name: @parameter_name + '[]', id: @dom_id, class: 'custom-dropdown form-control' } if @turn_off_select_toggling select_toggle = '' else if self.allow_multiple_selection [:multiple] = params.is_a?(Array) && params.size > 1 , collapse_icon_style = nil, 'display: none' , collapse_icon_style = collapse_icon_style, if [:multiple] select_toggle = content_tag( :span, content_tag(:i, '', class: 'fa fa-plus'), title: NlMessage['expand'], class: 'expand-multi-select-icon clickable', style: ) + content_tag( :span, content_tag(:i, '', class: 'fa fa-minus'), title: NlMessage['collapse'], class: 'collapse-multi-select-icon clickable', style: collapse_icon_style ) else [:multiple] = false select_toggle = '' end end if auto_reload [:class] += ' auto-reload' end params_for_select = (params.is_a?(Hash) && params.empty?) ? [nil] : params '<div class="custom-dropdown-container">'.html_safe + content_tag(:select, (@custom_filter, params_for_select), ) + select_toggle.html_safe + '</div>'.html_safe end |
#yield_declaration_of_column_filter ⇒ Object
:nodoc:
67 68 69 70 71 72 |
# File 'lib/wice/columns/column_custom_dropdown.rb', line 67 def yield_declaration_of_column_filter #:nodoc: { templates: [@query_without_equals_sign], ids: [@dom_id] } end |