{"id":21519369,"url":"https://github.com/alexwayfer/flame-menu","last_synced_at":"2025-03-17T16:49:50.193Z","repository":{"id":39657971,"uuid":"300978369","full_name":"AlexWayfer/flame-menu","owner":"AlexWayfer","description":"Menu for Flame application","archived":false,"fork":false,"pushed_at":"2024-04-08T09:25:02.000Z","size":51,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-08T10:41:13.372Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/AlexWayfer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-03T20:57:58.000Z","updated_at":"2024-05-27T12:10:34.310Z","dependencies_parsed_at":"2023-02-13T22:31:25.667Z","dependency_job_id":"92e051df-2890-4c49-9457-51eefe514bf6","html_url":"https://github.com/AlexWayfer/flame-menu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexWayfer%2Fflame-menu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexWayfer%2Fflame-menu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexWayfer%2Fflame-menu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexWayfer%2Fflame-menu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexWayfer","download_url":"https://codeload.github.com/AlexWayfer/flame-menu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244074436,"owners_count":20393965,"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","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":[],"created_at":"2024-11-24T00:57:35.508Z","updated_at":"2025-03-17T16:49:50.175Z","avatar_url":"https://github.com/AlexWayfer.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flame Menu\n\n[![Cirrus CI - Base Branch Build Status](https://img.shields.io/cirrus/github/AlexWayfer/flame-menu?style=flat-square)](https://cirrus-ci.com/github/AlexWayfer/flame-menu)\n[![Codecov branch](https://img.shields.io/codecov/c/github/AlexWayfer/flame-menu/main.svg?style=flat-square)](https://codecov.io/gh/AlexWayfer/flame-menu)\n[![Code Climate](https://img.shields.io/codeclimate/maintainability/AlexWayfer/flame-menu.svg?style=flat-square)](https://codeclimate.com/github/AlexWayfer/flame-menu)\n[![Inline docs](https://inch-ci.org/github/AlexWayfer/flame-menu.svg?branch=main)](https://inch-ci.org/github/AlexWayfer/flame-menu)\n[![License](https://img.shields.io/github/license/AlexWayfer/flame-menu.svg?style=flat-square)](LICENSE.txt)\n[![Gem](https://img.shields.io/gem/v/flame-menu.svg?style=flat-square)](https://rubygems.org/gems/flame-menu)\n\nNavigation menu for Flame applications.\n\nThere are helper methods (like `@menu.current`),\nbut you have to write an HTML layout by yourself (as you want to).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'flame-menu'\n```\n\nAnd then execute:\n\n```shell\nbundle install\n```\n\nOr install it yourself as:\n\n```shell\ngem install flame-menu\n```\n\n## Usage\n\n```ruby\n# controllers/site/_controller.rb\n\nmodule MyApplication\n  module Site\n    class Controller \u003c MyApplication::Controller\n      include Flame::Menu\n\n      ## Automatic look-up for controllers like `Site::AboutController`\n      MENU_ITEMS = %i[\n        index\n        about\n        faq\n      ].freeze\n\n      protected\n\n      ## Must be defined, but can be simply `true` for public access\n      def available?(controller = self.class)\n        ## Example:\n\n        # return false unless authenticated_account\n        # return true if controller::PERMISSION.nil?\n        #\n        # authenticated_account.split(',').include? controller::PERMISSION.to_s\n      end\n    end\n  end\nend\n```\n\n```erb\n\u003c% if @menu %\u003e\n  \u003cnav\u003e\n    \u003c%\n      @menu.current.ancestors.reverse.each do |parent|\n        items = parent.available\n        next if items.size \u003c 2\n    %\u003e\n      \u003c% items.each do |item| %\u003e\n        \u003ca\n          href=\"\u003c%= path_to item.controller %\u003e\"\n          class=\"\u003c%= 'selected' if item.current? %\u003e\"\n        \u003e\u003c%=\n          t.site.header.nav[parent.key][item.key]\n        %\u003e\u003c/a\u003e\n      \u003c% end %\u003e\n    \u003c% end %\u003e\n  \u003c/nav\u003e\n\u003c% end %\u003e\n```\n\n## Development\n\nAfter checking out the repo, run `bundle install` to install dependencies.\n\nThen, run `toys rspec` to run the tests.\n\nTo install this gem onto your local machine, run `toys gem install`.\n\nTo release a new version, run `toys gem release %version%`.\nSee how it works [here](https://github.com/AlexWayfer/gem_toys#release).\n\n## Contributing\n\nBug reports and pull requests are welcome on [GitHub](https://github.com/AlexWayfer/flame-menu).\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexwayfer%2Fflame-menu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexwayfer%2Fflame-menu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexwayfer%2Fflame-menu/lists"}