blue_sparks 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,6 +4,16 @@ BlueSparks
4
4
  Epic static page rendering controller with support for nested pages, and
5
5
  routes at the root. Heavily inspired by [thoughtbot's high_voltage](/thoughtbot/high_voltage).
6
6
 
7
+ Downsides
8
+ ---------
9
+
10
+ Downsides, you say? Yeah, unfortunately the only downside is that we
11
+ have to use a wildcard route to accomplish the "routes at the root"
12
+ thing. This means that requests that would normally result in a 404 get
13
+ routed through BlueSparks::PagesController first. This shouldn't cause
14
+ any major hiccups, though. If you're still interested, read on for great
15
+ justice!!!
16
+
7
17
  Routes at the root?
8
18
  -------------------
9
19
 
@@ -66,11 +76,11 @@ By default, the static page routes will be like /:slug (where :slug is the view
66
76
 
67
77
  If you want to route to a static page in another location (for example, a homepage), do this:
68
78
 
69
- match '/home' => 'blue_sparks/pages#show', :slug => 'home'
79
+ match '/my/crazy/page/of/doom' => 'blue_sparks/pages#show', :slug => 'mycrazypageofdoom'
70
80
 
71
- In that case, you'd need an app/views/pages/home.html.erb file.
81
+ In that case, you'd need an app/views/pages/mycrazypageofdoom.html.erb file.
72
82
 
73
- Generally speaking, you need to route to the 'show' action with an :slug param of the view filename.
83
+ Generally speaking, you need to route to the 'show' action with a :slug param of the view filename.
74
84
 
75
85
  You can route the root url to a high voltage page like this:
76
86
 
@@ -88,14 +98,14 @@ Most common reasons to override?
88
98
 
89
99
  Create a PagesController of your own:
90
100
 
91
- $ rails generate controller pages
101
+ % rails generate controller pages
92
102
 
93
103
  Override the default route:
94
104
 
95
105
  # in config/routes.rb
96
- resources :pages
106
+ match '/*slug' => 'pages#show'
97
107
 
98
- Then modify it to subclass from High Voltage, adding whatever you need:
108
+ Then modify it to subclass from BlueSparks, adding whatever you need:
99
109
 
100
110
  class PagesController < BlueSparks::PagesController
101
111
  before_filter :authenticate
@@ -20,20 +20,6 @@ class BlueSparks::PagesController < ApplicationController
20
20
  end
21
21
  end
22
22
 
23
- def subnav
24
- # magic method to render a given folder's subnav partial
25
- begin
26
- subnav = render :partial => "#{current_page}/menu", :layout => "menu_template"
27
- subnav.first unless subnav.nil?
28
- rescue
29
- begin
30
- subnav = render :partial => "#{page_root}/menu", :layout => "menu_template"
31
- rescue
32
- end
33
- end
34
- subnav.first unless subnav.nil?
35
- end
36
-
37
23
  protected
38
24
 
39
25
  def current_page
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.3
5
+ version: 0.1.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Cody Krieger