Skip to content
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

Merged
merged 3 commits into from
Dec 18, 2012
Merged

Conversation

parndt
Copy link
Member

@parndt parndt commented Dec 7, 2012

  • Using content_tag helpers.
  • Passing way less data around.
  • Removed :apply_css option, just pass :css => '' to apply no CSS.
  • Removed logic from views by adding to view helpers.
  • Removed Refinery::Core.hide_menu_children configuration option.
  • Added MenuItem#orphan? which returns !MenuItem#has_parent?
  • Removed :hide_children menu option because :menu_levels does the same thing.

@parndt
Copy link
Member Author

parndt commented Dec 7, 2012

Should :menu_levels be renamed :depth ?

} -%>
</ul>
</nav>
<%= content_tag(:nav, :id => dom_id, :class => css) do %>
Copy link
Contributor

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>

Copy link
Contributor

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...

parndt and others added 3 commits December 18, 2012 16:47
* 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.
robyurkowski added a commit that referenced this pull request Dec 18, 2012
Refactored _menu and _menu_branch partials.
@robyurkowski robyurkowski merged commit 4a69ece into master Dec 18, 2012
@robyurkowski
Copy link
Contributor

@parndt Friendly reminder to changelog this!

ugisozols added a commit that referenced this pull request Dec 18, 2012
@parndt
Copy link
Member Author

parndt commented Dec 18, 2012

Good point; will do!

@ugisozols
Copy link
Member

I already did ;)

@parndt
Copy link
Member Author

parndt commented Dec 18, 2012

@ugisozols thanks that didn't show up in my email.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants