Fix map markers navigation for keyboard users

By using the bindPopup function instead of the click event
popups work when using the keyboard.

Note that now we are loading all the map markers in the first
request in a single query to the database (needed when there
is a lot or markers to show). Because of that we removed the
AJAX endpoint.
This commit is contained in:
Senén Rodero Rodríguez
2023-06-16 15:48:57 +02:00
parent 2b0a812543
commit 3fa3c90db6
7 changed files with 28 additions and 39 deletions

View File

@@ -11,12 +11,11 @@ module Budgets
PER_PAGE = 10
before_action :authenticate_user!, except: [:index, :show, :json_data]
before_action :load_budget, except: :json_data
before_action :authenticate_user!, except: [:index, :show]
before_action :load_budget
authorize_resource :budget, except: :json_data
load_and_authorize_resource :investment, through: :budget, class: "Budget::Investment",
except: :json_data
authorize_resource :budget
load_and_authorize_resource :investment, through: :budget, class: "Budget::Investment"
before_action :load_ballot, only: [:index, :show]
before_action :load_heading, only: [:index, :show]
@@ -25,8 +24,6 @@ module Budgets
before_action :set_default_investment_filter, only: :index
before_action :set_view, only: :index
skip_authorization_check only: :json_data
feature_flag :budgets
has_orders %w[most_voted newest oldest], only: :show
@@ -91,19 +88,6 @@ module Budgets
super
end
def json_data
investment = Budget::Investment.find(params[:id])
data = {
investment_id: investment.id,
investment_title: investment.title,
budget_id: investment.budget.id
}.to_json
respond_to do |format|
format.json { render json: data }
end
end
private
def resource_model