Class: Alchemy::Admin::ToolbarButton
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Alchemy::Admin::ToolbarButton
- Defined in:
- app/components/alchemy/admin/toolbar_button.rb
Overview
Renders a toolbar button for the Alchemy toolbar
Example
<%= render Alchemy::Admin::ToolbarButton.new(
url: new_resource_path,
icon: :plus,
label: 'Create Resource',
hotkey: 'alt+n',
dialog_options: {
title: 'Create Resource',
size: "430x400"
},
if_permitted_to: [:create, resource_model]
) %>
Instance Attribute Summary collapse
-
#active ⇒ Object
readonly
Returns the value of attribute active.
-
#dialog ⇒ Object
readonly
Returns the value of attribute dialog.
-
#dialog_options ⇒ Object
readonly
Returns the value of attribute dialog_options.
-
#hotkey ⇒ Object
readonly
Returns the value of attribute hotkey.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#icon_style ⇒ Object
readonly
Returns the value of attribute icon_style.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#if_permitted_to ⇒ Object
readonly
Returns the value of attribute if_permitted_to.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#link_options ⇒ Object
readonly
Returns the value of attribute link_options.
-
#skip_permission_check ⇒ Object
readonly
Returns the value of attribute skip_permission_check.
-
#tooltip_placement ⇒ Object
readonly
Returns the value of attribute tooltip_placement.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url:, icon:, label:, hotkey: nil, title: nil, dialog: true, dialog_options: {}, skip_permission_check: false, if_permitted_to: [], active: false, link_options: {}, id: nil, icon_style: "line", tooltip_placement: "top-start") ⇒ ToolbarButton
constructor
A new instance of ToolbarButton.
Constructor Details
#initialize(url:, icon:, label:, hotkey: nil, title: nil, dialog: true, dialog_options: {}, skip_permission_check: false, if_permitted_to: [], active: false, link_options: {}, id: nil, icon_style: "line", tooltip_placement: "top-start") ⇒ ToolbarButton
Returns a new instance of ToolbarButton.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'app/components/alchemy/admin/toolbar_button.rb', line 68 def initialize( url:, icon:, label:, hotkey: nil, title: nil, dialog: true, dialog_options: {}, skip_permission_check: false, if_permitted_to: [], active: false, link_options: {}, id: nil, icon_style: "line", tooltip_placement: "top-start" ) @url = url @icon = icon @label = label @hotkey = hotkey @dialog = dialog = = @if_permitted_to = if_permitted_to @active = active = @id = id @icon_style = icon_style @tooltip_placement = tooltip_placement end |
Instance Attribute Details
#active ⇒ Object (readonly)
Returns the value of attribute active.
54 55 56 |
# File 'app/components/alchemy/admin/toolbar_button.rb', line 54 def active @active end |
#dialog ⇒ Object (readonly)
Returns the value of attribute dialog.
54 55 56 |
# File 'app/components/alchemy/admin/toolbar_button.rb', line 54 def dialog @dialog end |
#dialog_options ⇒ Object (readonly)
Returns the value of attribute dialog_options.
54 55 56 |
# File 'app/components/alchemy/admin/toolbar_button.rb', line 54 def end |
#hotkey ⇒ Object (readonly)
Returns the value of attribute hotkey.
54 55 56 |
# File 'app/components/alchemy/admin/toolbar_button.rb', line 54 def hotkey @hotkey end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
54 55 56 |
# File 'app/components/alchemy/admin/toolbar_button.rb', line 54 def icon @icon end |
#icon_style ⇒ Object (readonly)
Returns the value of attribute icon_style.
54 55 56 |
# File 'app/components/alchemy/admin/toolbar_button.rb', line 54 def icon_style @icon_style end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
54 55 56 |
# File 'app/components/alchemy/admin/toolbar_button.rb', line 54 def id @id end |
#if_permitted_to ⇒ Object (readonly)
Returns the value of attribute if_permitted_to.
54 55 56 |
# File 'app/components/alchemy/admin/toolbar_button.rb', line 54 def if_permitted_to @if_permitted_to end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
54 55 56 |
# File 'app/components/alchemy/admin/toolbar_button.rb', line 54 def label @label end |
#link_options ⇒ Object (readonly)
Returns the value of attribute link_options.
54 55 56 |
# File 'app/components/alchemy/admin/toolbar_button.rb', line 54 def end |
#skip_permission_check ⇒ Object (readonly)
Returns the value of attribute skip_permission_check.
54 55 56 |
# File 'app/components/alchemy/admin/toolbar_button.rb', line 54 def end |
#tooltip_placement ⇒ Object (readonly)
Returns the value of attribute tooltip_placement.
54 55 56 |
# File 'app/components/alchemy/admin/toolbar_button.rb', line 54 def tooltip_placement @tooltip_placement end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
54 55 56 |
# File 'app/components/alchemy/admin/toolbar_button.rb', line 54 def url @url end |