summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhukl <hukl@eight.local>2009-02-15 20:58:47 +0100
committerhukl <hukl@eight.local>2009-02-15 20:58:47 +0100
commitcbdb0d11742581407108d2300c5caf61787c6fe8 (patch)
tree104ad0e90845343723ad16968d4e6c57b3539e23
parent62d91924c5cd5cf0ace762d310edb6ded9d586aa (diff)
more nodes controller functionality
-rw-r--r--app/controllers/nodes_controller.rb20
1 files changed, 17 insertions, 3 deletions
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb
index cc1ad5c..19fbb57 100644
--- a/app/controllers/nodes_controller.rb
+++ b/app/controllers/nodes_controller.rb
@@ -3,13 +3,13 @@ class NodesController < ApplicationController
3 layout 'admin' 3 layout 'admin'
4 4
5 before_filter :find_node, :only => [:create, :show, :edit, :update, :destroy] 5 before_filter :find_node, :only => [:create, :show, :edit, :update, :destroy]
6
7 6
8 def index 7 def index
9 @nodes = Node.root.children.all(:include => :head) 8 @nodes = Node.root.children.all(:include => :head)
10 end 9 end
11 10
12 def new 11 def new
12
13 end 13 end
14 14
15 def create 15 def create
@@ -33,11 +33,25 @@ 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 draft.update_attributes params[:page] 36 if request.post? && draft.update_attributes( params[:page] )
37 draft.save 37 redirect_to(@node)
38 else
39 render :action => :edit
40 end
38 end 41 end
39 42
40 def destroy 43 def destroy
44 @node.destroy
45 end
46
47 def publish
48 @node.publish_draft!
49 end
50
51 def move_to
52 parent = Node.find params[:parent_id]
53 @node.move_to_child_of parent
54 redirect_to(@node)
41 end 55 end
42 56
43 private 57 private