Merge Request #1

Open
noosfero-plugins/proposals_discussion!1
Created by Michel Felipe

Tasks List - Keep filter params

Keep filter params in tasks lists (Moderate proposals, Validate proposals, Moderate new Members...) after perform a submit post action in a specific task (approve, repprove...). The same implementation was did on noosfero main repo on branch tasks_keep_filter_params to!

Assignee: None
Milestone: None
This can't be merged automatically, even if it could be merged you don't have the permission to do so.
This can be merged automatically but you don't have the permission to do so.
1 participants
controllers/myprofile/proposals_discussion_plugin_tasks_controller.rb
... ... @@ -44,6 +44,14 @@ class ProposalsDiscussionPluginTasksController < TasksController
44 44 @failed = params ? params[:failed] : {}
45 45  
46 46 @responsible_candidates = profile.members.by_role(profile.roles.reject {|r| !r.has_permission?('perform_task')}).order('name asc') if profile.organization?
  47 +
  48 + @params_tags = []
  49 + params.each do |key,value|
  50 + if key =~ /filter_/ && value
  51 + @params_tags << view_context.hidden_field_tag(key, value)
  52 + end
  53 + end
  54 +
47 55 end
48 56  
49 57 def save_categories
... ...
views/proposals_discussion_plugin_tasks/index.html.erb
... ... @@ -51,6 +51,16 @@
51 51 </p>
52 52 <% else %>
53 53 <%= form_tag :action => 'close' do%>
  54 +
  55 + <% if !@params_tags.empty? %>
  56 + <p>
  57 + <% @params_tags.each do |hidden_tag| %>
  58 +
  59 + <%= hidden_tag %>
  60 + <% end %>
  61 + </p>
  62 + <% end %>
  63 +
54 64 <% button_bar(:class => 'task-actions') do %>
55 65 <%# FiXME button(:edit, _('View my requests'), :action => 'list_requested') %>
56 66 <%# FIXME button('menu-mail', _('Send request'), :action => 'new') %>
... ...