Class: ActsAsListRenderer
- Inherits:
-
ResourceRenderer::AttributeRenderer::Base
- Object
- ResourceRenderer::AttributeRenderer::Base
- ActsAsListRenderer
- Defined in:
- app/attribute_renderers/acts_as_list_renderer.rb
Instance Attribute Summary
Attributes inherited from ResourceRenderer::AttributeRenderer::Base
Instance Method Summary collapse
Methods inherited from ResourceRenderer::AttributeRenderer::Base
Constructor Details
This class inherits a constructor from ResourceRenderer::AttributeRenderer::Base
Instance Method Details
#display(attribute_name, label, options = {}, &block) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/attribute_renderers/acts_as_list_renderer.rb', line 2 def display(attribute_name, label, = {}, &block) .reverse_merge!(scope: nil) scope = .delete(:scope) scope = "#{scope}_id".intern if scope.is_a?(Symbol) && scope.to_s !~ /_id$/ data_attributes = { 'acts-as-list-item': true, 'acts-as-list-item-uid': model.to_param, 'acts-as-list-item-on-drop-target': h.url_for([:reposition, model]) } data_attributes['acts-as-list-item-scope'] = "#{scope}-#{model.send(scope)}" if scope.present? h.content_tag(:span, data: data_attributes, class: 'btn btn-xs btn-default acts-as-list-item') do h.tag(:span, class: 'glyphicon glyphicon-sort') end end |