Class: Wice::ViewColumn
- Includes:
- ActionView::Helpers::AssetTagHelper, ActionView::Helpers::FormTagHelper, ActionView::Helpers::JavaScriptHelper, ActionView::Helpers::TagHelper
- Defined in:
- lib/view_columns.rb
Direct Known Subclasses
ActionViewColumn, ViewColumnCustomDropdown, ViewColumnDatetime, ViewColumnInteger, ViewColumnString
Constant Summary collapse
- FIELDS =
fields defined from the options parameter
[:attribute_name, :column_name, :icon, :subtitle, :th_class, :td_html_attrs, :no_filter, :model_class, :allow_multiple_selection, :in_html, :in_csv, :helper_style, :table_alias, :custom_order, :detach_with_id, :allow_ordering, :auto_reload]
- @@handled_type =
Hash.new
Instance Attribute Summary collapse
-
#cell_rendering_block ⇒ Object
Returns the value of attribute cell_rendering_block.
-
#contains_a_text_input ⇒ Object
readonly
Returns the value of attribute contains_a_text_input.
-
#css_class ⇒ Object
:nodoc:.
-
#custom_filter ⇒ Object
Returns the value of attribute custom_filter.
-
#grid ⇒ Object
Returns the value of attribute grid.
-
#main_table ⇒ Object
Returns the value of attribute main_table.
-
#model_class ⇒ Object
Returns the value of attribute model_class.
-
#table_name ⇒ Object
Returns the value of attribute table_name.
Instance Method Summary collapse
-
#auto_reloading_input_with_negation_checkbox? ⇒ Boolean
:nodoc:.
-
#capable_of_hosting_filter_related_icons? ⇒ Boolean
:nodoc:.
- #config ⇒ Object
- #controller ⇒ Object
-
#detachness ⇒ Object
:nodoc:.
-
#filter_shown? ⇒ Boolean
:nodoc:.
-
#filter_shown_in_main_table? ⇒ Boolean
:nodoc:.
-
#form_parameter_name_id_and_query(v) ⇒ Object
:nodoc:.
-
#has_auto_reloading_calendar? ⇒ Boolean
:nodoc:.
-
#has_auto_reloading_input? ⇒ Boolean
:nodoc:.
-
#has_auto_reloading_select? ⇒ Boolean
:nodoc:.
-
#initialize(block, options, grid_obj, tname, mtable, cfilter, view) ⇒ ViewColumn
constructor
:nodoc:.
-
#render_filter ⇒ Object
:nodoc:.
-
#render_filter_internal(params) ⇒ Object
:nodoc:.
-
#yield_declaration_of_column_filter ⇒ Object
:nodoc:.
-
#yield_javascript ⇒ Object
:nodoc:.
Constructor Details
#initialize(block, options, grid_obj, tname, mtable, cfilter, view) ⇒ ViewColumn
:nodoc:
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/view_columns.rb', line 20 def initialize(block, , grid_obj, tname, mtable, cfilter, view) #:nodoc: self.cell_rendering_block = block self.grid = grid_obj self.table_name = tname self.main_table = mtable self.custom_filter = cfilter @view = view FIELDS.each do |field| self.send("#{field}=", [field]) end end |
Instance Attribute Details
#cell_rendering_block ⇒ Object
Returns the value of attribute cell_rendering_block.
16 17 18 |
# File 'lib/view_columns.rb', line 16 def cell_rendering_block @cell_rendering_block end |
#contains_a_text_input ⇒ Object (readonly)
Returns the value of attribute contains_a_text_input.
18 19 20 |
# File 'lib/view_columns.rb', line 18 def contains_a_text_input @contains_a_text_input end |
#css_class ⇒ Object
:nodoc:
36 37 38 |
# File 'lib/view_columns.rb', line 36 def css_class @css_class end |
#custom_filter ⇒ Object
Returns the value of attribute custom_filter.
16 17 18 |
# File 'lib/view_columns.rb', line 16 def custom_filter @custom_filter end |
#grid ⇒ Object
Returns the value of attribute grid.
16 17 18 |
# File 'lib/view_columns.rb', line 16 def grid @grid end |
#main_table ⇒ Object
Returns the value of attribute main_table.
16 17 18 |
# File 'lib/view_columns.rb', line 16 def main_table @main_table end |
#model_class ⇒ Object
Returns the value of attribute model_class.
16 17 18 |
# File 'lib/view_columns.rb', line 16 def model_class @model_class end |
#table_name ⇒ Object
Returns the value of attribute table_name.
16 17 18 |
# File 'lib/view_columns.rb', line 16 def table_name @table_name end |
Instance Method Details
#auto_reloading_input_with_negation_checkbox? ⇒ Boolean
:nodoc:
104 105 106 |
# File 'lib/view_columns.rb', line 104 def auto_reloading_input_with_negation_checkbox? #:nodoc: false end |
#capable_of_hosting_filter_related_icons? ⇒ Boolean
:nodoc:
96 97 98 |
# File 'lib/view_columns.rb', line 96 def #:nodoc: self.attribute_name.blank? && self.column_name.blank? && ! self.filter_shown? end |
#config ⇒ Object
62 63 64 |
# File 'lib/view_columns.rb', line 62 def config @view.config end |
#controller ⇒ Object
66 67 68 |
# File 'lib/view_columns.rb', line 66 def controller @view.controller end |
#detachness ⇒ Object
:nodoc:
44 45 46 |
# File 'lib/view_columns.rb', line 44 def detachness #:nodoc: (! detach_with_id.blank?).to_s end |
#filter_shown? ⇒ Boolean
:nodoc:
88 89 90 |
# File 'lib/view_columns.rb', line 88 def filter_shown? #:nodoc: self.attribute_name && ! self.no_filter end |
#filter_shown_in_main_table? ⇒ Boolean
:nodoc:
92 93 94 |
# File 'lib/view_columns.rb', line 92 def filter_shown_in_main_table? #:nodoc: filter_shown? && ! self.detach_with_id end |
#form_parameter_name_id_and_query(v) ⇒ Object
:nodoc:
80 81 82 83 84 85 86 |
# File 'lib/view_columns.rb', line 80 def form_parameter_name_id_and_query(v) #:nodoc: query = form_parameter_template(v) query_without_equals_sign = query.sub(/=$/,'') parameter_name = CGI.unescape(query_without_equals_sign) dom_id = id_out_of_name(parameter_name) return query, query_without_equals_sign, parameter_name, dom_id.tr('.', '_') end |
#has_auto_reloading_calendar? ⇒ Boolean
:nodoc:
112 113 114 |
# File 'lib/view_columns.rb', line 112 def has_auto_reloading_calendar? #:nodoc: false end |
#has_auto_reloading_input? ⇒ Boolean
:nodoc:
100 101 102 |
# File 'lib/view_columns.rb', line 100 def has_auto_reloading_input? #:nodoc: false end |
#has_auto_reloading_select? ⇒ Boolean
:nodoc:
108 109 110 |
# File 'lib/view_columns.rb', line 108 def has_auto_reloading_select? #:nodoc: false end |
#render_filter ⇒ Object
:nodoc:
70 71 72 73 74 |
# File 'lib/view_columns.rb', line 70 def render_filter #:nodoc: params = @grid.filter_params(self) res = render_filter_internal(params) return (res.is_a?(Array)) ? res : [res, nil] end |
#render_filter_internal(params) ⇒ Object
:nodoc:
76 77 78 |
# File 'lib/view_columns.rb', line 76 def render_filter_internal(params) #:nodoc: '<!-- implement me! -->' end |
#yield_declaration_of_column_filter ⇒ Object
:nodoc:
40 41 42 |
# File 'lib/view_columns.rb', line 40 def yield_declaration_of_column_filter #:nodoc: nil end |
#yield_javascript ⇒ Object
:nodoc:
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/view_columns.rb', line 48 def yield_javascript #:nodoc: declaration = yield_declaration_of_column_filter if declaration %!#{@grid.name}.register( { filter_name : "#{self.column_name}", detached : #{detachness}, #{declaration} } ); ! else '' end end |