From dedd6b4e4c851f77aa2a179796955e93db459d4f Mon Sep 17 00:00:00 2001 From: f Date: Fri, 22 Jun 2018 15:43:14 -0300 Subject: [PATCH] mostrar mejor los checkboxes #51 --- app/views/posts/_form.haml | 2 +- app/views/posts/template_field/_check_box.haml | 13 ++++++++----- app/views/posts/template_field/_nested.haml | 3 ++- config/locales/en.yml | 1 + config/locales/es.yml | 1 + 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/views/posts/_form.haml b/app/views/posts/_form.haml index e4e2f378..0188cc20 100644 --- a/app/views/posts/_form.haml +++ b/app/views/posts/_form.haml @@ -84,12 +84,12 @@ %small.text-muted.form-text= t('posts.lang_help') - @post.template_fields.each do |template| - next unless type = template.type + - value = @post.new? ? template.values : @post.get_front_matter(template) .form-group = label_tag "post_#{template}", id: template do - if template.private? = fa_icon 'lock', title: t('posts.private') = template.help - - value = @post.new? ? template.values : @post.get_front_matter(template) = render "posts/template_field/#{type}", template: template, name: template.key, value: value .invalid-feedback= t('posts.invalid') .form-group diff --git a/app/views/posts/template_field/_check_box.haml b/app/views/posts/template_field/_check_box.haml index be014953..d6f2933e 100644 --- a/app/views/posts/template_field/_check_box.haml +++ b/app/views/posts/template_field/_check_box.haml @@ -1,5 +1,8 @@ -= hidden_field_tag field_name_for_post_as_string(name), value: 'false' -= check_box_tag field_name_for_post_as_string(name), - 'true', - value == 'true', - class: 'form-control' +- field_name = field_name_for_post_as_string(name) += hidden_field_tag field_name, value: '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' diff --git a/app/views/posts/template_field/_nested.haml b/app/views/posts/template_field/_nested.haml index 532e479d..147930bf 100644 --- a/app/views/posts/template_field/_nested.haml +++ b/app/views/posts/template_field/_nested.haml @@ -3,4 +3,5 @@ = render "posts/template_field/#{template.type}", template: template, name: name, - value: value + value: value, + nested: true diff --git a/config/locales/en.yml b/config/locales/en.yml index 17ca46c6..9cc6dd39 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -211,3 +211,4 @@ en: row: add: 'Add group' del: 'Remove group' + checkbox: 'Yes' diff --git a/config/locales/es.yml b/config/locales/es.yml index d84cb8f9..41e86386 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -207,3 +207,4 @@ es: row: add: 'Agregar grupo' del: 'Eliminar grupo' + checkbox: 'Sí'