summaryrefslogtreecommitdiff
path: root/app/controllers/nodes_controller.rb
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-09-08 20:06:44 +0200
committerhukl <contact@smyck.org>2009-09-08 20:06:44 +0200
commitb48ee28e586fd75e84e33fabfcba70c05d32a606 (patch)
tree3654bd300fa8a2a387c50b53d23c794da49762d0 /app/controllers/nodes_controller.rb
parentb981d83e5e005817a67b11ccf92dd65bb506bcd4 (diff)
lots of gui improvements for creating nodes
Diffstat (limited to 'app/controllers/nodes_controller.rb')
-rw-r--r--app/controllers/nodes_controller.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb
index f8b8058..a23354c 100644
--- a/app/controllers/nodes_controller.rb
+++ b/app/controllers/nodes_controller.rb
@@ -28,15 +28,17 @@ class NodesController < ApplicationController
28 end 28 end
29 29
30 def create 30 def create
31 @node = Node.new( params[:node] ) 31 parent = case params[:kind]
32 32 when "top_level" then Node.root
33 parent = Node.find(params[:parent_id]) 33 when "update" then Update.find_or_create_parent
34 when "generic" then Node.find(params[:parent_id])
35 end
34 36
35 if parent and @node.save 37 if parent
36 @node.move_to_child_of parent 38 @node = parent.children.create(:slug => params[:title].parameterize.to_s)
39 @node.draft.update_attributes(:title => params[:title])
37 redirect_to(edit_node_path(@node)) 40 redirect_to(edit_node_path(@node))
38 else 41 else
39 @node.errors.add("Parent node")
40 render :action => :new 42 render :action => :new
41 end 43 end
42 end 44 end