README.md in navigator-0.9.1 vs README.md in navigator-1.0.0

- old
+ new

@@ -9,29 +9,28 @@ Enhances Rails with a DSL for menu navigation. # Features -* Provides a simple DSL for building navigation menus. -* 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: nav, section, h1-h6, ul, li, a, b, em, s, small, span, strong, sub, and sup. -* Provides an "item" convenience method which combines the "li" and "a" HTML tags into a single method for less typing. +- Provides a simple DSL for building navigation menus. +- 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: nav, section, h1-h6, ul, li, a, b, em, s, small, span, strong, sub, and sup. +- Provides an "item" convenience method which combines the "li" and "a" HTML tags into a single method for less typing. # Requirements 0. Any of the following Ruby VMs: - * [MRI 2.x.x](http://www.ruby-lang.org) - * [JRuby 1.x.x](http://jruby.org) - * [Rubinius 2.x.x](http://rubini.us) + - [MRI 2.x.x](http://www.ruby-lang.org) + - [JRuby 1.x.x](http://jruby.org) 0. [Ruby on Rails 4.1.x](http://rubyonrails.org). # Setup For a secure install, type the following from the command line (recommended): - gem cert --add <(curl -Ls http://www.alchemists.io/gem-public.pem) + gem cert --add <(curl -Ls 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. @@ -65,12 +64,12 @@ ## Unordered List (with attributes) Code: - navigation "ul", class: "nav" do - item "Dashboard", "/dashboard", class: "active" + navigation "ul", attributes: {class: "nav"} do + item "Dashboard", "/dashboard", item_attributes: {class: "active"} item "News", "/posts" end Result: @@ -82,28 +81,28 @@ ## Unordered List (with multiple data attributes) Code: navigation do - item "Home", "/home", data: {id: 1, type: "public"} + item "Home", "/home", item_attributes: {data: {id: 1, type: "public"}} end Result: <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: navigation "nav" do - a "Dashboard", href: "/dashboard" - a "News", href: "/posts" + a "Dashboard", attributes: {href: "/dashboard"} + a "News", attributes: {href: "/posts"} end Result: <nav> @@ -113,31 +112,31 @@ ## Foundation Menu Code: - navigation "nav", class: "top-bar", "data-topbar" => nil do - ul nil, class: "title-area" do - li nil, class: "name" do + 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", href: "/home" + a "Demo", attributes: {href: "/home"} end end end - section nil, class: "top-bar-section" do - ul nil, class: "left" do + section attributes: {class: "top-bar-section"} do + ul attributes: {class: "left"} do item "Home", "/" item "About", "/about" end - ul nil, class: "right" do + ul attributes: {class: "right"} do item "v1.0.0", '#' end - ul nil, class: "right" do - item "Login", "/login", {}, {class: "button tiny round"} + ul attributes: {class: "right"} do + item "Login", "/login", link_attributes: {class: "button tiny round"} end end end Result: @@ -169,15 +168,15 @@ Code: navigation "nav" do item "Dashboard", admin_dashboard_path - li nil, class: "dropdown" do - a "Manage", href: "#", class: "dropdown-toggle", "data-toggle" => "dropdown" do - b nil, class: "caret" + li attributes: {class: "dropdown"} do + a "Manage", attributes: {href: "#", class: "dropdown-toggle", "data-toggle" => "dropdown"} do + b attributes: {class: "caret"} end - ul nil, class: "dropdown-menu" do + ul attributes: {class: "dropdown-menu"} do item "Dashboard", admin_dashboard_path item "Users", admin_users_path end end end @@ -202,13 +201,13 @@ The `navigation` view helper can accept an optional `Navigator::TagActivator` instance. Example: # Code activator = Navigator::TagActivator.new search_value: request.env["PATH_INFO"] - navigation "nav", {}, activator do - a "Home", href: home_path - a "About", href: about_path + navigation "nav", activator: activator do + a "Home", attributes: {href: home_path} + a "About", attributes: {href: about_path} end <!-- Result --> <nav> <a href="/home" class="active">Home</a> @@ -218,17 +217,16 @@ 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 +- 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. +- 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: @@ -236,13 +234,13 @@ activator = Navigator::TagActivator.new search_key: "data-id", search_value: "123", target_key: "data-style" target_value: "current" - navigation "nav", {}, activator do - a "Home", href: home_path, "data-id" => "123", data-style="info" - a "About", href: about_path, "data-id" => "789" + navigation "nav", activator: activator do + a "Home", attributes: {href: home_path, "data-id" => "123", data-style="info"} + a "About", attributes: {href: about_path, "data-id" => "789"} end <!-- Result --> <nav> <a href="/home" data-id="123" data-style="info current">Home</a> @@ -262,24 +260,24 @@ # 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. -* Major (X.y.z) - Incremented for any backwards incompatible public API changes. +- 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. +- Major (X.y.z) - Incremented for any backwards incompatible public API changes. # Contributions Read [CONTRIBUTING](CONTRIBUTING.md) for details. # Credits -Developed by [Brooke Kuhlmann](http://www.alchemists.io) at [Alchemists](http://www.alchemists.io) +Developed by [Brooke Kuhlmann](https://www.alchemists.io) at [Alchemists](https://www.alchemists.io) # License -Copyright (c) 2012 [Alchemists](http://www.alchemists.io). +Copyright (c) 2012 [Alchemists](https://www.alchemists.io). Read the [LICENSE](LICENSE.md) for details. # History Read the [CHANGELOG](CHANGELOG.md) for details.