Merge branch 'rails' into anonymous

This commit is contained in:
f 2020-02-16 19:52:19 -03:00
commit ce805de4cc
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D
5 changed files with 57 additions and 0 deletions

View file

@ -0,0 +1,23 @@
# frozen_string_literal: true
# Define un campo de coordenadas geográficas
class MetadataGeo < MetadataTemplate
def default_value
{ 'lat' => nil, 'lng' => nil }
end
def empty?
value == default_value
end
def to_param
{ name => %i[lat lng] }
end
def save
self[:value] = {
'lat' => self[:value]['lat'].to_f,
'lng' => self[:value]['lng'].to_f
}
end
end

View file

@ -0,0 +1,9 @@
- lat = metadata.value['lat']
- lng = metadata.value['lng']
%tr{ id: attribute }
%th= post_label_t(attribute, post: post)
%td
= link_to t('posts.attributes.geo.uri'), "geo:#{lat},#{lng}"
%br/
= link_to t('posts.attributes.geo.osm'),
"https://www.openstreetmap.org/?mlat=#{lat}&mlon=#{lng}#map=9/#{lat}/#{lng}"

View file

@ -0,0 +1,19 @@
.row
.col
.form-group
= label_tag "post_#{attribute}_lat",
post_label_t(attribute, :lat, post: post)
= text_field(*field_name_for('post', attribute, :lat),
value: metadata.value['lat'],
**field_options(attribute, metadata))
= render 'posts/attribute_feedback',
post: post, attribute: [attribute, :lat], metadata: metadata
.col
.form-group
= label_tag "post_#{attribute}_lng",
post_label_t(attribute, :lng, post: post)
= text_field(*field_name_for('post', attribute, :lng),
value: metadata.value['lng'],
**field_options(attribute, metadata))
= render 'posts/attribute_feedback',
post: post, attribute: [attribute, :lat], metadata: metadata

View file

@ -365,6 +365,9 @@ en:
feedback: 'This field cannot be empty!'
uuid:
label: 'Unique identifier'
geo:
uri: 'Open in app'
osm: 'Open in web map'
reorder: 'Reorder posts'
sort:
by: 'Sort by'

View file

@ -373,6 +373,9 @@ es:
feedback: '¡Este campo no puede estar vacío!'
uuid:
label: 'Identificador único'
geo:
uri: 'Abrir en aplicación'
osm: 'Abrir en mapa web'
reorder: 'Reordenar artículos'
sort:
by: 'Ordenar por'