diff --git a/app/cells/user_filter_cell.rb b/app/cells/user_filter_cell.rb index a7cf34c09f..0221c54b14 100644 --- a/app/cells/user_filter_cell.rb +++ b/app/cells/user_filter_cell.rb @@ -14,6 +14,10 @@ class UserFilterCell < RailsCell .first end + def is_filtered(params) + [:name, :status, :group_id, :role_id].any? { |name| params[name].present? } + end + ## # Returns the selected status from the parameters # or the default status to be filtered by (active) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index bc36042771..1c908daacc 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -190,6 +190,7 @@ class MembersController < ApplicationController def set_index_data! set_roles_and_principles! + @is_filtered = Members::UserFilterCell.is_filtered params @members = Members::UserFilterCell.filter index_members(@project), params @members_table_options = members_table_options @roles @members_filter_options = members_filter_options @roles diff --git a/app/views/members/index.html.erb b/app/views/members/index.html.erb index 810fec238d..d40ec3c88a 100644 --- a/app/views/members/index.html.erb +++ b/app/views/members/index.html.erb @@ -65,10 +65,11 @@ See doc/COPYRIGHT.rdoc for more details.
+ <%= cell Members::UserFilterCell, params, @members_filter_options %> <% if any_members %> - <%= cell Members::UserFilterCell, params, @members_filter_options %> -   <%= cell Members::TableCell, @members, @members_table_options %> + <% elsif @is_filtered %> + <%= no_results_box custom_title: t(:notice_no_principals_found) %> <% else %> <%= no_results_box %> <% end %>