checkbox con onda
This commit is contained in:
parent
514cb89b5f
commit
3534762f65
4 changed files with 10 additions and 44 deletions
|
@ -1,11 +1,12 @@
|
|||
.form-check
|
||||
= hidden_field_tag "post[#{attribute}]", '0'
|
||||
= check_box_tag "post[#{attribute}]", '1', metadata.value,
|
||||
class: "form-check-input #{invalid(post, attribute)}",
|
||||
aria: { describedby: id_for_help(attribute) },
|
||||
autofocus: autofocus
|
||||
= label_tag "post_#{attribute}", post_label_t(attribute, post: post),
|
||||
class: 'form-check-label'
|
||||
= hidden_field_tag "post[#{attribute}]", '0', id: ''
|
||||
.custom-control.custom-switch
|
||||
= check_box_tag "post[#{attribute}]", '1', metadata.value,
|
||||
class: "custom-control-input #{invalid(post, attribute)}",
|
||||
aria: { describedby: id_for_help(attribute) },
|
||||
autofocus: autofocus
|
||||
= label_tag "post_#{attribute}", post_label_t(attribute, post: post),
|
||||
class: 'custom-control-label'
|
||||
|
||||
= render 'posts/attribute_feedback',
|
||||
post: post, attribute: attribute, metadata: metadata
|
||||
= render 'posts/attribute_feedback',
|
||||
post: post, attribute: attribute, metadata: metadata
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
- field_name = field_name_for_post_as_string(name)
|
||||
= hidden_field_tag field_name, 'false'
|
||||
.form-check
|
||||
= check_box_tag field_name,
|
||||
'true',
|
||||
value == 'true',
|
||||
class: 'form-check-input'
|
||||
= label_tag field_name, t('posts.checkbox'), class: 'form-check-label'
|
|
@ -1,12 +0,0 @@
|
|||
-# Obtener el nombre del campo
|
||||
- field_name = field_name_for_post_as_string(name)
|
||||
-# Obtener todos los valores
|
||||
- value = [] if value.nil?
|
||||
- values = template.values.empty? ? [value].flatten : template.values
|
||||
- values.each do |v|
|
||||
.form-check
|
||||
= check_box_tag field_name+'[]',
|
||||
v,
|
||||
@post.fetch_front_matter(name, []).include?(v),
|
||||
class: 'form-check-input'
|
||||
= label_tag field_name, v, class: 'form-check-label'
|
|
@ -1,15 +0,0 @@
|
|||
-# Obtener el nombre del campo
|
||||
- field_name = field_name_for_post_as_string(name)
|
||||
-# Obtener todos los valores
|
||||
- value = [] if value.nil?
|
||||
- values = template.values.empty? ? [value].flatten : template.values
|
||||
- values.each do |v|
|
||||
.form-check
|
||||
= radio_button_tag field_name+'[]',
|
||||
v,
|
||||
@post.fetch_front_matter(name, []).include?(v),
|
||||
class: 'form-check-input'
|
||||
= label_tag [field_name,v].join(' '), class: 'form-check-label' do
|
||||
= v.split(':', 2).first
|
||||
%br/
|
||||
%small= v.split(':', 2).last
|
Loading…
Reference in a new issue