pages 0.3.0 → 0.4.0
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 +12 -0
- data/lib/pages/routes.rb +9 -1
- data/lib/pages/version.rb +1 -1
- 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: 9c9ed2cd886bd6e063357dd37eba7c38d4a9cd9a
|
4
|
+
data.tar.gz: d5ad43f2545ce72b8d6bbfa591cdaf2e8584a422
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a7e9ab1052c1b708a9d995b3854df3ad4b785a6b9b2a002d0616731e74d25aba9911cfd797c1c5f75a03ecf7535ffa11be49d4f88e5ec56daedbf26770a09c8
|
7
|
+
data.tar.gz: 48e511e55d5610c0815f8162d453210e0fa70fb4ac253848f553a1e217e4c20d7f17c28e0b6357a658842a8d93afe82243cb497105f067bc86eaa2c47fb0d30d
|
data/README.md
CHANGED
@@ -83,6 +83,18 @@ already exist. If you chose to create your own it should always inherit
|
|
83
83
|
from `::PagesController`. Your views should be put into
|
84
84
|
`app/views/work/pages/`
|
85
85
|
|
86
|
+
### Path Helper Overrides ###
|
87
|
+
|
88
|
+
You can optionally override the path helpers by passing a hash to `:as`
|
89
|
+
|
90
|
+
```
|
91
|
+
pages '404', '500', as: { '404' => 'not_found', '500', => 'server_error' }
|
92
|
+
```
|
93
|
+
|
94
|
+
Your pages will still be `app/views/pages/400.html` and
|
95
|
+
`app/views/pages/500.html` but the path helpers will be `not_found_path`
|
96
|
+
and `server_error_path`.
|
97
|
+
|
86
98
|
## Authors ##
|
87
99
|
|
88
100
|
[Brian Cardarella](http://twitter.com/bcardarella)
|
data/lib/pages/routes.rb
CHANGED
@@ -4,7 +4,7 @@ module ActionDispatch::Routing
|
|
4
4
|
set_pages_namespace
|
5
5
|
_route = options[:transform].call(_page.to_s) if options[:transform]
|
6
6
|
_route ||= _page
|
7
|
-
get "/#{_route}" => "pages##{_page}", :as => _page
|
7
|
+
get "/#{_route}" => "pages##{_page}", :as => render_as(_page, options)
|
8
8
|
end
|
9
9
|
|
10
10
|
def pages(*_pages)
|
@@ -16,6 +16,14 @@ module ActionDispatch::Routing
|
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
+
def render_as(_page, options)
|
20
|
+
if options[:as]
|
21
|
+
options[:as][_page]
|
22
|
+
else
|
23
|
+
_page
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
19
27
|
def set_pages_namespace
|
20
28
|
if @scope[:module]
|
21
29
|
mod = @scope[:module].camelize
|
data/lib/pages/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Cardarella
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|