Merge pull request #5390 Geozone Admin maps
This makes it easier to see if Geojson has been imported correctly.
This commit is contained in:
@@ -29,3 +29,10 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h3><%= t("admin.geozones.index.geojson_map") %></h3>
|
||||||
|
<p class="help-text"><%= t("admin.geozones.index.geojson_map_help") %></p>
|
||||||
|
|
||||||
|
<%= render Shared::MapLocationComponent.new(nil, geozones_data: geozones_data) %>
|
||||||
|
</section>
|
||||||
|
|||||||
@@ -19,4 +19,14 @@ class Admin::Geozones::IndexComponent < ApplicationComponent
|
|||||||
t("shared.no")
|
t("shared.no")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def geozones_data
|
||||||
|
geozones.map do |geozone|
|
||||||
|
{
|
||||||
|
outline_points: geozone.outline_points,
|
||||||
|
color: geozone.color,
|
||||||
|
headings: [link_to(geozone.name, edit_admin_geozone_path(geozone))]
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1400,6 +1400,8 @@ en:
|
|||||||
index:
|
index:
|
||||||
title: Geozone
|
title: Geozone
|
||||||
create: Create geozone
|
create: Create geozone
|
||||||
|
geojson_map: GeoJSON Map
|
||||||
|
geojson_map_help: "If GeoJSON coordinates are available they will be displayed on the map below"
|
||||||
geozone:
|
geozone:
|
||||||
name: Name
|
name: Name
|
||||||
external_code: External code
|
external_code: External code
|
||||||
|
|||||||
@@ -1400,6 +1400,8 @@ es:
|
|||||||
index:
|
index:
|
||||||
title: Zonas
|
title: Zonas
|
||||||
create: Crear una zona
|
create: Crear una zona
|
||||||
|
geojson_map: Mapa GeoJSON
|
||||||
|
geojson_map_help: "Si las coordenadas GeoJSON están disponibles, aparecerán en el siguiente mapa"
|
||||||
geozone:
|
geozone:
|
||||||
name: Nombre
|
name: Nombre
|
||||||
external_code: Código externo
|
external_code: Código externo
|
||||||
|
|||||||
@@ -142,4 +142,18 @@ describe "Admin geozones", :admin do
|
|||||||
expect(page).to have_link "Area 51", href: budget_investments_path(budget, heading_id: heading.id)
|
expect(page).to have_link "Area 51", href: budget_investments_path(budget, heading_id: heading.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "Show polygons on geozone admin view" do
|
||||||
|
Setting["feature.map"] = true
|
||||||
|
geojson = '{ "geometry": { "type": "Polygon", "coordinates": [[-0.1,51.5],[-0.2,51.4],[-0.3,51.6]] } }'
|
||||||
|
geozone = create(:geozone, name: "Polygon me!", geojson: geojson)
|
||||||
|
|
||||||
|
visit admin_geozones_path
|
||||||
|
|
||||||
|
find(".map-polygon").click
|
||||||
|
|
||||||
|
within ".map-location" do
|
||||||
|
expect(page).to have_link "Polygon me!", href: edit_admin_geozone_path(geozone)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user