From: Anton Khorev Date: Tue, 26 Mar 2024 02:19:46 +0000 (+0300) Subject: Add found users count to users page X-Git-Tag: live~691^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/f0d05c20ae4cbf05eac73ece0d0357bc2c33bbad Add found users count to users page --- diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b9f1af807..c55a177b4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -36,6 +36,7 @@ class UsersController < ApplicationController users = users.where(:status => @params[:status]) if @params[:status] users = users.where(:creation_ip => @params[:ip]) if @params[:ip] + @users_count = users.count @users, @newer_users_id, @older_users_id = get_page_items(users, :limit => 50) end end diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 22a916c8b..e8031900f 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -10,11 +10,18 @@ <% unless @users.empty? %> <%= form_tag do %> - <%= render "shared/pagination", - :newer_key => "users.index.newer", - :older_key => "users.index.older", - :newer_id => @newer_users_id, - :older_id => @older_users_id %> +
+
+ <%= render "shared/pagination", + :newer_key => "users.index.newer", + :older_key => "users.index.older", + :newer_id => @newer_users_id, + :older_id => @older_users_id %> +
+
+ <%= t ".found_users", :count => @users_count %> +
+
<%= hidden_field_tag :status, params[:status] if params[:status] %> <%= hidden_field_tag :ip, params[:ip] if params[:ip] %> @@ -32,11 +39,18 @@ <%= render @users %> - <%= render "shared/pagination", - :newer_key => "users.index.newer", - :older_key => "users.index.older", - :newer_id => @newer_users_id, - :older_id => @older_users_id %> +
+
+ <%= render "shared/pagination", + :newer_key => "users.index.newer", + :older_key => "users.index.older", + :newer_id => @newer_users_id, + :older_id => @older_users_id %> +
+
+ <%= t ".found_users", :count => @users_count %> +
+
<%= submit_tag t(".confirm"), :name => "confirm", :class => "btn btn-primary" %> diff --git a/config/locales/en.yml b/config/locales/en.yml index a173a7e4f..ec5e54442 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2834,6 +2834,9 @@ en: heading: Users older: "Older Users" newer: "Newer Users" + found_users: + one: "%{count} user found" + other: "%{count} users found" summary_html: "%{name} created from %{ip_address} on %{date}" summary_no_ip_html: "%{name} created on %{date}" confirm: Confirm Selected Users