Class: DropdownHelper::DropdownListItem
- Inherits:
-
Object
- Object
- DropdownHelper::DropdownListItem
- Includes:
- ActionView::Helpers, FormatHelper
- Defined in:
- app/helpers/dropdown_helper.rb
Overview
TODO: support split button dropdowns
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #construct ⇒ Object
-
#initialize(options = {}) ⇒ DropdownListItem
constructor
A new instance of DropdownListItem.
- #parse_type(options = {}) ⇒ Object
Methods included from FormatHelper
Constructor Details
#initialize(options = {}) ⇒ DropdownListItem
Returns a new instance of DropdownListItem.
10 11 12 |
# File 'app/helpers/dropdown_helper.rb', line 10 def initialize(={}) = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'app/helpers/dropdown_helper.rb', line 8 def end |
Instance Method Details
#construct ⇒ Object
14 15 16 |
# File 'app/helpers/dropdown_helper.rb', line 14 def construct content_tag :li, parse_type(), end |
#parse_type(options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/helpers/dropdown_helper.rb', line 18 def parse_type(={}) case [:type].try(:to_sym) when :link return link_to([:text], [:link], role: :menuitem, tabindex: -1) when :header prepend_class(, 'dropdown-header') return [:text] when :divider prepend_class(, 'divider') [:role] = 'separator' else end end |