diff --git a/app/controllers/my_profile/tasks_controller.rb b/app/controllers/my_profile/tasks_controller.rb index 4478437..b538053 100644 --- a/app/controllers/my_profile/tasks_controller.rb +++ b/app/controllers/my_profile/tasks_controller.rb @@ -18,6 +18,14 @@ class TasksController < MyProfileController @responsible_candidates = profile.members.by_role(profile.roles.reject {|r| !r.has_permission?('perform_task')}) if profile.organization? @view_only = !current_person.has_permission?(:perform_task, profile) + + @params_tags = [] + params.each do |key,value| + if key =~ /filter_/ && value + @params_tags << view_context.hidden_field_tag(key, value) + end + end + end def processed diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 6eb8533..dd3951a 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -46,6 +46,16 @@
<% else %> <%= form_tag :action => 'close' do%> + + <% if !@params_tags.empty? %> ++ <% @params_tags.each do |hidden_tag| %> + + <%= hidden_tag %> + <% end %> +
+ <% end %> + <% button_bar(:class => 'task-actions') do %> <%# FiXME button(:edit, _('View my requests'), :action => 'list_requested') %> <%# FIXME button('menu-mail', _('Send request'), :action => 'new') %> diff --git a/test/functional/tasks_controller_test.rb b/test/functional/tasks_controller_test.rb index 5d97172..8c5c81a 100644 --- a/test/functional/tasks_controller_test.rb +++ b/test/functional/tasks_controller_test.rb @@ -12,7 +12,7 @@ class TasksControllerTest < ActionController::TestCase @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - self.profile = create_user('testuser').person + self.profile = create_user('testuser', :email => 'testuser@email.com').person @controller.stubs(:profile).returns(profile) login_as 'testuser' end @@ -77,7 +77,12 @@ class TasksControllerTest < ActionController::TestCase end should 'keep filters after close a task' do - t = profile.tasks.build; t.save! + requestor = User.create!(:login => 'john', :email => 'john@example.com', :password => 'test', :password_confirmation => 'test') + c = Community.create!(:name => 'test comm', :identifier => 'test_comm', :moderated_articles => false) + t = InviteMember.create!(:requestor => requestor.person, :target => profile, :spam => false, :community_id => c.id) + + get :index, :filter_type => t.type + assert_tag_in_string(assigns(:params_tags).join(' '), :tag => 'input', :attributes => { :value => 'InviteMember' }) post :close, :tasks => {t.id => {:decision => 'finish', :task => {}}}, :filter_type => t.type assert_redirected_to :action => 'index', :filter_type => t.type -- libgit2 0.21.2