checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e2665eaf75f46232781f58bdcfcb1833d4b30aa5
4
+ data.tar.gz: b04f39dfb72161eb44096f329ca3a382377d65f2
5
+ SHA512:
6
+ metadata.gz: c8735a175bb70b76952164279055c56dfc14cec31bf4063c42793d18657f5deeb8e73542e75c3ae92a06ea2d99a93194c0d9a88c6a621dd4a1c08132db74be10
7
+ data.tar.gz: c7855e40ff01e346bd25e011e1c0497d9a0959917e28dc483a5b7220371fe8dd1a66846050a2d37c89f22cfaf0457f682e26f9d322018ec86077ab832e069925
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ # CHANGELOG
2
+ ## [0.1.1](https://github.com/yasaichi/actionview-consistent_fallback/releases/tag/v0.1.1) (September 2, 2017)
3
+ * Minor fixes not related to the gem code
4
+
5
+ ## [0.1.0](https://github.com/yasaichi/actionview-consistent_fallback/releases/tag/v0.1.0) (September 2, 2017)
6
+ * The initial release
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2017 Yuichi Goto
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # actionview-consistent\_fallback
2
+ [![Gem Version](https://badge.fury.io/rb/actionview-consistent_fallback.svg)](http://badge.fury.io/rb/actionview-consistent_fallback)
3
+ [![Build Status](https://travis-ci.org/yasaichi/actionview-consistent_fallback.svg?branch=master)](https://travis-ci.org/yasaichi/actionview-consistent_fallback)
4
+ [![Code Climate](https://codeclimate.com/github/yasaichi/actionview-consistent_fallback/badges/gpa.svg)](https://codeclimate.com/github/yasaichi/actionview-consistent_fallback)
5
+ [![Test Coverage](https://codeclimate.com/github/yasaichi/actionview-consistent_fallback/badges/coverage.svg)](https://codeclimate.com/github/yasaichi/actionview-consistent_fallback/coverage)
6
+
7
+ This Action View plugin allows you to fallback to the default layout and partials when there is no variant template corresponding to each request variant.
8
+
9
+ ## Installation
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'actionview-consistent_fallback'
14
+ ```
15
+
16
+ And then execute:
17
+ ```bash
18
+ $ bundle
19
+ ```
20
+
21
+ Or install it yourself as:
22
+ ```bash
23
+ $ gem install actionview-consistent_fallback
24
+ ```
25
+
26
+ ## Usage
27
+ TODO: Write how to use the plugin
28
+
29
+ ## Contributing
30
+ You should follow the steps below.
31
+
32
+ 1. [Fork the repository](https://help.github.com/articles/fork-a-repo/)
33
+ 2. Create a feature branch: `git checkout -b add-new-feature`
34
+ 3. Commit your changes: `git commit -am 'Add new feature'`
35
+ 4. Push the branch: `git push origin add-new-feature`
36
+ 4. [Send us a pull request](https://help.github.com/articles/about-pull-requests/)
37
+
38
+ ## License
39
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require "bundler/setup"
5
+ rescue LoadError
6
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
7
+ end
8
+
9
+ require "rdoc/task"
10
+
11
+ RDoc::Task.new(:rdoc) do |rdoc|
12
+ rdoc.rdoc_dir = "rdoc"
13
+ rdoc.title = "ActionView::ConsistentFallback"
14
+ rdoc.options << "--line-numbers"
15
+ rdoc.rdoc_files.include("README.md")
16
+ rdoc.rdoc_files.include("lib/**/*.rb")
17
+ end
18
+
19
+ require "rspec/core/rake_task"
20
+ RSpec::Core::RakeTask.new(:spec)
21
+ task default: :spec
22
+
23
+ require "bundler/gem_tasks"
data/lib/actionview/consistent_fallback.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "actionview/consistent_fallback/version"
4
+
5
+ if defined?(Rails)
6
+ require "actionview/consistent_fallback/railtie"
7
+ else
8
+ require "actionview/consistent_fallback/template_rendering"
9
+ end
data/lib/actionview/consistent_fallback/railtie.rb ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/lazy_load_hooks"
4
+ require "rails/railtie"
5
+
6
+ module ActionView
7
+ module ConsistentFallback
8
+ class Railtie < ::Rails::Railtie
9
+ initializer "action_view.consistent_fallback" do
10
+ ::ActiveSupport.on_load(:action_view) do
11
+ require "actionview/consistent_fallback/template_rendering"
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
data/lib/actionview/consistent_fallback/template_rendering.rb ADDED
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "action_view"
4
+
5
+ module ActionView
6
+ module ConsistentFallback
7
+ module TemplateRendering
8
+ def render_template(template, layout_name = nil, locals = nil)
9
+ if template.variants == [nil] && !@lookup_context.variants.empty?
10
+ @lookup_context.variants = []
11
+ end
12
+
13
+ super
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ ActionView::TemplateRenderer.prepend(ActionView::ConsistentFallback::TemplateRendering)
data/lib/actionview/consistent_fallback/version.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionView
4
+ module ConsistentFallback
5
+ VERSION = "0.1.1".freeze
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,157 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: actionview-consistent_fallback
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Yuichi Goto
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-09-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: actionview
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.1.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '6'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 4.1.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '6'
33
+ - !ruby/object:Gem::Dependency
34
+ name: appraisal
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: railties
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: reek
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec-rails
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: simplecov
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ description: This Action View plugin allows you to fallback to the default layout
118
+ and partials when there is no variant template corresponding to each request variant.
119
+ email:
120
+ - yasaichi@users.noreply.github.com
121
+ executables: []
122
+ extensions: []
123
+ extra_rdoc_files: []
124
+ files:
125
+ - CHANGELOG.md
126
+ - MIT-LICENSE
127
+ - README.md
128
+ - Rakefile
129
+ - lib/actionview/consistent_fallback.rb
130
+ - lib/actionview/consistent_fallback/railtie.rb
131
+ - lib/actionview/consistent_fallback/template_rendering.rb
132
+ - lib/actionview/consistent_fallback/version.rb
133
+ homepage: https://github.com/yasaichi/actionview-consistent_fallback
134
+ licenses:
135
+ - MIT
136
+ metadata: {}
137
+ post_install_message:
138
+ rdoc_options: []
139
+ require_paths:
140
+ - lib
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ required_rubygems_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ requirements: []
152
+ rubyforge_project:
153
+ rubygems_version: 2.6.11
154
+ signing_key:
155
+ specification_version: 4
156
+ summary: Consistent fallback to the default layout and partials for Action View
157
+ test_files: []