render_radiant 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +14 -10
  2. data/lib/render_radiant.rb +2 -2
  3. metadata +3 -3
data/README.md CHANGED
@@ -1,18 +1,18 @@
1
- = RenderRadiant
1
+ # RenderRadiant
2
2
 
3
- == SYNOPSIS
3
+ ## SYNOPSIS
4
4
 
5
5
  RenderRadiant adds a :radiant option to ActionController::Base's render method, giving actions in your extension controller the ability to use Radiant for rendering pages. The page's context is set based on instance variables you define in the action. "flash", "params" and locals you pass in using the :locals option are also available from the page's context.globals to be used by your Radius tags.
6
6
 
7
7
  The page to render is deduced from the requested URL or the passed in :action option.
8
8
 
9
- == INSTALL
9
+ ## INSTALL
10
10
 
11
11
  gem install render_radiant
12
12
 
13
13
  Require 'render_radiant' in your Radiant extension's extension_config.
14
14
 
15
- == USAGE
15
+ ## USAGE
16
16
 
17
17
  In your extension's controller, use the render :radiant command:
18
18
 
@@ -30,9 +30,9 @@ In your extension's controller, use the render :radiant command:
30
30
 
31
31
  end
32
32
 
33
- Page attributes can be overridden and/or set by passing in the page hash:
33
+ Page attributes can be overridden and/or set by passing in through the :radiant options hash:
34
34
 
35
- render :radiant, :page => { :title => @event.name }
35
+ render :radiant => { :title => @event.name, :breadcrumb => @event.name }
36
36
 
37
37
  By default all instance variables declared in the action are assigned to the Radiant page's context to be called from your Radius tags.
38
38
 
@@ -44,20 +44,24 @@ To use a different url for rendering, pass in the :action option:
44
44
 
45
45
  You will want to create a page tree in Radiant with slugs that match the actions in your controller that will be rendered. If a corresponding Radiant page is not found, the 404 page is rendered.
46
46
 
47
- === Controller to Radiant Page Mapping
47
+ ### Controller to Radiant Page Mapping
48
48
 
49
49
  render_radiant assumes the Radiant page used for rendering will match the URL of the request. So, for example, in an EventsController, the "index" action will use Page.find_by_url('/events') to fetch the index page for that request.
50
50
 
51
- === Loading Context
51
+ ### Loading Context
52
52
 
53
53
  render_radiant loads instance variables defined in the action, locals passed in via the :locals option hash, and values from the "flash" and "params" methods into the page's context.globals to be called from your Radius tags.
54
54
 
55
55
  So if you define the variable @events in your EventsController's "index" action, the data will be available to radius in tag.locals.events during rendering.
56
56
 
57
- === Overriding Default Page Values
57
+ ### Overriding Default Page Values
58
58
 
59
59
  Currently render_radiant will override the page's title by passing in the :title option.
60
60
 
61
- == RAILS 3 POSSIBILITIES
61
+ ## RAILS 3 POSSIBILITIES
62
62
 
63
63
  Currently only Rails 2.3.8 (which is used by the current version of Radiant) is used. However, once Radiant adopts Rails 3, a custom Radiant renderer can be built, therefore making monkey-patching ActionController::Base unnecessary: http://www.engineyard.com/blog/2010/render-options-in-rails-3/
64
+
65
+ ## CREDIT
66
+
67
+ This gem was inspired by Rubidine's ExtensionRendersRadiant library (https://github.com/rubidine/radiant_rbiz/blob/master/lib/extension_renders_radiant.rb), written by Todd Willey.
@@ -28,7 +28,7 @@ module RenderRadiant
28
28
  # Page attributes can be overridden and/or set by passing in through the
29
29
  # :radiant options hash:
30
30
  #
31
- # render :radiant => { :title => @event.name }
31
+ # render :radiant => { :title => @event.name, :breadcrumb => @event.name }
32
32
  #
33
33
  # By default all instance variables declared in the action are assigned
34
34
  # to the Radiant page's context to be called from your Radius tags.
@@ -51,7 +51,7 @@ module RenderRadiant
51
51
  raise DoubleRenderError, "Can only render or redirect once per action" if performed?
52
52
  validate_render_arguments(options, extra_options, block_given?)
53
53
 
54
- options = options[:radiant]
54
+ options = (options.is_a?(Hash) ? options[:radiant] : nil)
55
55
 
56
56
  # Retrieve the action and controller to form a URL
57
57
  split_action = extra_options[:action].split('/') if extra_options[:action]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: render_radiant
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chase James