campos numericos

This commit is contained in:
f 2020-03-24 19:11:30 -03:00
parent bdedaf67cc
commit abae3b5141
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D
3 changed files with 24 additions and 0 deletions

View file

@ -0,0 +1,15 @@
# frozen_string_literal: true
# Un campo numérico
class MetadataNumber < MetadataTemplate
# Nada
def default_value
nil
end
def save
self[:value] = value.to_i
true
end
end

View file

@ -0,0 +1,3 @@
%tr{ id: attribute }
%th= post_label_t(attribute, post: post)
%td= metadata.value

View file

@ -0,0 +1,6 @@
.form-group
= label_tag "post_#{attribute}", post_label_t(attribute, post: post)
= number_field 'post', attribute, value: metadata.value,
**field_options(attribute, metadata)
= render 'posts/attribute_feedback',
post: post, attribute: attribute, metadata: metadata