fix(geopoint_field): no geoportail link without coordinates
This commit is contained in:
parent
3c9b41e233
commit
3cb25e8393
2 changed files with 5 additions and 1 deletions
|
@ -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
|
||||||
|
|
|
@ -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'
|
||||||
|
|
Loading…
Reference in a new issue