Module: LinkHelper
- Includes:
- FormatHelper
- Defined in:
- app/helpers/link_helper.rb
Instance Method Summary collapse
- #navbar_brand(name = nil, options = nil, html_options = nil, &block) ⇒ Object
- #navbar_link(name = nil, options = nil, html_options = nil, &block) ⇒ Object
- #navbar_link_to(name = nil, options = nil, html_options = nil, &block) ⇒ Object
Methods included from FormatHelper
#prepend_class, #squeeze_n_strip
Instance Method Details
#navbar_brand(name = nil, options = nil, html_options = nil, &block) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/helpers/link_helper.rb', line 38 def (name = nil, = nil, = nil, &block) , , name = , name, block if block_given? ||= {} ||= {} prepend_class(, 'navbar-brand') if block_given? link_to , do yield name end else link_to name, , end end |
#navbar_link(name = nil, options = nil, html_options = nil, &block) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/helpers/link_helper.rb', line 18 def (name = nil, = nil, = nil, &block) , , name = , name, block if block_given? ||= {} ||= {} prepend_class(, 'navbar-link') active = 'active' if .delete(:active) content_tag :li, class: active do if block_given? link_to , do yield name end else link_to name, , end end end |
#navbar_link_to(name = nil, options = nil, html_options = nil, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/helpers/link_helper.rb', line 4 def (name = nil, = nil, = nil, &block) , , name = , name, block if block_given? ||= {} ||= {} prepend_class(, 'navbar-link') return link_to(name, , ) unless block_given? link_to , do yield name end end |