fix(geopoint_field): no geoportail link without coordinates

This commit is contained in:
Colin Darie 2022-09-05 12:33:16 +02:00
parent 3c9b41e233
commit 3cb25e8393
2 changed files with 5 additions and 1 deletions

View file

@ -8,4 +8,8 @@ class GeopointField < Administrate::Field::Base
def lng def lng
data.last data.last
end end
def present?
lat.present? && lng.present?
end
end end

View file

@ -1,2 +1,2 @@
- if field.data.present? - if field.present?
= link_to field.data.join(", "), "https://www.geoportail.gouv.fr/carte?c=#{field.lng},#{field.lat}&z=17&permalink=yes", target: '_blank', rel: 'noopener' = link_to field.data.join(", "), "https://www.geoportail.gouv.fr/carte?c=#{field.lng},#{field.lat}&z=17&permalink=yes", target: '_blank', rel: 'noopener'