Module: NdrUi::Bootstrap::DropdownHelper
- Included in:
- NdrUi::BootstrapHelper
- Defined in:
- app/helpers/ndr_ui/bootstrap/dropdown_helper.rb
Overview
This provides bootstrap dropdown helper methods
Instance Method Summary collapse
-
#bootstrap_list_divider_tag(options = {}) ⇒ Object
Creates a Boostrap list divider.
-
#bootstrap_list_header_tag(name, options = {}) ⇒ Object
Creates a Boostrap list header.
-
#bootstrap_list_link_to(*args, &block) ⇒ Object
Creates an html list item containing a link.
Instance Method Details
#bootstrap_list_divider_tag(options = {}) ⇒ Object
Creates a Boostrap list divider.
Signatures
bootstrap_list_divider_tag
Examples
<%= bootstrap_list_divider_tag %>
# => <li class="divider"></li>
59 60 61 62 |
# File 'app/helpers/ndr_ui/bootstrap/dropdown_helper.rb', line 59 def bootstrap_list_divider_tag( = {}) [:class] = ([:class].to_s.split(' ') + ['divider']).join(' ') content_tag(:li, '', { role: 'presentation' }.merge()) end |
#bootstrap_list_header_tag(name, options = {}) ⇒ Object
Creates a Boostrap list header.
Signatures
bootstrap_list_header_tag(name)
Examples
<%= bootstrap_list_header_tag("Apples") %>
# => <li class="dropdown-header">Apples</li>
44 45 46 47 |
# File 'app/helpers/ndr_ui/bootstrap/dropdown_helper.rb', line 44 def bootstrap_list_header_tag(name, = {}) [:class] = ([:class].to_s.split(' ') + ['dropdown-header']).join(' ') content_tag(:li, name, { role: 'presentation' }.merge()) end |
#bootstrap_list_link_to(*args, &block) ⇒ Object
Creates an html list item containing a link. It takes the standard link_to arguments passing them through to a standard link_to call. For bootstrap styling, it simply adds the class “active”, if the link points to the current page that is being viewed. Predominantly used by nav bars and lists.
Signatures
bootstrap_list_link_to(name, = {}, = nil)
bootstrap_list_link_to( = {}, = nil) do
# name
end
See the Rails documentation for details of the options and examples
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/helpers/ndr_ui/bootstrap/dropdown_helper.rb', line 19 def bootstrap_list_link_to(*args, &block) if block_given? return bootstrap_list_link_to(capture(&block), (args.first || {}), args.second) end name = args.first = args.second || {} = args.third = {} [:class] = 'active' if current_page?() content_tag(:li, link_to(name, , ), ) end |