mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 11:26:21 +00:00
color
This commit is contained in:
parent
597daceb5b
commit
55a37edae0
4 changed files with 15 additions and 10 deletions
5
app/models/metadata_color.rb
Normal file
5
app/models/metadata_color.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Un campo de correo
|
||||||
|
# TODO: Validar que tenga un formato correo
|
||||||
|
class MetadataString < MetadataString; end
|
|
@ -2,13 +2,4 @@
|
||||||
|
|
||||||
# Un campo de correo
|
# Un campo de correo
|
||||||
# TODO: Validar que tenga un formato correo
|
# TODO: Validar que tenga un formato correo
|
||||||
class MetadataString < MetadataTemplate
|
class MetadataString < MetadataString; end
|
||||||
# Una string vacía
|
|
||||||
def default_value
|
|
||||||
''
|
|
||||||
end
|
|
||||||
|
|
||||||
def value
|
|
||||||
super.strip
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
3
app/views/posts/attribute_ro/_color.haml
Normal file
3
app/views/posts/attribute_ro/_color.haml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
%tr{ id: attribute }
|
||||||
|
%th= post_label_t(attribute, post: post)
|
||||||
|
%td{ style: "background-color: #{metadata.value}" } = metadata.value
|
6
app/views/posts/attributes/_color.haml
Normal file
6
app/views/posts/attributes/_color.haml
Normal file
|
@ -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
|
Loading…
Reference in a new issue