Class: Wice::ActionViewColumn

Inherits:
ViewColumn show all
Defined in:
lib/view_columns.rb

Overview

:nodoc:

Constant Summary

Constants inherited from ViewColumn

ViewColumn::FIELDS

Instance Attribute Summary

Attributes inherited from ViewColumn

#cell_rendering_block, #contains_a_text_input, #css_class, #custom_filter, #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?, #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_of_column_filter, #yield_javascript

Methods included from ActionView::Helpers::TagHelper

#tag_options

Constructor Details

#initialize(grid_obj, td_html_attrs, param_name, select_all_buttons, object_property, view, condition) ⇒ ActionViewColumn

:nodoc:


143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/view_columns.rb', line 143

def initialize(grid_obj, td_html_attrs, param_name, select_all_buttons, object_property, view, condition)  #:nodoc:
  @condition = condition
  @view = view
  @select_all_buttons   = select_all_buttons
  self.grid             = grid_obj
  self.td_html_attrs    = td_html_attrs
  self.td_html_attrs.add_or_append_class_value!('sel')
  grid_name             = self.grid.name
  @param_name           = param_name
  @cell_rendering_block = lambda do |object, params|

    if @condition.nil? || @condition.call(object)

      selected = if params[grid_name] && params[grid_name][param_name] &&
                    params[grid_name][param_name].index(object.send(object_property).to_s)
        true
      else
        false
      end

      check_box_tag("#{grid_name}[#{param_name}][]", object.send(object_property), selected, :id => nil)

    else
      ''
    end

  end
end

Instance Method Details

:nodoc:


176
177
178
# File 'lib/view_columns.rb', line 176

def capable_of_hosting_filter_related_icons?  #:nodoc:
  false
end

#column_nameObject

:nodoc:


180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/view_columns.rb', line 180

def column_name  #:nodoc:
  return '' unless @select_all_buttons
  select_all_tootip   = WiceGridNlMessageProvider.get_message(:SELECT_ALL)
  deselect_all_tootip = WiceGridNlMessageProvider.get_message(:DESELECT_ALL)

  html = (:span, image_tag(Defaults::TICK_ALL_ICON, :alt => select_all_tootip),
                     :class => 'clickable select_all', :title => select_all_tootip) + ' ' +
         (:span, image_tag(Defaults::UNTICK_ALL_ICON, :alt => deselect_all_tootip),
                     :class => 'clickable deselect_all', :title => deselect_all_tootip)

  js = JsAdaptor.action_column_initialization(grid.name)

  [html, js]
end

#in_htmlObject

:nodoc:


172
173
174
# File 'lib/view_columns.rb', line 172

def in_html  #:nodoc:
  true
end