Module: Leather::LeatherHelpers
- Defined in:
- lib/leather/leather_helpers.rb
Instance Method Summary collapse
- #active_class(href, options) ⇒ Object
- #dropdown_nav_item(text, href, options = {}, &block) ⇒ Object
- #modal(id = 'modal', html_options = {}, &block) ⇒ Object
- #modal_body(&block) ⇒ Object
- #modal_footer(&block) ⇒ Object
- #modal_header(title = '', &block) ⇒ Object
- #modal_toggle(text, id = 'modal', html_options = {}) ⇒ Object
- #nav_item(text, href, options = {}) ⇒ Object
- #nav_list(html_options = {}, &block) ⇒ Object
- #navbar(title, brand_link, html_options = {}, &block) ⇒ Object
- #navbar_in_container(html_options = {}, &block) ⇒ Object
- #navbar_with_container(html_options = {}, &block) ⇒ Object
Instance Method Details
#active_class(href, options) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/leather/leather_helpers.rb', line 3 def active_class(href, ) if ([:nav_id].present? && current_tab?([:nav_id][0], [:nav_id][1])) || current_page?(href) 'active' else '' end end |
#dropdown_nav_item(text, href, options = {}, &block) ⇒ Object
54 55 56 |
# File 'lib/leather/leather_helpers.rb', line 54 def dropdown_nav_item(text, href, = {}, &block) render partial: 'leather/bootstrap_components/dropdown_nav_item', locals: { block: capture(&block), text: text, href: href, options: } end |
#modal(id = 'modal', html_options = {}, &block) ⇒ Object
15 16 17 |
# File 'lib/leather/leather_helpers.rb', line 15 def modal(id = 'modal', = {}, &block) render partial: 'leather/bootstrap_components/modal', locals: { id: id, block: capture(&block), html_options: } end |
#modal_body(&block) ⇒ Object
23 24 25 |
# File 'lib/leather/leather_helpers.rb', line 23 def modal_body(&block) render partial: 'leather/bootstrap_components/modal_body', locals: { block: capture(&block) } end |
#modal_footer(&block) ⇒ Object
27 28 29 |
# File 'lib/leather/leather_helpers.rb', line 27 def (&block) render partial: 'leather/bootstrap_components/modal_footer', locals: { block: capture(&block) } end |
#modal_header(title = '', &block) ⇒ Object
19 20 21 |
# File 'lib/leather/leather_helpers.rb', line 19 def modal_header(title = '', &block) render partial: 'leather/bootstrap_components/modal_header', locals: { title: title } end |
#modal_toggle(text, id = 'modal', html_options = {}) ⇒ Object
11 12 13 |
# File 'lib/leather/leather_helpers.rb', line 11 def modal_toggle(text, id = 'modal', = {}) link_to text, "##{id}", data: { toggle: "modal" }, class: [:class] end |
#nav_item(text, href, options = {}) ⇒ Object
50 51 52 |
# File 'lib/leather/leather_helpers.rb', line 50 def nav_item(text, href, = {}) render partial: 'leather/bootstrap_components/nav_item', locals: { text: text, href: href, options: } end |
#nav_list(html_options = {}, &block) ⇒ Object
46 47 48 |
# File 'lib/leather/leather_helpers.rb', line 46 def nav_list( = {}, &block) render partial: 'leather/bootstrap_components/nav_list', locals: { block: capture(&block), html_options: } end |
#navbar(title, brand_link, html_options = {}, &block) ⇒ Object
31 32 33 34 |
# File 'lib/leather/leather_helpers.rb', line 31 def (title, brand_link, = {}, &block) = { class: "navbar-default" }.merge() render partial: 'leather/bootstrap_components/navbar', locals: { title: title, brand_link: brand_link, block: capture(&block), html_options: } end |
#navbar_in_container(html_options = {}, &block) ⇒ Object
41 42 43 44 |
# File 'lib/leather/leather_helpers.rb', line 41 def ( = {}, &block) [:container_mode] = :in (, &block) end |
#navbar_with_container(html_options = {}, &block) ⇒ Object
36 37 38 39 |
# File 'lib/leather/leather_helpers.rb', line 36 def ( = {}, &block) [:container_mode] = :with (, &block) end |