Class: Greedo::GridHelper::Grid::Field
- Inherits:
-
Struct
- Object
- Struct
- Greedo::GridHelper::Grid::Field
- Defined in:
- lib/greedo/grid_helper.rb
Instance Method Summary collapse
- #klass ⇒ Object
- #order_asc_class ⇒ Object
- #order_asc_path ⇒ Object
- #order_desc_class ⇒ Object
- #order_desc_path ⇒ Object
- #ordered_by? ⇒ Boolean
- #params ⇒ Object
- #value(record) ⇒ Object
Instance Method Details
#klass ⇒ Object
112 113 114 |
# File 'lib/greedo/grid_helper.rb', line 112 def klass label.parameterize.underscore end |
#order_asc_class ⇒ Object
148 149 150 151 152 153 154 |
# File 'lib/greedo/grid_helper.rb', line 148 def order_asc_class if ordered_by? && order == "asc" "glyphicon-triangle-top" else "glyphicon-chevron-up" end end |
#order_asc_path ⇒ Object
132 133 134 135 136 137 138 |
# File 'lib/greedo/grid_helper.rb', line 132 def order_asc_path if ordered_by? && order == "asc" view_context.url_for(params.merge(order: nil, order_by: nil)) else view_context.url_for(params.merge(order: :asc, order_by: name)) end end |
#order_desc_class ⇒ Object
140 141 142 143 144 145 146 |
# File 'lib/greedo/grid_helper.rb', line 140 def order_desc_class if ordered_by? && order == "desc" "glyphicon-triangle-bottom" else "glyphicon-chevron-down" end end |
#order_desc_path ⇒ Object
124 125 126 127 128 129 130 |
# File 'lib/greedo/grid_helper.rb', line 124 def order_desc_path if ordered_by? && order == "desc" view_context.url_for(params.merge(order: nil, order_by: nil)) else view_context.url_for(params.merge(order: :desc, order_by: name)) end end |
#ordered_by? ⇒ Boolean
116 117 118 |
# File 'lib/greedo/grid_helper.rb', line 116 def ordered_by? order_by == name.to_s && %w(asc desc).include?(order) end |
#params ⇒ Object
120 121 122 |
# File 'lib/greedo/grid_helper.rb', line 120 def params view_context.params.merge(path_params) end |
#value(record) ⇒ Object
108 109 110 |
# File 'lib/greedo/grid_helper.rb', line 108 def value(record) renderer.call(record) end |