From 8927a80246729938e6a0518f75309f6160c7551d Mon Sep 17 00:00:00 2001 From: sandoz Date: Sat, 22 Aug 2009 23:04:51 +0200 Subject: [PATCH] You can change the page parent now at pages/edit. * Increased text area size for better layout with the new feature. * Closes #39 --- app/controllers/pages_controller.rb | 2 ++ app/views/pages/_form.html.haml | 7 ++++--- app/views/pages/edit.html.haml | 2 +- app/views/pages/new.html.haml | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 2074015d..eb6d07a6 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -60,6 +60,8 @@ class PagesController < ApplicationController render :action => 'edit' else if @page.save + @page.parent_id = parent_id if (!params[:parent_id].blank? \ + and params[:parent_id] != @page_id) flash[:notice] = 'Seite wurde aktualisiert.' redirect_to wiki_page_path(@page.permalink) else diff --git a/app/views/pages/_form.html.haml b/app/views/pages/_form.html.haml index 2f00aea9..b012d957 100644 --- a/app/views/pages/_form.html.haml +++ b/app/views/pages/_form.html.haml @@ -82,7 +82,6 @@ - form_for @page do |f| = f.error_messages = f.hidden_field :lock_version - = f.hidden_field :parent_id %p %b Titel %br/ @@ -90,12 +89,14 @@ %p %b Inhalt %br/ - = f.text_area :body, :size => "60x30" + = f.text_area :body, :size => "65x30" %p = f.submit "Vorschau", :name => 'preview' | = f.submit "Speichern" | = link_to "Abbrechen", @page + | Oberseite ändern: + = collection_select(:page, :parent_id, Page.all, :id, :permalink, {:prompt => "Neue Oberseite?"}) -%div(style="clear:right; height:1px") \ No newline at end of file +%div(style="clear:right; height:1px") diff --git a/app/views/pages/edit.html.haml b/app/views/pages/edit.html.haml index d6801c67..2d065b1a 100644 --- a/app/views/pages/edit.html.haml +++ b/app/views/pages/edit.html.haml @@ -11,4 +11,4 @@ %h1 #{@page.title} bearbeiten - = render :partial => 'form' \ No newline at end of file + = render :partial => 'form' diff --git a/app/views/pages/new.html.haml b/app/views/pages/new.html.haml index c54e4605..8bb44198 100644 --- a/app/views/pages/new.html.haml +++ b/app/views/pages/new.html.haml @@ -13,4 +13,4 @@ %h1 Neue Wikiseite anlegen - = render :partial => 'form' \ No newline at end of file + = render :partial => 'form'