From 113449eacba67625004b14081f4cc0cc3b984553 Mon Sep 17 00:00:00 2001 From: hukl Date: Mon, 2 Mar 2009 17:22:48 +0100 Subject: 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 --- app/controllers/nodes_controller.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'app/controllers/nodes_controller.rb') 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 :edit, :update, :destroy, - :publish + :publish, + :unlock ] def index @@ -67,6 +68,20 @@ class NodesController < ApplicationController redirect_to node_path end + def unlock + # TODO that actually has to be implemented in the model, once we have + # permissions + if draft = @node.draft + draft.user = nil + draft.save + flash[:notice] = "Node unlocked" + else + flash[:notice] = "Cannot unlock" + end + + redirect_to nodes_path + end + def move_to parent = Node.find params[:parent_id] @node.move_to_child_of parent -- cgit v1.3