diff options
| author | hukl <contact@smyck.org> | 2009-03-02 17:22:48 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-03-02 17:22:48 +0100 |
| commit | 113449eacba67625004b14081f4cc0cc3b984553 (patch) | |
| tree | 1114418aa27ffc3f815a05caba16c4d80395163f /app/controllers/nodes_controller.rb | |
| parent | ddc961fd81b37b44078fba35f0769b661e1e81ce (diff) | |
added unlock functionality. not yet hooked up with permissions though. anybody can unlock. put a confirmation in front of it. destroy has to be confirmed as well
Diffstat (limited to 'app/controllers/nodes_controller.rb')
| -rw-r--r-- | app/controllers/nodes_controller.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb index a403b95..81ead62 100644 --- a/app/controllers/nodes_controller.rb +++ b/app/controllers/nodes_controller.rb | |||
| @@ -7,7 +7,8 @@ class NodesController < ApplicationController | |||
| 7 | :edit, | 7 | :edit, |
| 8 | :update, | 8 | :update, |
| 9 | :destroy, | 9 | :destroy, |
| 10 | :publish | 10 | :publish, |
| 11 | :unlock | ||
| 11 | ] | 12 | ] |
| 12 | 13 | ||
| 13 | def index | 14 | def index |
| @@ -67,6 +68,20 @@ class NodesController < ApplicationController | |||
| 67 | redirect_to node_path | 68 | redirect_to node_path |
| 68 | end | 69 | end |
| 69 | 70 | ||
| 71 | def unlock | ||
| 72 | # TODO that actually has to be implemented in the model, once we have | ||
| 73 | # permissions | ||
| 74 | if draft = @node.draft | ||
| 75 | draft.user = nil | ||
| 76 | draft.save | ||
| 77 | flash[:notice] = "Node unlocked" | ||
| 78 | else | ||
| 79 | flash[:notice] = "Cannot unlock" | ||
| 80 | end | ||
| 81 | |||
| 82 | redirect_to nodes_path | ||
| 83 | end | ||
| 84 | |||
| 70 | def move_to | 85 | def move_to |
| 71 | parent = Node.find params[:parent_id] | 86 | parent = Node.find params[:parent_id] |
| 72 | @node.move_to_child_of parent | 87 | @node.move_to_child_of parent |
