{"id":17826433,"url":"https://github.com/dnamsons/haken","last_synced_at":"2026-01-21T17:35:44.395Z","repository":{"id":143504921,"uuid":"549190135","full_name":"dnamsons/haken","owner":"dnamsons","description":"Load hooks in views","archived":false,"fork":false,"pushed_at":"2023-09-04T08:29:32.000Z","size":4,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-07T20:22:26.162Z","etag":null,"topics":["actionview","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/dnamsons.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-10T20:18:10.000Z","updated_at":"2022-10-11T09:56:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"87bac6f0-d279-407a-8c5c-dc98a6b9f97b","html_url":"https://github.com/dnamsons/haken","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dnamsons/haken","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnamsons%2Fhaken","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnamsons%2Fhaken/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnamsons%2Fhaken/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnamsons%2Fhaken/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnamsons","download_url":"https://codeload.github.com/dnamsons/haken/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnamsons%2Fhaken/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278981521,"owners_count":26079640,"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-10-08T02:00:06.501Z","response_time":56,"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","rails"],"created_at":"2024-10-27T18:47:52.117Z","updated_at":"2025-10-08T17:15:06.423Z","avatar_url":"https://github.com/dnamsons.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Haken\n\nA very simple gem for extending views by injecting additional content.\n\nWhen building applications that use the [bounded context](https://martinfowler.com/bliki/BoundedContext.html) pattern, there can be situations when a context A influences the presentation logic of context B. This library is an experiment of introducing a pseudo PubSub architecture for injecting front-end views to solve these types of problems.\n\n## Installation\n\nAdd this line to your Gemfile and then execute bundle install:\n\n```rb\ngem 'haken'\n```\n\n## Usage\n\nDefine a place where additional content can be injected:\n\n`views/layouts/_navbar.html.erb`\n```erb\n\u003cnav\u003e\n  \u003c%= load_view_hooks_for :navbar %\u003e\n\u003c/nav\u003e\n```\n\nThen you can define a partial elsewhere(for example in a different Rails engine) and inject it into the navbar via an initializer like this:\n```rb\nmodule MyEngine\n  class Engine \u003c Rails::Engine\n    initializer 'my_engine.view_hooks' do\n      Haken.on_load(:navbar) { render 'layouts/my_engine/navbar_extension' }\n    end\n  end\nend\n```\n\n## Roadmap\n\nWe currently only support simple injections without any control over priority (if there are two *subscriptions* for a view hook, the priority they will be rendered in depends on the initialization sequence of the Rails engines they are defined in).\n\nNext step for improving this library is to introduce a priority system.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnamsons%2Fhaken","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnamsons%2Fhaken","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnamsons%2Fhaken/lists"}