alchemy_cms

https://github.com/magiclabs/alchemy_cms

Ruby

AlchemyCMS is a powerful, flexible and user centric Rails 5 CMS. 🧙🏻‍♂️

Alchemy::PagesHelper#render_navigation

Renders the navigation.

It produces a html <ul><li></li></ul> structure with all necessary classes so you can produce every navigation the web uses today.
I.E. dropdown-navigations, simple mainnavigations or even complex nested ones.

=== HTML output:

  <ul class="navigation level_1">
    <li class="first home"><a href="/home" class="active" title="Homepage" lang="en" data-page-id="1">Homepage</a></li>
    <li class="contact"><a href="/contact" title="Contact" lang="en" data-page-id="2">Contact</a></li>
    <li class="last imprint"><a href="/imprint" title="Imprint" lang="en" data-page-id="3">Imprint</a></li>
  </ul>

As you can see: Everything you need.

Not pleased with the way Alchemy produces the navigation structure?

Then feel free to overwrite the partials (_renderer.html.erb and _link.html.erb) found in +views/navigation/+ or pass different partials via the options +:navigation_partial+ and +:navigation_link_partial+.

=== Passing HTML classes and ids to the renderer

A second hash can be passed as html_options to the navigation renderer partial.

==== Example:

  <%= render_navigation({from_page: 'subnavi'}, {class: 'navigation', id: 'subnavigation'}) %>

Source | Google | Stack overflow

Edit

git clone [email protected]:magiclabs/alchemy_cms.git

cd alchemy_cms

open app/helpers/alchemy/pages_helper.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Alchemy--PagesHelper-render_navigation-for-pr


# Commit to git

git add app/helpers/alchemy/pages_helper.rbgit commit -m "better docs for Alchemy::PagesHelper#render_navigation"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Alchemy--PagesHelper-render_navigation-for-pr

hub pull-request


# Celebrate!