From 02d5bfa06dd08628e4d10476c8419fa43b8aed4d Mon Sep 17 00:00:00 2001 From: JoenioCosta Date: Fri, 18 Apr 2008 22:16:05 +0000 Subject: [PATCH] ActionItem192: move params[:anything] present in views to controllers --- app/controllers/my_profile/cms_controller.rb | 3 +++ app/views/cms/edit.rhtml | 4 ++-- app/views/cms/select_article_type.rhtml | 2 +- app/views/layouts/application.rhtml | 2 +- app/views/search/_display_results.rhtml | 4 ++-- app/views/search/index.rhtml | 2 +- app/views/shared/categories_menu.rhtml | 4 ++-- 7 files changed, 12 insertions(+), 9 deletions(-) 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 @@