multiview 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -1
- data/lib/multiview/manager.rb +1 -2
- data/lib/multiview/version.rb +1 -1
- data/lib/multiview.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e132d129c25fffcfa989a0dba045156cfe3bd6d
|
4
|
+
data.tar.gz: f959713516300b1a16987e233707fadb0bff4c0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a27e21c6b8cba2ebbf3041cb99c2e92aaa56b0f7b24a6086d584172fcd027502e2f6869cb57cec6121be56ae5af4da83fb7f74dd84dcd0df0b34db548818602
|
7
|
+
data.tar.gz: c909c6820c06a9d87dc820d92e8ea872962becb9cd48aa12a966ecd53976ff0d2b3d47ed35586e34fe2cc3d8e74555898d70e0651d53b97bc2c1ebeacc4248e8
|
data/README.md
CHANGED
@@ -74,12 +74,16 @@ class ApplicationController < ActionController::Base
|
|
74
74
|
# $multiview.redispatch(self, params[:controller], params[:action])
|
75
75
|
|
76
76
|
# if exist V3::XxxController, should to call V3::XxxController
|
77
|
-
# if not, should to call XxxController
|
77
|
+
# if not, should to call XxxController and prepend v3 views path
|
78
|
+
# when you just want to change something for views, you should not to redefined a controller for the version
|
78
79
|
# $multiview.redispatch(self, params[:controller], params[:action], 'v3')
|
79
80
|
end
|
80
81
|
end
|
81
82
|
```
|
82
83
|
|
84
|
+
Limitation: We only overwrite those action about already defined.
|
85
|
+
|
86
|
+
|
83
87
|
### Dispatch request by middleware
|
84
88
|
|
85
89
|
```
|
@@ -108,6 +112,11 @@ end
|
|
108
112
|
config.middleware.insert_before Rails.application.routes, MultiviewMiddleware
|
109
113
|
```
|
110
114
|
|
115
|
+
Limitation: Depend Rails.application.routes.recognize_path, if you have some specific routes, might it cannot work.
|
116
|
+
|
117
|
+
Anyway, it soloved that problem of `before_action`
|
118
|
+
|
119
|
+
|
111
120
|
|
112
121
|
## Development
|
113
122
|
|
data/lib/multiview/manager.rb
CHANGED
@@ -5,7 +5,7 @@ module Multiview
|
|
5
5
|
# Params:
|
6
6
|
# config: {controller_path: version
|
7
7
|
def initialize(versions_map)
|
8
|
-
@versions_map = versions_map
|
8
|
+
@versions_map = versions_map.symbolize_keys
|
9
9
|
end
|
10
10
|
|
11
11
|
def dispatch(env, controller_path, action_name, version = nil)
|
@@ -57,6 +57,5 @@ module Multiview
|
|
57
57
|
Rails.logger.warn("[Multiview] Prepend view path app/views/#{version}")
|
58
58
|
controller.prepend_view_path(Rails.root.join("app/views/#{version}"))
|
59
59
|
end
|
60
|
-
|
61
60
|
end
|
62
61
|
end
|
data/lib/multiview/version.rb
CHANGED
data/lib/multiview.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multiview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Xie
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
123
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.
|
124
|
+
rubygems_version: 2.6.11
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: Support multiple versions for Rails view.
|