diff options
| author | hukl <contact@smyck.org> | 2009-02-22 17:00:57 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-02-22 17:00:57 +0100 |
| commit | c129af3e013edb9e68bdf9069bd2879590bc54fd (patch) | |
| tree | 3bef8df8e42e5b25225a10a994673b139ef03fca /app/controllers | |
| parent | 3df96bbb94a6d89709983d0911ca79491ed6e981 (diff) | |
replaced freeform textfield with select tag which has to be replaced with something more decent soon. but it works for now
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/nodes_controller.rb | 14 |
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 |
