diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index 10f36e5..54555fb 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -29,6 +29,8 @@ class CmsController < MyProfileController def edit @article = profile.articles.find(params[:id]) + @parent_id = params[:parent_id] + @type = params[:type] if request.post? @article.last_changed_by = user if @article.update_attributes(params[:article]) @@ -50,6 +52,7 @@ class CmsController < MyProfileController :description => type.description }) end + @parent_id = params[:parent_id] render :action => 'select_article_type', :layout => false return end diff --git a/app/views/cms/edit.rhtml b/app/views/cms/edit.rhtml index 3e8cdd3..ac22745 100644 --- a/app/views/cms/edit.rhtml +++ b/app/views/cms/edit.rhtml @@ -2,9 +2,9 @@ <% labelled_form_for 'article', @article, :html => { :multipart => true } do |f| %> - <%= hidden_field_tag("type", params[:type]) if params[:type] %> + <%= hidden_field_tag("type", @type) if @type %> - <%= hidden_field_tag('parent_id', params[:parent_id]) if params[:parent_id] %> + <%= hidden_field_tag('parent_id', @parent_id) if @parent_id %> <%= render :partial => partial_for_class(@article.class), :locals => { :f => f } %> diff --git a/app/views/cms/select_article_type.rhtml b/app/views/cms/select_article_type.rhtml index 26b89b0..6121063 100644 --- a/app/views/cms/select_article_type.rhtml +++ b/app/views/cms/select_article_type.rhtml @@ -3,7 +3,7 @@