README.md in navigator-1.4.0 vs README.md in navigator-2.0.0
- old
+ new
@@ -36,11 +36,12 @@
<!-- Tocer[finish]: Auto-generated, don't remove. -->
# Features
- Provides a DSL for building navigation menus.
-- Supports auto-detection/highlighting of active menu items based on current path (customizable for non-path usage too).
+- Supports auto-detection/highlighting of active menu items based on current path (customizable for
+ non-path usage too).
- Supports sub-menus, nested tags, HTML attributes, etc.
- Supports the following HTML tags:
- div
- section
- header
@@ -62,26 +63,28 @@
- label
- select
- option
- input
- button
-- Provides `link`, `image`, and `item` convenience methods for succinct ways to build commonly used menu elements.
+- Provides `link`, `image`, and `item` convenience methods for succinct ways to build commonly used
+ menu elements.
# Requirements
-0. [MRI 2.x.x](https://www.ruby-lang.org).
-0. [Ruby on Rails 4.1.x](http://rubyonrails.org).
+0. [Ruby 2.x.x](https://www.ruby-lang.org).
+0. [Ruby on Rails 5.x.x](http://rubyonrails.org).
# Setup
For a secure install, type the following from the command line (recommended):
- gem cert --add <(curl -Ls https://www.alchemists.io/gem-public.pem)
+ gem cert --add <(curl --location --silent https://www.alchemists.io/gem-public.pem)
gem install navigator --trust-policy MediumSecurity
-NOTE: A HighSecurity trust policy would be best but MediumSecurity enables signed gem verification while
-allowing the installation of unsigned dependencies since they are beyond the scope of this gem.
+NOTE: A HighSecurity trust policy would be best but MediumSecurity enables signed gem verification
+while allowing the installation of unsigned dependencies since they are beyond the scope of this
+gem.
For an insecure install, type the following (not recommended):
gem install navigator
@@ -137,11 +140,12 @@
<ul>
<li data-id="1" data-type="public"><a href="/home">Home</a></li>
</ul>
-*TIP: Nested data-- attributes can be applied to any menu item in the same manner as Rails view helpers.*
+*TIP: Nested data-- attributes can be applied to any menu item in the same manner as Rails view
+helpers.*
## Nav (with links)
Code:
@@ -244,12 +248,12 @@
</li>
</ul>
## 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:
+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:
navigation "nav", activator: activator do
a "Home", attributes: {href: home_path}
@@ -285,11 +289,12 @@
navigation "nav", activator: activator do
item "Home", "/dashboard"
end
-These are just a few, simple, examples of what can be achieved. See the specs for additional usage and customization.
+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. Example:
@@ -305,25 +310,28 @@
<nav>
<a href="/home" class="active">Home</a>
<a href="/about" class="active">About</a>
</nav>
-This is the default behavior for all navigation menus and is how menu items automaticaly get the "active" class when the
-item URL (in this case "/home") matches the `request.env[“PATH_INFO"]` to indicate current page/active tab.
+This is the default behavior for all navigation menus and is how menu items automaticaly 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:
- search_key = Optional. The HTML tag attribute to search for. Default: :href.
-- search_value = Required. The value to match against the search_key value in order to update the value of the
- target_key. Default: nil.
-- target_key = Optional. The HTML tag attribute key value to update when the search_value and search_key value match.
- Default: :class.
-- target_value = Optional. The value to be applied to the target_key value. If no value exists, then the value is added.
- Otherwise, if a value exists then the value is appended to the existing value. Default: "active".
+- search_value = Required. The value to match against the search_key value in order to update the
+ value of the target_key. Default: nil.
+- target_key = Optional. The HTML tag attribute key value to update when the search_value and
+ search_key value match. Default: :class.
+- target_value = Optional. The value to be applied to the target_key value. If no value exists, then
+ the value is added. Otherwise, if a value exists then the value is appended to the existing value.
+ Default: "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 as follows:
+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 as follows:
# Code
activator = Navigator::TagActivator.new search_key: "data-id",
search_value: "123",
target_key: "data-style"
@@ -338,12 +346,12 @@
<nav>
<a href="/home" data-id="123" data-style="info current">Home</a>
<a href="/about" data-id="789">About</a>
</nav>
-Lastly, the search value can be a *regular expression* to make things easier when dealing with complicated routes, sub-
-menus, etc. Example:
+Lastly, the search value can be a *regular expression* to make things easier when dealing with
+complicated routes, sub- menus, etc. Example:
# Code
profile_activator = Navigator::TagActivator.new search_value: /^profile.+/
navigation do
@@ -368,12 +376,13 @@
<li><a href="profile/emails">Emails</a></li>
</ul>
</li>
</ul>
-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.
+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.
# Tests
To test, run:
@@ -386,31 +395,32 @@
# Versioning
Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
-- Patch (x.y.Z) - Incremented for small, backwards compatible bug fixes.
-- Minor (x.Y.z) - Incremented for new, backwards compatible public API enhancements and/or bug fixes.
+- Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
+- Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
- Major (X.y.z) - Incremented for any backwards incompatible public API changes.
# Code of Conduct
-Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By participating in this project
-you agree to abide by its terms.
+Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
+participating in this project you agree to abide by its terms.
# Contributions
Read [CONTRIBUTING](CONTRIBUTING.md) for details.
# License
Copyright (c) 2012 [Alchemists](https://www.alchemists.io).
-Read the [LICENSE](LICENSE.md) for details.
+Read [LICENSE](LICENSE.md) for details.
# History
-Read the [CHANGELOG](CHANGELOG.md) for details.
+Read [CHANGES](CHANGES.md) for details.
Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
# Credits
-Developed by [Brooke Kuhlmann](https://www.alchemists.io) at [Alchemists](https://www.alchemists.io).
+Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
+[Alchemists](https://www.alchemists.io).