blue_sparks 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +28 -9
- metadata +2 -2
data/README.md
CHANGED
@@ -1,8 +1,19 @@
|
|
1
1
|
BlueSparks
|
2
2
|
============
|
3
3
|
|
4
|
-
Epic static page rendering controller with support for nested pages
|
5
|
-
Heavily inspired by [thoughtbot's high_voltage](/thoughtbot/high_voltage).
|
4
|
+
Epic static page rendering controller with support for nested pages, and
|
5
|
+
routes at the root. Heavily inspired by [thoughtbot's high_voltage](/thoughtbot/high_voltage).
|
6
|
+
|
7
|
+
Routes at the root?
|
8
|
+
-------------------
|
9
|
+
|
10
|
+
Yeah, I'm talking about awesome routes like:
|
11
|
+
|
12
|
+
/mypage
|
13
|
+
|
14
|
+
Instead of:
|
15
|
+
|
16
|
+
/pages/mypage
|
6
17
|
|
7
18
|
Static pages?
|
8
19
|
-------------
|
@@ -28,6 +39,16 @@ Write your static pages and put them in the RAILS_ROOT/app/views/pages directory
|
|
28
39
|
% mkdir app/views/pages
|
29
40
|
% touch app/views/pages/about.html.erb
|
30
41
|
|
42
|
+
Here's the really cool part - _**you can nest pages**_.
|
43
|
+
|
44
|
+
% mkdir app/views/pages/somefolder
|
45
|
+
% touch app/views/pages/somefolder/index.html.erb
|
46
|
+
% touch app/views/pages/somefolder/other.html.erb
|
47
|
+
|
48
|
+
Now you'll be able to go to /somefolder and /somefolder/other. You can
|
49
|
+
even nest these babies as deep as you like. Have a hundred folder
|
50
|
+
nesting if you want. AWESOME, RIGHT?!
|
51
|
+
|
31
52
|
<!--
|
32
53
|
After putting something interesting there, you can link to it from anywhere in your app with:
|
33
54
|
|
@@ -38,24 +59,22 @@ This will also work, if you like the more explicit style:
|
|
38
59
|
link_to "About", page_path(:id => "about")
|
39
60
|
-->
|
40
61
|
|
41
|
-
Bam.
|
42
|
-
|
43
62
|
Routes
|
44
63
|
------
|
45
64
|
|
46
|
-
By default, the static page routes will be like
|
65
|
+
By default, the static page routes will be like /:slug (where :slug is the view filename).
|
47
66
|
|
48
67
|
If you want to route to a static page in another location (for example, a homepage), do this:
|
49
68
|
|
50
|
-
match '
|
69
|
+
match '/home' => 'blue_sparks/pages#show', :slug => 'home'
|
51
70
|
|
52
71
|
In that case, you'd need an app/views/pages/home.html.erb file.
|
53
72
|
|
54
|
-
Generally speaking, you need to route to the 'show' action with an :
|
73
|
+
Generally speaking, you need to route to the 'show' action with an :slug param of the view filename.
|
55
74
|
|
56
75
|
You can route the root url to a high voltage page like this:
|
57
76
|
|
58
|
-
root :to => 'blue_sparks/pages#show', :
|
77
|
+
root :to => 'blue_sparks/pages#show', :slug => 'home'
|
59
78
|
|
60
79
|
Which will render a homepage from app/views/pages/home.html.erb
|
61
80
|
|
@@ -84,7 +103,7 @@ Then modify it to subclass from High Voltage, adding whatever you need:
|
|
84
103
|
|
85
104
|
protected
|
86
105
|
def layout_for_page
|
87
|
-
case params[:
|
106
|
+
case params[:slug]
|
88
107
|
when 'home'
|
89
108
|
'home'
|
90
109
|
else
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: blue_sparks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Cody Krieger
|
@@ -56,6 +56,6 @@ rubyforge_project:
|
|
56
56
|
rubygems_version: 1.6.2
|
57
57
|
signing_key:
|
58
58
|
specification_version: 3
|
59
|
-
summary: Epic static page rendering controller with support for nested pages.
|
59
|
+
summary: Epic static page rendering controller with support for nested pages, and routes at the root.
|
60
60
|
test_files: []
|
61
61
|
|