From f81e1192834031b5f0a9ef22460c740df5dd55a5 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Fri, 6 Sep 2024 00:19:53 +0200 Subject: [PATCH] Display number of points found on the Points page --- app/controllers/points_controller.rb | 2 ++ app/views/points/index.html.erb | 3 +++ 2 files changed, 5 insertions(+) diff --git a/app/controllers/points_controller.rb b/app/controllers/points_controller.rb index 7043a48a..20aa37bc 100644 --- a/app/controllers/points_controller.rb +++ b/app/controllers/points_controller.rb @@ -17,6 +17,8 @@ class PointsController < ApplicationController @start_at = Time.zone.at(start_at) @end_at = Time.zone.at(end_at) + + @points_number = @points.except(:limit, :offset).size end def bulk_destroy diff --git a/app/views/points/index.html.erb b/app/views/points/index.html.erb index 2f57e6bd..f83be405 100644 --- a/app/views/points/index.html.erb +++ b/app/views/points/index.html.erb @@ -43,6 +43,9 @@
<%= f.submit "Delete Selected", class: "px-4 py-2 bg-red-500 text-white rounded-md", data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?" } %> +
+ <%= @points_number %> points found +
Order by: <%= link_to 'Newest', points_path(order_by: :desc), class: 'btn btn-xs btn-primary mx-1' %>