Module: Card::Set::All::Bootstrap::Dropdown::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod021-card-mod-bootstrap/all/bootstrap/dropdown.rb,
card/tmpsets/set/mod022-card-mod-bootstrap/all/bootstrap/dropdown.rb

Instance Method Summary collapse

Instance Method Details



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'card/tmpsets/set/mod021-card-mod-bootstrap/all/bootstrap/dropdown.rb', line 9

def dropdown_button name, items_or_opts={}, opts={}
  items = block_given? ? yield : items_or_opts
  opts = items_or_opts if block_given?
  <<-HTML
    <div class="btn-group #{opts[:extra_css_class]}" role="group">
      <button class="btn btn-primary dropdown-toggle"
              data-toggle="dropdown" title="#{name}" aria-expanded="false"
              aria-haspopup="true">
        #{icon_tag opts[:icon] if opts[:icon]} #{name}
        <span class="caret"></span>
      </button>
      #{dropdown_list items, opts[:class], opts[:active]}
    </div>
  HTML
end

#split_button(main_button, active_item) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'card/tmpsets/set/mod021-card-mod-bootstrap/all/bootstrap/dropdown.rb', line 25

def split_button main_button, active_item
  wrap_with :div, class: "btn-group" do
    [
      main_button,
      split_button_toggle,
      dropdown_list(yield, "dropdown-menu-right", active_item)
    ]
  end
end