-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactored _menu and _menu_branch partials. #2068
Conversation
Should |
} -%> | ||
</ul> | ||
</nav> | ||
<%= content_tag(:nav, :id => dom_id, :class => css) do %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems weird to me. content_tag
has always seemed like a one-off to use in helpers or something. I'm not sure I'd find this more readable than just
<nav id=#{dom_id} class=#{css}>
# ...
</nav>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, I just saw that you deleted this in the other PR. Nevermind...
* Using content_tag helpers. * Passing way less data around. * Removed :apply_css option, just pass :css => '' * Removed logic from views by adding to view helpers. * Removed Refinery::Core.hide_menu_children configuration option. * Added MenuItem#ophan? which returns !MenuItem#has_parent? * Removed :hide_children menu option in favour of just using :menu_levels => 0. In effect, they did the same thing.
This has many advantages not least of which is that we can test it without requesting pages. * Using config_accessor and attr_accessor instead of passing options around. * Added leaf? to MenuItem and made use of has_children? in the MenuPresenter * All methods besides initialize and to_html are private to this class. * Moved Refinery::Core#menu_css to the Refinery::Pages::MenuPresenter. * Uses MenuItem#depth instead of scanning ancestors. * Renamed levels to max_depth and added within_max_depth? * Refactored Menu and MenuItem as proper objects, not pretending to be hashes or arrays (ht: @awagener) * Move Menu#initialize logic to Menu#append so that more items can be appended after initialize. * Moved all page presenters and their specs under app/presenters and spec/presenters where they belong.
Replaced menu partials with Refinery::Pages::MenuPresenter.
Refactored _menu and _menu_branch partials.
@parndt Friendly reminder to changelog this! |
Good point; will do! |
I already did ;) |
@ugisozols thanks that didn't show up in my email. |
content_tag
helpers.:apply_css
option, just pass:css => ''
to apply no CSS.MenuItem#orphan?
which returns!MenuItem#has_parent?
:hide_children
menu option because:menu_levels
does the same thing.