From c129af3e013edb9e68bdf9069bd2879590bc54fd Mon Sep 17 00:00:00 2001 From: hukl Date: Sun, 22 Feb 2009 17:00:57 +0100 Subject: replaced freeform textfield with select tag which has to be replaced with something more decent soon. but it works for now --- app/controllers/nodes_controller.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'app/controllers/nodes_controller.rb') 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 end def create - parent = Node.find_by_unique_name(params[:parent_unique_name]) - parent ||= Node.root - @node = Node.new( params[:node] ) - if request.post? and @node.save + parent = Node.find(params[:parent_id]) + + if parent and @node.save @node.move_to_child_of parent redirect_to(@node) else + @node.errors.add("Parent node") render :action => :new end end @@ -46,9 +46,9 @@ class NodesController < ApplicationController end def update - draft = @node.find_or_create_draft current_user - - if draft.update_attributes( params[:page] ) + @draft = @node.find_or_create_draft current_user + @draft.tag_list = params[:tag_list] + if @draft.update_attributes( params[:page] ) redirect_to(@node) else render :action => :edit -- cgit v1.3