diff options
| author | hukl <contact@smyck.org> | 2009-03-08 23:45:52 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-03-08 23:45:52 +0100 |
| commit | e055502fe81469d1f96f41e3dbf70d2ed9ac33fe (patch) | |
| tree | 184fb187cd89c27914815a1f8a93d826cc5b07c5 /app/controllers/nodes_controller.rb | |
| parent | 2aab7eaa19dcd2d86012f71954b8543572f8eaa5 (diff) | |
added basic preview feature. If a draft exists, the show action renders a proper preview. If not the default show template is rendered.
Diffstat (limited to 'app/controllers/nodes_controller.rb')
| -rw-r--r-- | app/controllers/nodes_controller.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb index 81ead62..f82ab82 100644 --- a/app/controllers/nodes_controller.rb +++ b/app/controllers/nodes_controller.rb | |||
| @@ -40,7 +40,15 @@ class NodesController < ApplicationController | |||
| 40 | end | 40 | end |
| 41 | 41 | ||
| 42 | def show | 42 | def show |
| 43 | @nodes = Node.find(params[:id]).children | 43 | @page = Node.find(params[:id]).draft |
| 44 | |||
| 45 | if @page | ||
| 46 | template = @page.valid_template | ||
| 47 | render( | ||
| 48 | :file => template, | ||
| 49 | :layout => "application" | ||
| 50 | ) | ||
| 51 | end | ||
| 44 | end | 52 | end |
| 45 | 53 | ||
| 46 | def edit | 54 | def edit |
