Skip to content

Commit

Permalink
wrap class option into html
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrunberg committed May 11, 2021
1 parent 43f9dde commit 8f8fb7f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion generators/navigation_config/templates/config/navigation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
# url - the address that the generated item links to. You can also use url_helpers (named routes, restful routes helper, url_for etc.)
# options - can be used to specify attributes that will be included in the rendered navigation item (e.g. id, class etc.)
# some special options that can be set:
# :html - Specifies html attributes that will be included in the rendered navigation item
# :if - Specifies a proc to call to determine if the item should
# be rendered (e.g. <tt>if: -> { current_user.admin? }</tt>). The
# proc should evaluate to a true or false value and is evaluated in the context of the view.
Expand All @@ -67,7 +68,7 @@
# You can also specify a condition-proc that needs to be fullfilled to display an item.
# Conditions are part of the options. They are evaluated in the context of the views,
# thus you can use all the methods and vars you have available in the views.
primary.item :key_3, 'Admin', url, class: 'special', if: -> { current_user.admin? }
primary.item :key_3, 'Admin', url, html: { class: 'special' }, if: -> { current_user.admin? }
primary.item :key_4, 'Account', url, unless: -> { logged_in? }

# you can also specify html attributes to attach to this particular level
Expand Down

0 comments on commit 8f8fb7f

Please sign in to comment.