Added layer control to map to allow each geozone display to be toggled on/off
Note we're adding a `name` property to the geozones investments sidebar map even if we don't render the geozones in the map, in order to simplify the JavaScript function `geozoneLayers`.
This commit is contained in:
@@ -25,7 +25,8 @@ class Admin::Geozones::IndexComponent < ApplicationComponent
|
||||
{
|
||||
outline_points: geozone.outline_points,
|
||||
color: geozone.color,
|
||||
headings: [link_to(geozone.name, edit_admin_geozone_path(geozone))]
|
||||
headings: [link_to(geozone.name, edit_admin_geozone_path(geozone))],
|
||||
name: geozone.name
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,7 +27,8 @@ class Budgets::Investments::MapComponent < ApplicationComponent
|
||||
[
|
||||
{
|
||||
outline_points: heading.geozone.outline_points,
|
||||
color: heading.geozone.color
|
||||
color: heading.geozone.color,
|
||||
name: heading.name
|
||||
}
|
||||
]
|
||||
end
|
||||
|
||||
@@ -27,10 +27,15 @@ class Budgets::MapComponent < ApplicationComponent
|
||||
{
|
||||
outline_points: geozone.outline_points,
|
||||
color: geozone.color,
|
||||
headings: budget.headings.where(geozone: geozone).map do |heading|
|
||||
headings: geozone_headings(geozone).map do |heading|
|
||||
link_to heading.name, budget_investments_path(budget, heading_id: heading.id)
|
||||
end
|
||||
end,
|
||||
name: geozone_headings(geozone).map(&:name).join(", ")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def geozone_headings(geozone)
|
||||
budget.headings.where(geozone: geozone)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user