Class: ExpressAdmin::Components::Navigation::CommandButton

Inherits:
ExpressTemplates::Components::Configurable
  • Object
show all
Includes:
ExpressTemplates::Components::Capabilities::Resourceful
Defined in:
app/components/express_admin/command_button.rb

Instance Method Summary collapse

Instance Method Details

#action ⇒ Object



30
31
32
# File 'app/components/express_admin/command_button.rb', line 30

def action
  helpers.send "#{config[:command]}_#{resource_path_helper}", resource.to_param
end

#button_to_options ⇒ Object



26
27
28
# File 'app/components/express_admin/command_button.rb', line 26

def button_to_options
  {remote: true, disabled: config[:disabled], confirm: config[:confirm], form_class: 'js-command-button', data: { command: command_title }}
end

#parent_command_button_list ⇒ Object



34
35
36
37
38
39
40
# File 'app/components/express_admin/command_button.rb', line 34

def parent_command_button_list
  @parent_button_list ||= parent
  until @parent_button_list.nil? || @parent_button_list.kind_of?(CommandButtonList)
    @parent_button_list = @parent_button_list.parent
  end
  return @parent_button_list
end

#resource_name ⇒ Object



22
23
24
# File 'app/components/express_admin/command_button.rb', line 22

def resource_name
  config[:resource_name] || parent_command_button_list.resource_name
end