Class: ActiveAdmin::Views::DropdownMenu
- Defined in:
- lib/active_admin/views/components/dropdown_menu.rb
Overview
Action List - A button with a drop down menu of links
Creating a new action list:
"Administration" do
item "Edit Details", edit_details_path
item "Edit My Account", edit_my_account_path
end
This will create a button with the label “Administration” and a drop down once clicked with 2 options.
Instance Method Summary collapse
-
#build(name, options = {}) ⇒ Object
Build a new action list.
- #item(*args, **kwargs, &block) ⇒ Object
Instance Method Details
#build(name, options = {}) ⇒ Object
Build a new action list
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/active_admin/views/components/dropdown_menu.rb', line 26 def build(name, = {}) = .dup # Easily set options for the button or menu = .delete(:button) || {} = .delete(:menu) || {} @button = (name, ) @menu = () super() end |
#item(*args, **kwargs, &block) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/active_admin/views/components/dropdown_menu.rb', line 39 def item(*args, **kwargs, &block) within @menu do if block_given? li &block else li link_to(*args, **kwargs) end end end |