Project

fume-nav

0.0
No commit activity in last 3 years
No release in over 3 years
help build navigation for rails.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.7
~> 12.0
~> 3.6.0

Runtime

>= 0
 Project Readme

Fume::Nav

Build Status

help build navigation for rails.

Installation

Add this line to your application's Gemfile:

gem 'fume-nav'

Usage

example

view.erb

<% @current = :edit %>
<%= fume_nav @current do |n| %>
<ul>
  <%= n.li_tag :show do %>
    <%= link_to 'show', link_path(@link) %>
  <% end %>
  <%= n.li_tag :edit do %>
    <%= link_to 'edit', edit_link_path(@link) %>
  <% end %>
</ul>
<% end %>

<%= fume_nav @current do |n| %>
  <div class="dropdown">
    <%= n.link_to :show, "link_1", root_path, class: "link" %>
    <%= n.apply_content :edit do |active_class| %>
      <%= link_to "link_2", root_path, class: "link #{active_class || 'default'}" %>
    <% end %>
  </div>
<% end %>

<%= fume_nav @current, active_class: "text-primary", inactive_class: "text-muted" do |n| %>
  <div>
    <%= n.link_to :show, "link_1", root_path %>
    <%= n.link_to :edit, "link_2", root_path %>
  </div>
<% end %>

output:

<ul>
  <li>
    <a href="/links/1">show</a>
  </li>
  <li class="active">
    <a href="/links/1/edit">edit</a>
  </li>
</ul>

<div class="dropdown">
  <a class="link active" href="/">link_1</a>
  <a class="link " href="/">link_2</a>
</div>

<div>
  <a class="text-primary" href="/">link_1</a>
  <a class="text-muted" href="/">link_2</a>
</div>

Options

<%= fume_nav(current_value, options) do |n| %>
  // OOXX
<% end %>

OPTIONS:

active_class the current active item class, default: 'active'
hide_if_empty don't output content html if not exist any subitem, default: true

Contributing

  1. Fork it ( https://github.com/sunteya/fume-nav/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request