Class: NfgUi::Components::Elements::DropdownItem
- Inherits:
-
Bootstrap::Components::DropdownItem
- Object
- Bootstrap::Components::Base
- Bootstrap::Components::DropdownItem
- NfgUi::Components::Elements::DropdownItem
- Includes:
- Bootstrap::Utilities::Modalable, Bootstrap::Utilities::Themeable, Traits::Active, Traits::Disable, Traits::DisableWith, Traits::Remote, Traits::Theme, Utilities::Confirmable, Utilities::Describable, Utilities::DisableWithable, Utilities::Iconable, Utilities::Renderable, Utilities::Traitable
- Defined in:
- lib/nfg_ui/components/elements/dropdown_item.rb
Overview
Ino coming soon.
Direct Known Subclasses
Constant Summary
Constants included from Traits::Theme
Traits::Theme::COLOR_TRAITS, Traits::Theme::TRAITS
Constants included from Traits::Disable
Constants included from Traits::DisableWith
Constants included from Traits::Active
Constants included from Traits::Remote
Constants included from Traits
Traits::REGISTERED_TRAITS, Traits::TRAIT_MODULES
Instance Attribute Summary
Attributes included from Bootstrap::Utilities::Disableable
Attributes included from Bootstrap::Utilities::Wrappable
Attributes inherited from Bootstrap::Components::Base
#body, #options, #view_context
Instance Method Summary collapse
-
#href ⇒ Object
Automatically supply an :href to the dropdown item when a modal is present so that the dropdown item presents correctly and appears clickable.
-
#initialize ⇒ DropdownItem
constructor
We do not want to overwrite button_to’s interpretation of ‘method`.
- #render ⇒ Object
Methods included from Traits::Theme
#danger_trait, #dark_trait, #info_trait, #light_trait, #outlined_trait, #primary_trait, #secondary_trait, #success_trait, #warning_trait, #white_trait
Methods included from Traits::Disable
Methods included from Traits::DisableWith
Methods included from Traits::Active
Methods included from Traits::Remote
Methods included from Utilities::Traitable
Methods included from Utilities::Renderable
Methods included from Utilities::Iconable
Methods included from Utilities::DisableWithable
Methods included from Utilities::Describable
Methods included from Utilities::Confirmable
Methods included from Bootstrap::Utilities::Modalable
Methods included from Bootstrap::Utilities::Themeable
Methods inherited from Bootstrap::Components::DropdownItem
Methods included from Bootstrap::Utilities::Tooltipable
#data, #disabled_component_tooltip_wrapper_html_options, #html_options, #tooltip
Methods included from Bootstrap::Utilities::Disableable
Methods included from Bootstrap::Utilities::Activatable
Methods included from Bootstrap::Utilities::Wrappable
Methods inherited from Bootstrap::Components::Base
#component_family, #data, #html_options, #id, #style
Constructor Details
#initialize ⇒ DropdownItem
We do not want to overwrite button_to’s interpretation of ‘method`. Conditionally include Methodable when not using as: :button_to
27 28 29 30 31 32 |
# File 'lib/nfg_ui/components/elements/dropdown_item.rb', line 27 def initialize(*) super if as != :button_to extend NfgUi::Components::Utilities::Methodable end end |
Instance Method Details
#href ⇒ Object
Automatically supply an :href to the dropdown item when a modal is present so that the dropdown item presents correctly and appears clickable
58 59 60 |
# File 'lib/nfg_ui/components/elements/dropdown_item.rb', line 58 def href super || (modal ? '#' : nil) end |
#render ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/nfg_ui/components/elements/dropdown_item.rb', line 34 def render if tooltip && disabled content_tag(:span, ) do content_tag(as, .except(:href)) do yield_icon_or_body end end elsif as == :button_to # Manually pass in url_for args for routing # example: = ui.nfg :dropdown_item, as: :button_to, button_url: some_action_path(@object) url_for_option = .delete(:button_url) view_context.(url_for_option, ) do yield_icon_or_body end else super do yield_icon_or_body end end end |