From 7f61cbe31e70ea9a8bfbf57da6f7f4161ffcaaf0 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Sat, 28 Sep 2024 17:29:56 +0200 Subject: [PATCH] Fix point page reloads when searching for points --- CHANGELOG.md | 1 + app/controllers/points_controller.rb | 6 +++--- app/views/points/index.html.erb | 2 +- app/views/shared/_navbar.html.erb | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a11e5d40..d4127e99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Deleting points from the Points page now preserves `start_at` and `end_at` values for the routes. #261 - Visits map now being rendered correctly in the Visits page. #262 - Fixed issue with timezones for negative UTC offsets. #194, #122 +- Point page is no longer reloads losing provided timestamps when searching for points on Points page. #283 ### Changed diff --git a/app/controllers/points_controller.rb b/app/controllers/points_controller.rb index 8947f475..6acc6080 100644 --- a/app/controllers/points_controller.rb +++ b/app/controllers/points_controller.rb @@ -44,14 +44,14 @@ class PointsController < ApplicationController end def points - params[:import_id] ? points_from_import : points_from_user + params[:import_id].present? ? import_points : user_points end - def points_from_import + def import_points current_user.imports.find(params[:import_id]).points end - def points_from_user + def user_points current_user.tracked_points end diff --git a/app/views/points/index.html.erb b/app/views/points/index.html.erb index f2ec6809..892130a5 100644 --- a/app/views/points/index.html.erb +++ b/app/views/points/index.html.erb @@ -1,7 +1,7 @@ <% content_for :title, 'Points' %>
- <%= form_with url: points_path(import_id: params[:import_id]), method: :get do |f| %> + <%= form_with url: points_path(import_id: params[:import_id]), data: { turbo_method: :get }, method: :get do |f| %>
diff --git a/app/views/shared/_navbar.html.erb b/app/views/shared/_navbar.html.erb index 6074ec1d..fe960894 100644 --- a/app/views/shared/_navbar.html.erb +++ b/app/views/shared/_navbar.html.erb @@ -9,7 +9,7 @@
  • <%= link_to 'Points', points_url, class: "#{active_class?(points_url)}" %>
  • <%= link_to 'Stats', stats_url, class: "#{active_class?(stats_url)}" %>
  • <%= link_to 'Visitsβ'.html_safe, visits_url(status: :confirmed), class: "#{active_class?(visits_url)}" %>
  • -
  • <%= link_to 'Places', places_url, class: "#{active_class?(places_url)}" %>
  • +
  • <%= link_to 'Placesβ', places_url, class: "#{active_class?(places_url)}" %>
  • <%= link_to 'Imports', imports_url, class: "#{active_class?(imports_url)}" %>
  • <%= link_to 'Exports', exports_url, class: "#{active_class?(exports_url)}" %>
  • @@ -44,7 +44,7 @@
  • <%= link_to 'Points', points_url, class: "#{active_class?(points_url)}" %>
  • <%= link_to 'Stats', stats_url, class: "#{active_class?(stats_url)}" %>
  • <%= link_to 'Visitsβ'.html_safe, visits_url(status: :confirmed), class: "#{active_class?(visits_url)}" %>
  • -
  • <%= link_to 'Places', places_url, class: "#{active_class?(places_url)}" %>
  • +
  • <%= link_to 'Placesβ', places_url, class: "#{active_class?(places_url)}" %>
  • <%= link_to 'Imports', imports_url, class: "#{active_class?(imports_url)}" %>
  • <%= link_to 'Exports', exports_url, class: "#{active_class?(exports_url)}" %>