diff --git a/app/models/metadata_color.rb b/app/models/metadata_color.rb new file mode 100644 index 0000000..ce35921 --- /dev/null +++ b/app/models/metadata_color.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +# Un campo de correo +# TODO: Validar que tenga un formato correo +class MetadataString < MetadataString; end diff --git a/app/models/metadata_email.rb b/app/models/metadata_email.rb index 18ee239..ce35921 100644 --- a/app/models/metadata_email.rb +++ b/app/models/metadata_email.rb @@ -2,13 +2,4 @@ # 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 +class MetadataString < MetadataString; end diff --git a/app/views/posts/attribute_ro/_color.haml b/app/views/posts/attribute_ro/_color.haml new file mode 100644 index 0000000..787aacd --- /dev/null +++ b/app/views/posts/attribute_ro/_color.haml @@ -0,0 +1,3 @@ +%tr{ id: attribute } + %th= post_label_t(attribute, post: post) + %td{ style: "background-color: #{metadata.value}" } = metadata.value diff --git a/app/views/posts/attributes/_color.haml b/app/views/posts/attributes/_color.haml new file mode 100644 index 0000000..a294501 --- /dev/null +++ b/app/views/posts/attributes/_color.haml @@ -0,0 +1,6 @@ +.form-group + = label_tag "post_#{attribute}", post_label_t(attribute, post: post) + = color_field 'post', attribute, value: metadata.value, + **field_options(attribute, metadata) + = render 'posts/attribute_feedback', + post: post, attribute: attribute, metadata: metadata