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

#actionObject



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

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

#button_to_optionsObject



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

def button_to_options
  options = {}
  options = { data: { confirm: config[:confirm] } } if config[:confirm]
  options.merge({ disabled: config[:disabled] })
end

#parent_command_button_listObject



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

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_nameObject



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

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