Sha256: c62d8784caab2c411ef871b7d41a55bf2549230d45ab8f12e9555930c6bdf6b7

Contents?: true

Size: 1.85 KB

Versions: 9

Compression:

Stored size: 1.85 KB

Contents

# encoding: utf-8
module Wice
  module Columns #:nodoc:
    class ViewColumnAction < ViewColumn #:nodoc:
      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

      def in_html  #:nodoc:
        true
      end

      def capable_of_hosting_filter_related_icons?  #:nodoc:
        false
      end

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

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

    ConditionsGeneratorColumnAction = ConditionsGeneratorColumn #:nodoc:
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
wice_grid_ms-3.6.2 lib/wice/columns/column_action.rb
wice_grid_ms-3.6.1 lib/wice/columns/column_action.rb
wice_grid_ms-3.6.0 lib/wice/columns/column_action.rb
wice_grid-3.6.0 lib/wice/columns/column_action.rb
wice_grid-3.6.0.pre5 lib/wice/columns/column_action.rb
wice_grid-3.6.0.pre4 lib/wice/columns/column_action.rb
wice_grid-3.6.0.pre3 lib/wice/columns/column_action.rb
wice_grid-3.6.0.pre2 lib/wice/columns/column_action.rb
wice_grid-3.6.0.pre1 lib/wice/columns/column_action.rb