
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
:toc: macro :toclevels: 5 :figure-caption!:
= Navigator
‼️ This gem is deprecated and will be fully destroyed on 2026-01-15. There is no replacement. Please update accordingly. ‼️
Navigator is a Rails Engine that provides a domain specific language for menu navigation. Great for situations in which you need dynamic, server-side, rendering of site navigation menus complete with active page highlighting. You can also style your navigation menus with plain CSS or any CSS framework of your choice.
toc::[]
== Features
+link+
, +image+
, and +item+
convenience methods for succinct ways to build commonly
used menu elements.== Requirements
. link:https://www.ruby-lang.org[Ruby] . link:https://rubyonrails.org[Ruby on Rails]
== Setup
To install, run:
.... gem install navigator ....
Add the following to your Gemfile:
.... gem "navigator" ....
== Usage
The following are examples using the navigation view helper:
=== Unordered List (simple)
Code:
Result:
=== Unordered List (with attributes)
Code:
Result:
=== Unordered List (with multiple data attributes)
Code:
Result:
TIP: Nested data– attributes can be applied to any menu item in the same manner as Rails view helpers.
=== Nav (with links)
Code:
Result:
=== Foundation Menu
Code:
navigation "nav", attributes: {class: "top-bar", "data-topbar" => nil} do ul attributes: {class: "title-area"} do li attributes: {class: "name"} do h1 do a "Demo", attributes: {href: "/home"} end end end
section attributes: {class: "top-bar-section"} do ul attributes: {class: "left"} do item "Home", "/" item "About", "/about" end
ul attributes: {class: "right"} do
item "v1.0.0", '#'
end
ul attributes: {class: "right"} do
item "Login", "/login", link_attributes: {class: "button tiny round"}
end
Result:
<ul class="right">
<li><a href="#">v1.0.0</a></li>
</ul>
<ul class="right">
<li><a class="button tiny round" href="/login">Login</a></li>
</ul>
=== Bootstrap Dropdown
Code:
Result:
=== Menu Helpers
There are several convenience methods, in addition to the standard HTML tags, that can make for shorter lines of code. The following describes each:
When building links, the default is:
...but can be written as:
When building images, the default is:
..but can be written as:
When building menu items, the default is:
...but can be written as:
These are just a few, simple, examples of what can be achieved. See the specs for additional usage and customization.
=== Customization
The +navigation+
view helper can accept an optional +Navigator::TagActivator+
instance.
Code:
activator = Navigator::TagActivator.new search_value: request.env["PATH_INFO"]
Result:
This is the default behavior for all navigation menus and is how menu items automatically get the
"active
" class when the item URL (in this case "/home
") matches the +request.env[“PATH_INFO"]+
to indicate current page/active tab.
+Navigator::TagActivator+
instances can be configured as follows:
active
".This customization allows for more sophisticated detection/updating of active HTML tags. For
example, the example code (above) could be rewritten to use data
attributes and customized
styles.
Code:
activator = Navigator::TagActivator.new search_key: "data-id", search_value: "123", target_key: "data-style" target_value: "current"
Result:
Lastly, the search value can be a regular expression to make things easier when dealing with complicated routes, sub- menus, etc.
Code:
profile_activator = Navigator::TagActivator.new search_value: /^profile.+/
navigation do item "Dashboard", dashboard_path li activator: profile_activator do link "Profile", '#'
ul do
item "Addresses", profile_addresses_path
item "Emails", profile_emails_path
end
Result:
Assuming either the Addresses
or Emails
menu item was clicked, the Profile
menu item
would be active due to the regular expression (i.e. /^profile.+/) matching one of the the
profile/` paths.
== Development
To contribute, run:
You can also use the IRB console for direct access to all objects:
== Tests
To test, run:
To test the dummy application, run:
== link:https://alchemists.io/policies/license[License]
== link:https://alchemists.io/policies/security[Security]
== link:https://alchemists.io/policies/code_of_conduct[Code of Conduct]
== link:https://alchemists.io/policies/contributions[Contributions]
== link:https://alchemists.io/policies/developer_certificate_of_origin[Developer Certificate of Origin]
== link:https://alchemists.io/projects/navigator/versions[Versions]
== link:https://alchemists.io/community[Community]
== Credits
FAQs
Did you know?
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.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.