
Security News
Rspack Introduces Rslint, a TypeScript-First Linter Written in Go
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
= Very light-weight implementation for navigation links
= Simple navigation (HOW-TO)
=== Install
gem install navlinks --source http://gemcutter.org
=== First add navigation areas to the layout
==== app/views/layouts/application.html.erb
<div id="content">
<%= yield %>
</div>
</body>
=== Next, label what views belong to what nav areas
Suppose we have following pages:
Easy! Just assign the nav-areas at the top of the views like this:
==== app/views/pages/home.html.erb <%- self.nav_area = :home -%>
==== app/views/foos/show.html.erb
<%- self.nav_area = :foo -%>
=== Done!
Now when someone is viewing the +pages/home.html.erb+ template, the 'home' anchor tag will have a class +current+. If someone is viewing a +foos/show.html.erb+ template, then the 'foo' anchor tag will have a class +current+. When viewing any other page, however, both of the navigation anchors will not have any classes.
= Localization
+navlinks+ supports common localization but also allows some tricks. Suppose the localization file is as follows:
==== config/locate/en.yml en: navigation: home: Go home home_current: At home
This causes the 'home' area description to be usually 'Go home'. However if the user is looking at a page that belongs to 'home' nav area, it will display 'At home'. Cool, huh?
= Decoration Override
By default the plugin decorates the 'current' area with brackets. It is possible to override this behavior by overriding +decorate_current_label+ method:
==== app/helpers/application_helper.rb
module ApplicationHelper
# causes the current navigation label to be described as:
# * home *
def decorate_current_label( current_label )
"* #{current_label} *"
end
end
Now instead of [ home ] you will see * home *
= Contact
Feel free to contact me with any questions/comments!
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
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
Security News
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.