Commit 3b63b2e9bea49212065378b207df4d772343b68a
1 parent
eedb7167
Exists in
master
and in
29 other branches
removing reponsible filter from person task management
Showing
3 changed files
with
15 additions
and
4 deletions
Show diff stats
app/controllers/my_profile/tasks_controller.rb
| @@ -14,7 +14,7 @@ class TasksController < MyProfileController | @@ -14,7 +14,7 @@ class TasksController < MyProfileController | ||
| 14 | 14 | ||
| 15 | @failed = params ? params[:failed] : {} | 15 | @failed = params ? params[:failed] : {} |
| 16 | 16 | ||
| 17 | - @responsible_candidates = profile.members.by_role(profile.roles.reject {|r| !r.has_permission?('perform_task')}) | 17 | + @responsible_candidates = profile.members.by_role(profile.roles.reject {|r| !r.has_permission?('perform_task')}) if profile.organization? |
| 18 | end | 18 | end |
| 19 | 19 | ||
| 20 | def processed | 20 | def processed |
app/views/tasks/index.html.erb
| @@ -29,9 +29,11 @@ | @@ -29,9 +29,11 @@ | ||
| 29 | <p> | 29 | <p> |
| 30 | <%= labelled_text_field(_("Text filter")+': ', :filter_text, nil, {:id => 'filter-text',:value => @filter_text}) %> | 30 | <%= labelled_text_field(_("Text filter")+': ', :filter_text, nil, {:id => 'filter-text',:value => @filter_text}) %> |
| 31 | </p> | 31 | </p> |
| 32 | - <p> | ||
| 33 | - <%= labelled_select(_('Assigned to')+': ', :filter_responsible, :id, :name, @filter_responsible, [OpenStruct.new(:name => _('All'), :id => nil), OpenStruct.new(:name => _('Unassigned'), :id => -1)] + @responsible_candidates) %> | ||
| 34 | - </p> | 32 | + <% if profile.organization? %> |
| 33 | + <p> | ||
| 34 | + <%= 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') %> | ||
| 35 | + </p> | ||
| 36 | + <% end %> | ||
| 35 | <p> | 37 | <p> |
| 36 | <%= submit_button(:search, _('Search')) %> | 38 | <%= submit_button(:search, _('Search')) %> |
| 37 | </p> | 39 | </p> |
test/functional/tasks_controller_test.rb
| @@ -466,6 +466,15 @@ class TasksControllerTest < ActionController::TestCase | @@ -466,6 +466,15 @@ class TasksControllerTest < ActionController::TestCase | ||
| 466 | assert_select '.task_responsible', 0 | 466 | assert_select '.task_responsible', 0 |
| 467 | end | 467 | end |
| 468 | 468 | ||
| 469 | + should 'do not display responsible assignment filter if profile is not an organization' do | ||
| 470 | + profile = create_user('personprofile').person | ||
| 471 | + @controller.stubs(:profile).returns(profile) | ||
| 472 | + login_as profile.user.login | ||
| 473 | + get :index | ||
| 474 | + | ||
| 475 | + assert_select '.filter_responsible', 0 | ||
| 476 | + end | ||
| 477 | + | ||
| 469 | should 'display responsible assignment if profile is an organization' do | 478 | should 'display responsible assignment if profile is an organization' do |
| 470 | profile = fast_create(Community) | 479 | profile = fast_create(Community) |
| 471 | person1 = create_user('person1').person | 480 | person1 = create_user('person1').person |