Commit 02d5bfa06dd08628e4d10476c8419fa43b8aed4d
1 parent
cf967b93
Exists in
master
and in
29 other branches
ActionItem192: move params[:anything] present in views to controllers
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1671 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
7 changed files
with
12 additions
and
9 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
@@ -29,6 +29,8 @@ class CmsController < MyProfileController | @@ -29,6 +29,8 @@ class CmsController < MyProfileController | ||
29 | 29 | ||
30 | def edit | 30 | def edit |
31 | @article = profile.articles.find(params[:id]) | 31 | @article = profile.articles.find(params[:id]) |
32 | + @parent_id = params[:parent_id] | ||
33 | + @type = params[:type] | ||
32 | if request.post? | 34 | if request.post? |
33 | @article.last_changed_by = user | 35 | @article.last_changed_by = user |
34 | if @article.update_attributes(params[:article]) | 36 | if @article.update_attributes(params[:article]) |
@@ -50,6 +52,7 @@ class CmsController < MyProfileController | @@ -50,6 +52,7 @@ class CmsController < MyProfileController | ||
50 | :description => type.description | 52 | :description => type.description |
51 | }) | 53 | }) |
52 | end | 54 | end |
55 | + @parent_id = params[:parent_id] | ||
53 | render :action => 'select_article_type', :layout => false | 56 | render :action => 'select_article_type', :layout => false |
54 | return | 57 | return |
55 | end | 58 | end |
app/views/cms/edit.rhtml
@@ -2,9 +2,9 @@ | @@ -2,9 +2,9 @@ | ||
2 | 2 | ||
3 | <% labelled_form_for 'article', @article, :html => { :multipart => true } do |f| %> | 3 | <% labelled_form_for 'article', @article, :html => { :multipart => true } do |f| %> |
4 | 4 | ||
5 | - <%= hidden_field_tag("type", params[:type]) if params[:type] %> | 5 | + <%= hidden_field_tag("type", @type) if @type %> |
6 | 6 | ||
7 | - <%= hidden_field_tag('parent_id', params[:parent_id]) if params[:parent_id] %> | 7 | + <%= hidden_field_tag('parent_id', @parent_id) if @parent_id %> |
8 | 8 | ||
9 | <%= render :partial => partial_for_class(@article.class), :locals => { :f => f } %> | 9 | <%= render :partial => partial_for_class(@article.class), :locals => { :f => f } %> |
10 | 10 |
app/views/cms/select_article_type.rhtml
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <ul id="article_types"> | 3 | <ul id="article_types"> |
4 | <% for type in @article_types %> | 4 | <% for type in @article_types %> |
5 | <li> | 5 | <li> |
6 | - <%= link_to type[:short_description], :action => 'new', :type => type[:name], :parent_id => params[:parent_id] %> | 6 | + <%= link_to type[:short_description], :action => 'new', :type => type[:name], :parent_id => @parent_id %> |
7 | <br/> <%= type[:description] %> | 7 | <br/> <%= type[:description] %> |
8 | </li> | 8 | </li> |
9 | <% end %> | 9 | <% end %> |
app/views/layouts/application.rhtml
@@ -39,7 +39,7 @@ | @@ -39,7 +39,7 @@ | ||
39 | <%= javascript_include_tag 'auto-open-menu' %> | 39 | <%= javascript_include_tag 'auto-open-menu' %> |
40 | <%= include_lightbox_header %> | 40 | <%= include_lightbox_header %> |
41 | <%# cms stuff %> | 41 | <%# cms stuff %> |
42 | - <% if params[:controller] == 'cms' %> | 42 | + <% if @controller.controller_name == 'cms' %> |
43 | <%= javascript_include_tag 'cms' %> | 43 | <%= javascript_include_tag 'cms' %> |
44 | <% end %> | 44 | <% end %> |
45 | </head> | 45 | </head> |
app/views/search/_display_results.rhtml
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <% @results.each do |name,results| %> | 3 | <% @results.each do |name,results| %> |
4 | <% if !results.nil? and !results.empty? %> | 4 | <% if !results.nil? and !results.empty? %> |
5 | <div class="search-results-<%= name %> search-results-box <%= pos==:odd ? pos=:even : pos=:odd %>"> | 5 | <div class="search-results-<%= name %> search-results-box <%= pos==:odd ? pos=:even : pos=:odd %>"> |
6 | - <% if params[:action] != 'assets' %> | 6 | + <% if @controller.action_name != 'assets' %> |
7 | <h3><%= @names[name] %></h3> | 7 | <h3><%= @names[name] %></h3> |
8 | <% end %> | 8 | <% end %> |
9 | <% partial = partial_for_class results.first.class %> | 9 | <% partial = partial_for_class results.first.class %> |
@@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
17 | </div><!-- end class="search-results-<%= name %>" --> | 17 | </div><!-- end class="search-results-<%= name %>" --> |
18 | <% else %> | 18 | <% else %> |
19 | <div class="search-results-<%= name %> search-results-empty search-results-box <%= pos==:odd ? pos=:even : pos=:odd %>"> | 19 | <div class="search-results-<%= name %> search-results-empty search-results-box <%= pos==:odd ? pos=:even : pos=:odd %>"> |
20 | - <% if params[:action] != 'assets' %> | 20 | + <% if @controller.action_name != 'assets' %> |
21 | <h3><%= @names[name] %></h3> | 21 | <h3><%= @names[name] %></h3> |
22 | <% end %> | 22 | <% end %> |
23 | <div class="search-results-innerbox search-results-type-empty"> | 23 | <div class="search-results-innerbox search-results-type-empty"> |
app/views/search/index.rhtml
1 | -<h2> <%= @category ? (_('Search results for "%{query}" in %{category}') % { :query => @query, :category => @category.full_name}) : (_('Search results for "%s"') % @query) %> </h2> | 1 | +<h2> <%=h @category ? (_('Search results for "%{query}" in %{category}') % { :query => @query, :category => @category.full_name}) : (_('Search results for "%s"') % @query) %> </h2> |
2 | 2 | ||
3 | <%= render :partial => 'display_results' %> | 3 | <%= render :partial => 'display_results' %> |
4 | 4 |
app/views/shared/categories_menu.rhtml
@@ -5,8 +5,8 @@ | @@ -5,8 +5,8 @@ | ||
5 | <%= item.name %> | 5 | <%= item.name %> |
6 | <ul> | 6 | <ul> |
7 | <% item.all_children.each do |child| %> | 7 | <% item.all_children.each do |child| %> |
8 | - <% if (params[:controller] == 'search') && (params[:action] == 'assets') %> | ||
9 | - <li><%= link_to(content_tag('span', child.name), :controller => 'search', :action => 'assets', :asset => params[:asset], :category_path => child.explode_path) %></li> | 8 | + <% if (@controller.controller_name == 'search') && (@controller.action_name == 'assets') %> |
9 | + <li><%=h link_to(content_tag('span', child.name), :controller => 'search', :action => 'assets', :asset => params[:asset], :category_path => child.explode_path) %></li> | ||
10 | <% else %> | 10 | <% else %> |
11 | <li><%= link_to(content_tag('span', child.name), :controller => 'search', :action => 'category_index', :category_path => child.explode_path) %></li> | 11 | <li><%= link_to(content_tag('span', child.name), :controller => 'search', :action => 'category_index', :category_path => child.explode_path) %></li> |
12 | <% end %> | 12 | <% end %> |