Class: Wice::Columns::ViewColumnAction

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

Overview

:nodoc:

Constant Summary

Constants inherited from ViewColumn

Wice::Columns::ViewColumn::FIELDS

Instance Attribute Summary

Attributes inherited from ViewColumn

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

Instance Method Summary collapse

Methods inherited from ViewColumn

#add_css_class, #attribute_name_fully_qualified_for_all_but_main_table_columns, #auto_reloading_input_with_negation_checkbox?, #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?, #has_auto_reloading_select?, #render_filter, #render_filter_internal, #table_alias_or_table_name, #yield_declaration, #yield_declaration_of_column_filter

Methods included from ActionView::Helpers::TagHelper

#public_tag_options

Constructor Details

#initialize(grid_obj, html, param_name, select_all_buttons, object_property, html_check_box, view, block = nil) ⇒ ViewColumnAction

:nodoc:



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/wice/columns/column_action.rb', line 4

def initialize(grid_obj, html, param_name, select_all_buttons, object_property, html_check_box, view, block = nil)  #:nodoc:
  @view                 = view
  @html_check_box       = html_check_box
  @select_all_buttons   = select_all_buttons
  self.grid             = grid_obj
  self.html             = html
  Wice::WgHash.add_or_append_class_value!(self.html, 'sel')
  grid_name             = self.grid.name
  @param_name           = param_name
  @cell_rendering_block = lambda do |object, params|
    if block && !block.call(object)
      ''
    else
      selected = params[grid_name] && params[grid_name][param_name] && params[grid_name][param_name].index(object.send(object_property).to_s)
      check_box_tag("#{grid_name}[#{param_name}][]", object.send(object_property), selected, id: nil)
    end
  end
end

Instance Method Details

:nodoc:

Returns:

  • (Boolean)


27
28
29
# File 'lib/wice/columns/column_action.rb', line 27

def capable_of_hosting_filter_related_icons?  #:nodoc:
  false
end

#in_htmlObject

:nodoc:



23
24
25
# File 'lib/wice/columns/column_action.rb', line 23

def in_html  #:nodoc:
  true
end

#nameObject

:nodoc:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/wice/columns/column_action.rb', line 31

def name  #:nodoc:
  return '' unless @select_all_buttons

  if @html_check_box
    check_box_tag :select_all, 1, false, class: 'wg-select-all'
  else
    (:div,
                (:i, '', class: 'fa-regular fa-square-check'),
                class: 'clickable select-all',
                title: NlMessage['select_all']) + ' ' +
      (:div,
                  (:i, '', class: 'fa-regular fa-square'),
                  class: 'clickable deselect-all',
                  title: NlMessage['deselect_all'])
  end
end