diff options
| author | hukl <hukl@eight.local> | 2009-02-15 22:56:09 +0100 |
|---|---|---|
| committer | hukl <hukl@eight.local> | 2009-02-15 22:56:09 +0100 |
| commit | 83a83770e705dc42c2d3ee28e8477a4f8dc4a10b (patch) | |
| tree | 5dfcd129a5ee870eaed8831ac9df8b47413454da /app | |
| parent | fe83a57c9c6821618ddecab55731313df3295556 (diff) | |
using real users now that we have a real user model
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/nodes_controller.rb | 3 | ||||
| -rw-r--r-- | app/views/nodes/edit.html.erb | 11 |
2 files changed, 4 insertions, 10 deletions
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb index 19fbb57..2915acc 100644 --- a/app/controllers/nodes_controller.rb +++ b/app/controllers/nodes_controller.rb | |||
| @@ -33,7 +33,8 @@ class NodesController < ApplicationController | |||
| 33 | 33 | ||
| 34 | def update | 34 | def update |
| 35 | draft = @node.find_or_create_draft current_user | 35 | draft = @node.find_or_create_draft current_user |
| 36 | if request.post? && draft.update_attributes( params[:page] ) | 36 | |
| 37 | if draft.update_attributes( params[:page] ) | ||
| 37 | redirect_to(@node) | 38 | redirect_to(@node) |
| 38 | else | 39 | else |
| 39 | render :action => :edit | 40 | render :action => :edit |
diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index 433c5eb..67e3c56 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb | |||
| @@ -4,10 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | <% form_for(@node) do |f| %> | 5 | <% form_for(@node) do |f| %> |
| 6 | <%= f.error_messages %> | 6 | <%= f.error_messages %> |
| 7 | |||
| 8 | <% if draft = @node.find_or_create_draft( User.first ) %> | ||
| 9 | 7 | ||
| 10 | <% fields_for @node.draft do |d| %> | 8 | <% fields_for @node.find_or_create_draft( current_user ) do |d| %> |
| 11 | <p> | 9 | <p> |
| 12 | <%= d.label :title %><br /> | 10 | <%= d.label :title %><br /> |
| 13 | <%= d.text_field :title %> | 11 | <%= d.text_field :title %> |
| @@ -21,12 +19,7 @@ | |||
| 21 | <%= d.text_area :body %> | 19 | <%= d.text_area :body %> |
| 22 | </p> | 20 | </p> |
| 23 | <% end %> | 21 | <% end %> |
| 24 | 22 | ||
| 25 | <% else %> | ||
| 26 | |||
| 27 | <p>Page is locked</p> | ||
| 28 | |||
| 29 | <% end %> | ||
| 30 | <p> | 23 | <p> |
| 31 | <%= f.submit "Update" %> | 24 | <%= f.submit "Update" %> |
| 32 | </p> | 25 | </p> |
