Module: Godmin::Helpers::Navigation
- Defined in:
- lib/godmin/helpers/navigation.rb
Instance Method Summary collapse
- #navbar_divider ⇒ Object
- #navbar_dropdown(title) ⇒ Object
- #navbar_item(resource, url = resource, show: nil, icon: nil, **options) ⇒ Object
Instance Method Details
#navbar_divider ⇒ Object
47 48 49 |
# File 'lib/godmin/helpers/navigation.rb', line 47 def content_tag :li, "", class: "divider" end |
#navbar_dropdown(title) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/godmin/helpers/navigation.rb', line 31 def (title) dropdown_toggle = link_to "#", class: "dropdown-toggle", data: { toggle: "dropdown" } do concat "#{title} " concat content_tag :span, "", class: "caret" end = content_tag :ul, class: "dropdown-menu" do yield end content_tag :li, class: "dropdown" do concat dropdown_toggle concat end end |
#navbar_item(resource, url = resource, show: nil, icon: nil, **options) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/godmin/helpers/navigation.rb', line 4 def (resource, url = resource, show: nil, icon: nil, **) show ||= lambda do resource.is_a?(String) ? true : policy(resource).index? end return unless show.call link_text = if block_given? capture do yield end else resource.respond_to?(:model_name) ? resource.model_name.human(count: :many) : resource end content_tag :li do link_to url, do if icon.present? concat content_tag :span, "", class: "glyphicon glyphicon-#{icon}" concat " " end concat link_text end end end |