{"id":14956018,"url":"https://github.com/hardpixel/smart-navigation","last_synced_at":"2025-08-12T00:39:41.165Z","repository":{"id":56896201,"uuid":"111990701","full_name":"hardpixel/smart-navigation","owner":"hardpixel","description":"View helpers for navigation menus.","archived":false,"fork":false,"pushed_at":"2020-03-06T11:37:56.000Z","size":30,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-28T15:54:41.464Z","etag":null,"topics":["actionview","navigation","ruby-gem","ruby-on-rails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hardpixel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-25T09:07:00.000Z","updated_at":"2020-03-06T11:37:54.000Z","dependencies_parsed_at":"2022-08-21T01:50:33.488Z","dependency_job_id":null,"html_url":"https://github.com/hardpixel/smart-navigation","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/hardpixel/smart-navigation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardpixel%2Fsmart-navigation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardpixel%2Fsmart-navigation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardpixel%2Fsmart-navigation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardpixel%2Fsmart-navigation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hardpixel","download_url":"https://codeload.github.com/hardpixel/smart-navigation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardpixel%2Fsmart-navigation/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269981586,"owners_count":24507278,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actionview","navigation","ruby-gem","ruby-on-rails"],"created_at":"2024-09-24T13:12:11.307Z","updated_at":"2025-08-12T00:39:41.113Z","avatar_url":"https://github.com/hardpixel.png","language":"Ruby","readme":"# SmartNavigation\n\nView helpers for navigation menus. Build navigation menus from hash objects.\n\n[![Gem Version](https://badge.fury.io/rb/smart_navigation.svg)](https://badge.fury.io/rb/smart_navigation)\n[![Build Status](https://travis-ci.org/hardpixel/smart-navigation.svg?branch=master)](https://travis-ci.org/hardpixel/smart-navigation)\n[![Maintainability](https://api.codeclimate.com/v1/badges/c484472c3989ff4a7c33/maintainability)](https://codeclimate.com/github/hardpixel/smart-navigation/maintainability)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'smart_navigation'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install smart_navigation\n\n## Usage\n\nDefine the menu items in a hash:\n\n```ruby\n@items = {\n  dashboard: {\n    label:        'Dashboard',\n    url:          :root_path,\n    icon:         'dashboard',\n    root:         true,\n    html:         { target: :_blank },\n    wrapper_html: { class: 'dashboard' }\n  },\n  pages: {\n    label: 'Pages',\n    url:   :admin_pages_path,\n    icon:  'pages',\n    children: {\n      index: {\n        label: 'All Pages',\n        url:   :pages_path\n      },\n      new: {\n        label: 'New Page',\n        url:   :new_page_path\n      }\n    }\n  },\n  system: {\n    label:     'System',\n    separator: true\n  },\n  profile: {\n    label: 'Profile',\n    url:   -\u003e { edit_user_path(current_user) },\n    icon:  'user',\n    if:    :user_signed_in?\n  }\n}\n```\n\nThe `url` key can be a String, a Symbol or a Proc. Keys `if` and `unless` can be a Symbol or a Proc. Symbols and Procs are executed in the view context.\n\nTo render a menu you can use the `navigation_for` or `smart_navigation_for` helper in your views:\n\n```erb\n\u003c%= smart_navigation_for(@items) %\u003e\n```\n\nThere are a number of options you can use to customize the navigation. The default options are:\n\n```ruby\noptions = {\n  menu_class:           'menu',\n  menu_html:            {},\n  menu_icons:           true,\n  item_class:           'menu-item',\n  separator_class:      'separator',\n  submenu_parent_class: 'has-submenu',\n  submenu_class:        'submenu',\n  submenu_item_class:   'submenu-item',\n  active_class:         'active',\n  active_submenu_class: 'open',\n  submenu_icons:        false,\n  submenu_toggle:       nil,\n  icon_prefix:          'icon icon-',\n  icon_default:         'missing',\n  icon_position:        'left',\n  keep_defaults:        true\n}\n\nsmart_navigation_for(@items, options)\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/hardpixel/smart-navigation.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhardpixel%2Fsmart-navigation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhardpixel%2Fsmart-navigation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhardpixel%2Fsmart-navigation/lists"}