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 | 29 | |
30 | 30 | def edit |
31 | 31 | @article = profile.articles.find(params[:id]) |
32 | + @parent_id = params[:parent_id] | |
33 | + @type = params[:type] | |
32 | 34 | if request.post? |
33 | 35 | @article.last_changed_by = user |
34 | 36 | if @article.update_attributes(params[:article]) |
... | ... | @@ -50,6 +52,7 @@ class CmsController < MyProfileController |
50 | 52 | :description => type.description |
51 | 53 | }) |
52 | 54 | end |
55 | + @parent_id = params[:parent_id] | |
53 | 56 | render :action => 'select_article_type', :layout => false |
54 | 57 | return |
55 | 58 | end | ... | ... |
app/views/cms/edit.rhtml
... | ... | @@ -2,9 +2,9 @@ |
2 | 2 | |
3 | 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 | 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 | 3 | <ul id="article_types"> |
4 | 4 | <% for type in @article_types %> |
5 | 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 | 7 | <br/> <%= type[:description] %> |
8 | 8 | </li> |
9 | 9 | <% end %> | ... | ... |
app/views/layouts/application.rhtml
... | ... | @@ -39,7 +39,7 @@ |
39 | 39 | <%= javascript_include_tag 'auto-open-menu' %> |
40 | 40 | <%= include_lightbox_header %> |
41 | 41 | <%# cms stuff %> |
42 | - <% if params[:controller] == 'cms' %> | |
42 | + <% if @controller.controller_name == 'cms' %> | |
43 | 43 | <%= javascript_include_tag 'cms' %> |
44 | 44 | <% end %> |
45 | 45 | </head> | ... | ... |
app/views/search/_display_results.rhtml
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <% @results.each do |name,results| %> |
4 | 4 | <% if !results.nil? and !results.empty? %> |
5 | 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 | 7 | <h3><%= @names[name] %></h3> |
8 | 8 | <% end %> |
9 | 9 | <% partial = partial_for_class results.first.class %> |
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | </div><!-- end class="search-results-<%= name %>" --> |
18 | 18 | <% else %> |
19 | 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 | 21 | <h3><%= @names[name] %></h3> |
22 | 22 | <% end %> |
23 | 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 | 3 | <%= render :partial => 'display_results' %> |
4 | 4 | ... | ... |
app/views/shared/categories_menu.rhtml
... | ... | @@ -5,8 +5,8 @@ |
5 | 5 | <%= item.name %> |
6 | 6 | <ul> |
7 | 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 | 10 | <% else %> |
11 | 11 | <li><%= link_to(content_tag('span', child.name), :controller => 'search', :action => 'category_index', :category_path => child.explode_path) %></li> |
12 | 12 | <% end %> | ... | ... |