Class: Grapple::Components::Actions

Inherits:
HtmlComponent show all
Defined in:
lib/grapple/components/actions.rb

Instance Attribute Summary

Attributes inherited from BaseComponent

#builder, #columns, #params, #records, #template

Instance Method Summary collapse

Methods inherited from BaseComponent

#initialize, setting

Constructor Details

This class inherits a constructor from Grapple::Components::BaseComponent

Instance Method Details

#render(actions = [], &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/grapple/components/actions.rb', line 7

def render(actions = [], &block)
  html = capture_block(&block)
  actions.each do |action|
    if action.kind_of?(String)
      html << action
    else
      # TODO: why are we deleting the label and url?

      label = action.delete(:label)
      url = action.delete(:url)
      html << template.send(link_to_helper, label, url, action)
    end
  end      
  (:div, html.html_safe, :class => 'actions')
end