Class: Grapple::Components::Actions
- Inherits:
-
HtmlComponent
- Object
- BaseComponent
- HtmlComponent
- Grapple::Components::Actions
- Defined in:
- lib/grapple/components/actions.rb
Overview
Render links that apply to the table
Instance Attribute Summary
Attributes inherited from BaseComponent
#builder, #columns, #params, #records, #template
Instance Method Summary collapse
Methods inherited from BaseComponent
Constructor Details
This class inherits a constructor from Grapple::Components::BaseComponent
Instance Method Details
#render(actions = [], &block) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/grapple/components/actions.rb', line 24 def render(actions = [], &block) html = capture_block(&block) actions.each do |action| if action.kind_of?(String) html << action else label = t(action[:label]) url = action[:url] html_attr = action.dup html_attr.delete(:label) html_attr.delete(:url) html << template.send(link_to_helper, label, url, html_attr) end end content_tag(:div, html.html_safe, class: 'actions') end |