From 642a3f7d76a4b9c9e0d7a89035a70edf7e2567e2 Mon Sep 17 00:00:00 2001 From: Brandon Date: Fri, 1 Nov 2024 19:29:41 -0400 Subject: [PATCH] added html elements for pagination --- app/controllers/users_controller.rb | 4 ++-- app/views/users/list.html.erb | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4f037de8a44..86e6ad8ad3a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -270,8 +270,8 @@ def paginate_list @search_by = params[:search_by] # Sets the number of users to display per page based on the 'per_page' parameter from the request. - # If no 'per_page' parameter is provided, it defaults to '4', which corresponds to displaying all users on one page. - @per_page = '3' + # If no 'per_page' parameter is provided, it defaults to '3', which corresponds to displaying all users on one page. + @per_page = params[:per_page] || '3' # search for corresponding users # users = User.search_users(role, user_id, letter, @search_by) diff --git a/app/views/users/list.html.erb b/app/views/users/list.html.erb index 57422087b6b..177bf7391f0 100644 --- a/app/views/users/list.html.erb +++ b/app/views/users/list.html.erb @@ -8,16 +8,22 @@ <%= form_tag :action => 'list', :paginate_show => '1', :num_users => @per_page do %> <%= label_tag :letter, 'Search users: ' %><%= text_field_tag(:letter,params[:letter]) %> -<%= select_tag(:search_by, options_for_select([['Username', 1], ['Full name', 2], ['Email', 3]])) %> +<%= select_tag(:search_by, options_for_select([['Username', 1], ['Name', 2], ['Email', 3]])) %> <%= submit_tag("Search") %> <% end %> +<%= form_tag :action => 'list', :paginate_show => '1', :num_users => @per_page do %> + <%= label_tag :letter, 'Number of users displayed per page' %><%= text_field_tag(:letter,params[:per_page]) %> +<%= select_tag(:search_by, options_for_select([['25 users', 1], ['50 users', 2], ['100 users', 3], ['All users', 4]])) %> +<%= submit_tag("List") %> +<% end %> + <%= render :partial => 'links' %>
- + <% @paginated_users.each do |user| %> <% if (params[:show] != 'true' && !user.username(session[:ip]).include?("_hidden")) || params[:show] == 'true'%>
E-mail on ...
User NameFull NameEmail AddressRoleParentReviewSubmissionMeta-reviewDelete
User NameNameEmail AddressRoleParentReviewSubmissionMeta-reviewDelete