Class: TinyAdmin::Views::Components::ActionsButtons

Inherits:
BasicComponent
  • Object
show all
Defined in:
lib/tiny_admin/views/components/actions_buttons.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Attributes

#update_attributes

Instance Attribute Details

#actionsObject

Returns the value of attribute actions.



7
8
9
# File 'lib/tiny_admin/views/components/actions_buttons.rb', line 7

def actions
  @actions
end

#referenceObject

Returns the value of attribute reference.



7
8
9
# File 'lib/tiny_admin/views/components/actions_buttons.rb', line 7

def reference
  @reference
end

#slugObject

Returns the value of attribute slug.



7
8
9
# File 'lib/tiny_admin/views/components/actions_buttons.rb', line 7

def slug
  @slug
end

Instance Method Details

#view_templateObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/tiny_admin/views/components/actions_buttons.rb', line 9

def view_template
  ul(class: "nav justify-content-end") {
    (actions || {}).each do |action, action_class|
      li(class: "nav-item mx-1") {
        href = TinyAdmin.route_for(slug, reference: reference, action: action)
        a(href: href, class: "nav-link btn btn-outline-secondary") {
          action_class.respond_to?(:title) ? action_class.title : action
        }
      }
    end
  }
end