Remove editable parameter in render_map
The calls to `render_map` are confusing since there are so many parameters. We can assume that the map is editable if we pass the remove marker label.
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
class Shared::MapLocationComponent < ApplicationComponent
|
||||
attr_reader :parent_class, :editable, :remove_marker_label, :investments_coordinates
|
||||
attr_reader :parent_class, :remove_marker_label, :investments_coordinates
|
||||
delegate :map_location_input_id, to: :helpers
|
||||
|
||||
def initialize(map_location, parent_class, editable, remove_marker_label, investments_coordinates = nil)
|
||||
def initialize(map_location, parent_class, remove_marker_label, investments_coordinates = nil)
|
||||
@map_location = map_location
|
||||
@parent_class = parent_class
|
||||
@editable = editable
|
||||
@remove_marker_label = remove_marker_label
|
||||
@investments_coordinates = investments_coordinates
|
||||
end
|
||||
@@ -16,6 +15,10 @@ class Shared::MapLocationComponent < ApplicationComponent
|
||||
|
||||
private
|
||||
|
||||
def editable?
|
||||
remove_marker_label.present?
|
||||
end
|
||||
|
||||
def latitude
|
||||
map_location.latitude.presence || Setting["map.latitude"]
|
||||
end
|
||||
@@ -48,7 +51,7 @@ class Shared::MapLocationComponent < ApplicationComponent
|
||||
map_zoom: zoom,
|
||||
map_tiles_provider: Rails.application.secrets.map_tiles_provider,
|
||||
map_tiles_provider_attribution: Rails.application.secrets.map_tiles_provider_attribution,
|
||||
marker_editable: editable,
|
||||
marker_editable: editable?,
|
||||
marker_remove_selector: "##{remove_marker_link_id}",
|
||||
latitude_input_selector: "##{map_location_input_id(parent_class, "latitude")}",
|
||||
longitude_input_selector: "##{map_location_input_id(parent_class, "longitude")}",
|
||||
|
||||
Reference in New Issue
Block a user