trabajar correctamente con checkbox

This commit is contained in:
f 2018-05-14 18:44:38 -03:00
parent 17d6d01aeb
commit 0d5c974f6d
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7

View file

@ -80,7 +80,7 @@
.form-group .form-group
= label_tag "post_#{template}", template.humanize = label_tag "post_#{template}", template.humanize
- name = "post[#{template}]" - name = "post[#{template}]"
- value = @post.template_values_for(template) - value = @post.get_front_matter(template)
- case type - case type
- when 'text' - when 'text'
= text_field 'post', template, = text_field 'post', template,
@ -89,9 +89,10 @@
- when 'text_area' - when 'text_area'
= text_area_tag name, value, class: 'form-control' = text_area_tag name, value, class: 'form-control'
- when 'check_box' - when 'check_box'
= check_box_tag name, value: value, class: 'form-control' = hidden_field 'post', template, value: 'false'
= check_box_tag name, 'true', value == 'true', class: 'form-control'
- when 'select' - when 'select'
= select_tag name, options_for_select(value, @post.get_front_matter(template)), = select_tag name, options_for_select(@post.template_values_for(template), value),
{ class: 'form-control select2', { class: 'form-control select2',
multiple: @post.template_multiple_values?(template) } multiple: @post.template_multiple_values?(template) }
.form-group .form-group