This commit is contained in:
parent
14efee286f
commit
597daceb5b
3 changed files with 24 additions and 0 deletions
14
app/models/metadata_email.rb
Normal file
14
app/models/metadata_email.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Un campo de correo
|
||||
# TODO: Validar que tenga un formato correo
|
||||
class MetadataString < MetadataTemplate
|
||||
# Una string vacía
|
||||
def default_value
|
||||
''
|
||||
end
|
||||
|
||||
def value
|
||||
super.strip
|
||||
end
|
||||
end
|
4
app/views/posts/attribute_ro/_email.haml
Normal file
4
app/views/posts/attribute_ro/_email.haml
Normal file
|
@ -0,0 +1,4 @@
|
|||
%tr{ id: attribute }
|
||||
%th= post_label_t(attribute, post: post)
|
||||
%td
|
||||
%a{ href: "mailto:#{metadata.value}" }= metadata.value
|
6
app/views/posts/attributes/_email.haml
Normal file
6
app/views/posts/attributes/_email.haml
Normal file
|
@ -0,0 +1,6 @@
|
|||
.form-group
|
||||
= label_tag "post_#{attribute}", post_label_t(attribute, post: post)
|
||||
= email_field 'post', attribute, value: metadata.value,
|
||||
**field_options(attribute, metadata)
|
||||
= render 'posts/attribute_feedback',
|
||||
post: post, attribute: attribute, metadata: metadata
|
Loading…
Reference in a new issue