Module: Releaf::Builders::Toolbox

Included in:
ResourceView, TableBuilder
Defined in:
app/builders/releaf/builders/toolbox.rb

Instance Method Summary collapse

Instance Method Details

#toolbox(resource, extra_params = {}) ⇒ Object


2
3
4
5
6
7
8
9
10
# File 'app/builders/releaf/builders/toolbox.rb', line 2

def toolbox(resource, extra_params = {})
  return '' if resource.new_record?

  url = url_for({action: :toolbox, id: resource.id, context: action_name}.merge(extra_params))

  tag(:div, class: "toolbox", data: {url: url}) do
    [toolbox_button, toolbox_menu]
  end
end

#toolbox_buttonObject


18
19
20
21
22
# File 'app/builders/releaf/builders/toolbox.rb', line 18

def toolbox_button
  tag(:button, class: %w(button trigger only-icon), type: "button", title: t("Tools")) do
    icon("ellipsis-v")
  end
end

#toolbox_menuObject


12
13
14
15
16
# File 'app/builders/releaf/builders/toolbox.rb', line 12

def toolbox_menu
  tag(:menu, class: %w(toolbox-items), type: "toolbar") do
    [icon("caret-up"), tag(:ul, "")]
  end
end