Class: Wice::Columns::ViewColumnString

Inherits:
ViewColumn show all
Defined in:
lib/wice/columns/column_string.rb

Overview

:nodoc:

Constant Summary

Constants inherited from ViewColumn

Wice::Columns::ViewColumn::FIELDS

Instance Attribute Summary collapse

Attributes inherited from ViewColumn

#cell_rendering_block, #contains_a_text_input, #custom_filter, #grid, #main_table, #model, #table_name

Instance Method Summary collapse

Methods inherited from ViewColumn

#add_css_class, #attribute_name_fully_qualified_for_all_but_main_table_columns, #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_select?, #initialize, #render_filter, #table_alias_or_table_name, #yield_declaration

Constructor Details

This class inherits a constructor from Wice::Columns::ViewColumn

Instance Attribute Details

#auto_reloading_input_with_negation_checkboxObject

Returns the value of attribute auto_reloading_input_with_negation_checkbox.



7
8
9
# File 'lib/wice/columns/column_string.rb', line 7

def auto_reloading_input_with_negation_checkbox
  @auto_reloading_input_with_negation_checkbox
end

#negationObject

Returns the value of attribute negation.



7
8
9
# File 'lib/wice/columns/column_string.rb', line 7

def negation
  @negation
end

Instance Method Details

#auto_reloading_input_with_negation_checkbox?Boolean

:nodoc:

Returns:

  • (Boolean)


57
58
59
# File 'lib/wice/columns/column_string.rb', line 57

def auto_reloading_input_with_negation_checkbox? #:nodoc:
  self.auto_reloading_input_with_negation_checkbox
end

#has_auto_reloading_input?Boolean

:nodoc:

Returns:

  • (Boolean)


53
54
55
# File 'lib/wice/columns/column_string.rb', line 53

def has_auto_reloading_input? #:nodoc:
  auto_reload
end

#render_filter_internal(params) ⇒ Object

:nodoc:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/wice/columns/column_string.rb', line 9

def render_filter_internal(params) #:nodoc:
  @contains_a_text_input = true
  css_class = 'form-control input-sm ' + (auto_reload ? 'auto-reload' : '')

  if negation
    self.auto_reloading_input_with_negation_checkbox = true if auto_reload

    @query, _, parameter_name, @dom_id = form_parameter_name_id_and_query(v: '')
    @query2, _, parameter_name2, @dom_id2 = form_parameter_name_id_and_query(n: '')

    '<div class="text-filter-container">' +
      text_field_tag(parameter_name, params[:v], size: 8, id: @dom_id, class: css_class) +
      if defined?(Wice::Defaults::NEGATION_CHECKBOX_LABEL) && ! Wice::ConfigurationProvider.value_for(:NEGATION_CHECKBOX_LABEL).blank?
        Wice::ConfigurationProvider.value_for(:NEGATION_CHECKBOX_LABEL)
      else
        ''
      end +
      check_box_tag(parameter_name2, '1', (params[:n] == '1'),
        id: @dom_id2,
        title: NlMessage['negation_checkbox_title'],
        class: "negation-checkbox #{css_class}") +
      '</div>'
  else
    @query, _, parameter_name, @dom_id = form_parameter_name_id_and_query('')
    text_field_tag(parameter_name, (params.blank? ? '' : params), size: 8, id: @dom_id, class: css_class)
  end
end

#yield_declaration_of_column_filterObject

:nodoc:



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/wice/columns/column_string.rb', line 38

def yield_declaration_of_column_filter #:nodoc:
  if negation
    {
      templates: [@query, @query2],
      ids:       [@dom_id, @dom_id2]
    }
  else
    {
      templates: [@query],
      ids:       [@dom_id]
    }
  end
end