summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-10-17 23:32:18 +0200
committerhukl <contact@smyck.org>2009-10-17 23:32:18 +0200
commit443947a319692e0462024c99f06e4d18ab5f0344 (patch)
tree652caf728cb07d0eebb3777482f8c1408a32cac0 /app/controllers
parentc7c4b007621fd28c88b65db5fd3296ef730097d9 (diff)
changed some node related methods and implementation of unlock
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/nodes_controller.rb24
1 files changed, 10 insertions, 14 deletions
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb
index 20aea5a..4f72744 100644
--- a/app/controllers/nodes_controller.rb
+++ b/app/controllers/nodes_controller.rb
@@ -43,7 +43,8 @@ class NodesController < ApplicationController
43 end 43 end
44 44
45 def show 45 def show
46 @page = Node.find(params[:id]).pages.last 46 node = Node.find(params[:id])
47 @page = node.draft || node.head
47 end 48 end
48 49
49 def edit 50 def edit
@@ -51,7 +52,11 @@ class NodesController < ApplicationController
51 @draft = @node.find_or_create_draft( current_user ) 52 @draft = @node.find_or_create_draft( current_user )
52 rescue LockedByAnotherUser => e 53 rescue LockedByAnotherUser => e
53 flash[:error] = e.message 54 flash[:error] = e.message
54 redirect_to :back 55 if request.referer
56 redirect_to :back
57 else
58 redirect_to node_path(@node)
59 end
55 end 60 end
56 end 61 end
57 62
@@ -81,22 +86,13 @@ class NodesController < ApplicationController
81 end 86 end
82 87
83 def unlock 88 def unlock
84 # TODO that actually has to be implemented in the model, once we have 89 if @node.unlock!
85 # permissions
86 if @node.lock_owner
87 @node.unlock!
88 flash[:notice] = "Node unlocked" 90 flash[:notice] = "Node unlocked"
89 else 91 else
90 flash[:notice] = "Cannot unlock" 92 flash[:notice] = "Already unlocked"
91 end 93 end
92 94
93 redirect_to :back 95 redirect_to node_path(@node)
94 end
95
96 def move_to
97 parent = Node.find params[:parent_id]
98 @node.move_to_child_of parent
99 redirect_to(@node)
100 end 96 end
101 97
102 private 98 private