summaryrefslogtreecommitdiff
path: root/app/controllers/nodes_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/nodes_controller.rb')
-rw-r--r--app/controllers/nodes_controller.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb
index 829e26f..a558a86 100644
--- a/app/controllers/nodes_controller.rb
+++ b/app/controllers/nodes_controller.rb
@@ -24,15 +24,15 @@ class NodesController < ApplicationController
24 end 24 end
25 25
26 def create 26 def create
27 parent = Node.find_by_unique_name(params[:parent_unique_name])
28 parent ||= Node.root
29
30 @node = Node.new( params[:node] ) 27 @node = Node.new( params[:node] )
31 28
32 if request.post? and @node.save 29 parent = Node.find(params[:parent_id])
30
31 if parent and @node.save
33 @node.move_to_child_of parent 32 @node.move_to_child_of parent
34 redirect_to(@node) 33 redirect_to(@node)
35 else 34 else
35 @node.errors.add("Parent node")
36 render :action => :new 36 render :action => :new
37 end 37 end
38 end 38 end
@@ -46,9 +46,9 @@ class NodesController < ApplicationController
46 end 46 end
47 47
48 def update 48 def update
49 draft = @node.find_or_create_draft current_user 49 @draft = @node.find_or_create_draft current_user
50 50 @draft.tag_list = params[:tag_list]
51 if draft.update_attributes( params[:page] ) 51 if @draft.update_attributes( params[:page] )
52 redirect_to(@node) 52 redirect_to(@node)
53 else 53 else
54 render :action => :edit 54 render :action => :edit