Module: Card::Set::All::Bootstrap::Dropdown::HtmlFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/dropdown.rb
Instance Method Summary collapse
-
#dropdown_button(name, opts = {}) ⇒ Object
Both #dropdown_button and #split_dropdown_button are called with blocks that yield and array of dropdown items.
-
#dropdown_header(text) ⇒ Object
-
#split_dropdown_button(main_button) ⇒ Object
-
#split_dropdown_button_toggle(div_attributes = {}) ⇒ Object
Instance Method Details
#dropdown_button(name, opts = {}) ⇒ Object
Both #dropdown_button and #split_dropdown_button are called with blocks that yield and array of dropdown items.
If the item is a string, the only thing added is an li tag.
If the item is an Array, it is treated as a list of arguments to #link_to_card, and the “dropdown-item” class is added to each link
17 18 19 |
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/dropdown.rb', line 17 def name, opts={} haml :dropdown_button, name: name, items: yield, opts: opts end |
#dropdown_header(text) ⇒ Object
31 32 33 |
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/dropdown.rb', line 31 def dropdown_header text content_tag(:h6, text, class: "dropdown-header") end |
#split_dropdown_button(main_button) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/dropdown.rb', line 21 def wrap_with :div, class: "btn-group" do [ , , dropdown_list(yield, "dropdown-menu-right") ] end end |
#split_dropdown_button_toggle(div_attributes = {}) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/dropdown.rb', line 35 def div_attributes={} wrap_with :a, div_attributes.reverse_merge( href: "#", class: "dropdown-toggle #{classy 'dropdown-toggle-split'}", "data-bs-toggle" => "dropdown", "aria-haspopup" => "true", "aria-expanded" => "false" ) do '<span class="sr-only">Toggle Dropdown</span>' end end |