From 3b63b2e9bea49212065378b207df4d772343b68a Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Sat, 30 May 2015 19:30:44 -0300 Subject: [PATCH] removing reponsible filter from person task management --- app/controllers/my_profile/tasks_controller.rb | 2 +- app/views/tasks/index.html.erb | 8 +++++--- test/functional/tasks_controller_test.rb | 9 +++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/controllers/my_profile/tasks_controller.rb b/app/controllers/my_profile/tasks_controller.rb index 9cebc23..343bed9 100644 --- a/app/controllers/my_profile/tasks_controller.rb +++ b/app/controllers/my_profile/tasks_controller.rb @@ -14,7 +14,7 @@ class TasksController < MyProfileController @failed = params ? params[:failed] : {} - @responsible_candidates = profile.members.by_role(profile.roles.reject {|r| !r.has_permission?('perform_task')}) + @responsible_candidates = profile.members.by_role(profile.roles.reject {|r| !r.has_permission?('perform_task')}) if profile.organization? end def processed diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 301e931..efd4694 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -29,9 +29,11 @@

<%= labelled_text_field(_("Text filter")+': ', :filter_text, nil, {:id => 'filter-text',:value => @filter_text}) %>

-

- <%= labelled_select(_('Assigned to')+': ', :filter_responsible, :id, :name, @filter_responsible, [OpenStruct.new(:name => _('All'), :id => nil), OpenStruct.new(:name => _('Unassigned'), :id => -1)] + @responsible_candidates) %> -

+ <% if profile.organization? %> +

+ <%= labelled_select(_('Assigned to')+': ', :filter_responsible, :id, :name, @filter_responsible, [OpenStruct.new(:name => _('All'), :id => nil), OpenStruct.new(:name => _('Unassigned'), :id => -1)] + @responsible_candidates, :class => 'filter_responsible') %> +

+ <% end %>

<%= submit_button(:search, _('Search')) %>

diff --git a/test/functional/tasks_controller_test.rb b/test/functional/tasks_controller_test.rb index dc06032..5c2090c 100644 --- a/test/functional/tasks_controller_test.rb +++ b/test/functional/tasks_controller_test.rb @@ -466,6 +466,15 @@ class TasksControllerTest < ActionController::TestCase assert_select '.task_responsible', 0 end + should 'do not display responsible assignment filter if profile is not an organization' do + profile = create_user('personprofile').person + @controller.stubs(:profile).returns(profile) + login_as profile.user.login + get :index + + assert_select '.filter_responsible', 0 + end + should 'display responsible assignment if profile is an organization' do profile = fast_create(Community) person1 = create_user('person1').person -- libgit2 0.21.2