Fix point page reloads when searching for points

This commit is contained in:
Eugene Burmakin 2024-09-28 17:29:56 +02:00
parent 04d5bbac8f
commit 7f61cbe31e
4 changed files with 7 additions and 6 deletions

View file

@ -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

View file

@ -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

View file

@ -1,7 +1,7 @@
<% content_for :title, 'Points' %>
<div class="w-full">
<%= 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| %>
<div class="flex flex-col md:flex-row md:space-x-4 md:items-end">
<div class="w-full md:w-2/12">
<div class="flex flex-col space-y-2">

View file

@ -9,7 +9,7 @@
<li><%= link_to 'Points', points_url, class: "#{active_class?(points_url)}" %></li>
<li><%= link_to 'Stats', stats_url, class: "#{active_class?(stats_url)}" %></li>
<li><%= link_to 'Visits<sup>β</sup>'.html_safe, visits_url(status: :confirmed), class: "#{active_class?(visits_url)}" %></li>
<li><%= link_to 'Places', places_url, class: "#{active_class?(places_url)}" %></li>
<li><%= link_to 'Places<sup>β</sup>', places_url, class: "#{active_class?(places_url)}" %></li>
<li><%= link_to 'Imports', imports_url, class: "#{active_class?(imports_url)}" %></li>
<li><%= link_to 'Exports', exports_url, class: "#{active_class?(exports_url)}" %></li>
</ul>
@ -44,7 +44,7 @@
<li><%= link_to 'Points', points_url, class: "#{active_class?(points_url)}" %></li>
<li><%= link_to 'Stats', stats_url, class: "#{active_class?(stats_url)}" %></li>
<li><%= link_to 'Visits<sup>β</sup>'.html_safe, visits_url(status: :confirmed), class: "#{active_class?(visits_url)}" %></li>
<li><%= link_to 'Places', places_url, class: "#{active_class?(places_url)}" %></li>
<li><%= link_to 'Places<sup>β</sup>', places_url, class: "#{active_class?(places_url)}" %></li>
<li><%= link_to 'Imports', imports_url, class: "#{active_class?(imports_url)}" %></li>
<li><%= link_to 'Exports', exports_url, class: "#{active_class?(exports_url)}" %></li>
</ul>