{"id":16737305,"url":"https://github.com/yasaichi/actionview-consistent_fallback","last_synced_at":"2025-04-10T12:42:36.676Z","repository":{"id":40444131,"uuid":"102173586","full_name":"yasaichi/actionview-consistent_fallback","owner":"yasaichi","description":":leftwards_arrow_with_hook: Consistent fallback to the default layout and partials for Action View","archived":false,"fork":false,"pushed_at":"2023-12-15T17:45:09.000Z","size":44,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-24T11:37:47.759Z","etag":null,"topics":["actionpack","variants"],"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/yasaichi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-02T04:55:21.000Z","updated_at":"2023-03-10T09:33:36.000Z","dependencies_parsed_at":"2022-08-30T20:20:58.439Z","dependency_job_id":null,"html_url":"https://github.com/yasaichi/actionview-consistent_fallback","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasaichi%2Factionview-consistent_fallback","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasaichi%2Factionview-consistent_fallback/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasaichi%2Factionview-consistent_fallback/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasaichi%2Factionview-consistent_fallback/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yasaichi","download_url":"https://codeload.github.com/yasaichi/actionview-consistent_fallback/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247809263,"owners_count":20999806,"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":["actionpack","variants"],"created_at":"2024-10-13T00:25:44.512Z","updated_at":"2025-04-10T12:42:36.659Z","avatar_url":"https://github.com/yasaichi.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# actionview-consistent\\_fallback\n[![Gem Version](https://badge.fury.io/rb/actionview-consistent_fallback.svg)](http://badge.fury.io/rb/actionview-consistent_fallback)\n[![Build Status](https://travis-ci.org/yasaichi/actionview-consistent_fallback.svg?branch=master)](https://travis-ci.org/yasaichi/actionview-consistent_fallback)\n[![Code Climate](https://codeclimate.com/github/yasaichi/actionview-consistent_fallback/badges/gpa.svg)](https://codeclimate.com/github/yasaichi/actionview-consistent_fallback)\n[![Test Coverage](https://codeclimate.com/github/yasaichi/actionview-consistent_fallback/badges/coverage.svg)](https://codeclimate.com/github/yasaichi/actionview-consistent_fallback/coverage)\n\n## Motivation\nLet's say you're making your Rails application mobile-friendly with [Action Pack Variants](http://edgeguides.rubyonrails.org/4_1_release_notes.html#action-pack-variants).  \nThe application has the following directory structure:\n\n```\napp/views\n├── layouts\n│   ├── application.html+mobile.erb\n│   └── application.html.erb\n└── projects\n    ├── index.html+mobile.erb\n    ├── index.html.erb\n    └── new.html.erb\n```\n\nIn this case, when you set `request.variant` to `:mobile`, Rails will render templates as follows:\n\n* `projects#index`: `index.html+mobile.erb` with `application.html+mobile.erb`\n* `projects#new`: `new.html.erb` with `application.html+mobile.erb`\n\nThe second behaviour means that you have to prepare mobile versions of every template right away.  \nHowever, you couldn't do that when you have so many templates in your application.\n\n## Solution\nactionview-consistent\\_fallback is a small, but usuful plugin for Action View.  \nThe plugin allows you to fallback to the default layout and partials when there is no variant template corresponding to each request variant.\n\nIn the above case, `new.html.erb` is rendered with `application.html.erb` for `mobile` variant.  \nBy the consistent fallback, you can gradually roll out a mobile-version page.\n\n## Installation\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'actionview-consistent_fallback'\n```\n\nAnd then execute:\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n```bash\n$ gem install actionview-consistent_fallback\n```\n\n## Usage\nAll you need to do is to load the gem, and then create as many variant templates as you can now :)\n\n## Contributing\nYou should follow the steps below.\n\n1. [Fork the repository](https://help.github.com/articles/fork-a-repo/)\n2. Create a feature branch: `git checkout -b add-new-feature`\n3. Commit your changes: `git commit -am 'Add new feature'`\n4. Push the branch: `git push origin add-new-feature`\n4. [Send us a pull request](https://help.github.com/articles/about-pull-requests/)\n\n## License\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasaichi%2Factionview-consistent_fallback","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyasaichi%2Factionview-consistent_fallback","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasaichi%2Factionview-consistent_fallback/lists"}