Files
grecia/app/components/budgets/investments/map_component.rb
Senén Rodero Rodríguez 3fa3c90db6 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.
2023-06-26 20:33:35 +02:00

35 lines
702 B
Ruby

class Budgets::Investments::MapComponent < ApplicationComponent
attr_reader :heading, :investments
delegate :render_map, to: :helpers
def initialize(investments, heading:)
@investments = investments
@heading = heading
end
def render?
map_location&.available?
end
private
def map_location
MapLocation.from_heading(heading) if heading.present?
end
def coordinates
MapLocation.investments_json_data(investments.unscope(:order))
end
def geozones_data
return unless heading.geozone.present?
[
{
outline_points: heading.geozone.outline_points,
color: heading.geozone.color
}
]
end
end