diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ba6ce1f..0b05d131 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Exported files will now always have an extension when downloaded. Previously, the extension was missing in case of GPX export. +- Deleting and sorting points on the Points page will now preserve filtering and sorting params when points are deleted or sorted. Previously, the page was being reloaded and filtering and sorting params were lost. # 0.16.3 - 2024-11-10 diff --git a/app/controllers/points_controller.rb b/app/controllers/points_controller.rb index 6acc6080..55d56315 100644 --- a/app/controllers/points_controller.rb +++ b/app/controllers/points_controller.rb @@ -19,7 +19,6 @@ class PointsController < ApplicationController def bulk_destroy current_user.tracked_points.where(id: params[:point_ids].compact).destroy_all - redirect_to points_url(preserved_params), notice: 'Points were successfully destroyed.', status: :see_other diff --git a/app/views/points/index.html.erb b/app/views/points/index.html.erb index 892130a5..bf39cf6b 100644 --- a/app/views/points/index.html.erb +++ b/app/views/points/index.html.erb @@ -45,7 +45,7 @@
- <%= form_with url: bulk_destroy_points_path, method: :delete, id: :bulk_destroy_form do |f| %> + <%= form_with url: bulk_destroy_points_path(params.permit!), method: :delete, id: :bulk_destroy_form do |f| %>
<%= 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?" } %> @@ -54,8 +54,8 @@
Order by: - <%= link_to 'Newest', points_path(order_by: :desc, import_id: params[:import_id]), class: 'btn btn-xs btn-primary mx-1' %> - <%= link_to 'Oldest', points_path(order_by: :asc, import_id: params[:import_id]), class: 'btn btn-xs btn-primary mx-1' %> + <%= link_to 'Newest', points_path(order_by: :desc, import_id: params[:import_id], start_at: params[:start_at], end_at: params[:end_at]), class: 'btn btn-xs btn-primary mx-1' %> + <%= link_to 'Oldest', points_path(order_by: :asc, import_id: params[:import_id], start_at: params[:start_at], end_at: params[:end_at]), class: 'btn btn-xs btn-primary mx-1' %>