Socket
Book a DemoInstallSign in
Socket

fume-nav

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fume-nav

0.1.4
bundlerRubygems
Version published
Maintainers
1
Created
Source

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_classthe current active item class, default: 'active'
hide_if_emptydon't output content html if not exist any subitem, default: true

Contributing

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

FAQs

Package last updated on 30 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.