summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-03-02 17:22:48 +0100
committerhukl <contact@smyck.org>2009-03-02 17:22:48 +0100
commit113449eacba67625004b14081f4cc0cc3b984553 (patch)
tree1114418aa27ffc3f815a05caba16c4d80395163f /app
parentddc961fd81b37b44078fba35f0769b661e1e81ce (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')
-rw-r--r--app/controllers/nodes_controller.rb17
-rw-r--r--app/views/nodes/index.html.erb3
2 files changed, 18 insertions, 2 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
diff --git a/app/views/nodes/index.html.erb b/app/views/nodes/index.html.erb
index 1429d1a..833ffed 100644
--- a/app/views/nodes/index.html.erb
+++ b/app/views/nodes/index.html.erb
@@ -23,7 +23,8 @@
23 <td> 23 <td>
24 <%= link_to 'Show', node_path(node) %> 24 <%= link_to 'Show', node_path(node) %>
25 <%= link_to 'Edit', edit_node_path(node) %> 25 <%= link_to 'Edit', edit_node_path(node) %>
26 <%= link_to 'Destroy', node, :method => :delete %> 26 <%= link_to 'Destroy', node, :method => :delete, :confirm => "Are you sure you want to delete this node?" %>
27 <%= link_to 'Unlock', unlock_node_path(node), :method => :put, :confirm => "Are you sure you want to unlock?" %>
27 </td> 28 </td>
28 <td> 29 <td>
29 <%= "#{node.draft.user.login}" if node.draft && node.draft.user %> 30 <%= "#{node.draft.user.login}" if node.draft && node.draft.user %>