Sha256: 1667be642ac2e6afc96e3a5068b2def6960822cb7f47ad7f42dd966f625b03fc

Contents?: true

Size: 886 Bytes

Versions: 1

Compression:

Stored size: 886 Bytes

Contents

module BootstrapIt
  #
  module ViewHelpers
    #
    # Dropdown Menu
    #
    # @author Alexey Ovchinnikov <alexiss@cybernetlab.ru>
    #
    # @see http://getbootstrap.com/components/#dropdowns Bootstrap docs
    class DropdownMenu < WrapIt::Container
      default_tag 'ul'
      html_class 'dropdown-menu'

      child :divider, ListItem,
            tag: 'li', class: 'divider', role: 'presentation'
      child :header, ListItem,
            tag: 'li', class: 'dropdown-header', role: 'presentation'
      child :link_item, ListLinkItem,
            li_role: 'presentation', role: 'menuitem', tabindex: '-1'

      after_initialize do
        @options['role'] = 'menu'
        if @options.delete(:align).to_s.downcase == 'right'
          add_html_class('pull-right')
        end
      end
    end

    register :dropdown_menu, 'BootstrapIt::ViewHelpers::DropdownMenu'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bootstrap_it-0.1.2 lib/bootstrap_it/view_helpers/dropdown_menu.rb