From 07c937682b9b7436b1b02bf81acab484cad26a0b Mon Sep 17 00:00:00 2001 From: f Date: Thu, 17 May 2018 15:34:44 -0300 Subject: [PATCH] usar los valores de la plantilla o los del post --- app/views/posts/_form.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/posts/_form.haml b/app/views/posts/_form.haml index 722c7513..f2792d91 100644 --- a/app/views/posts/_form.haml +++ b/app/views/posts/_form.haml @@ -80,7 +80,7 @@ .form-group = label_tag "post_#{template}", template.humanize - name = "post[#{template}]" - - value = @post.get_front_matter(template) + - value = @post.new? ? @post.template_values_for(template) : @post.get_front_matter(template) - case type - when 'text' = text_field 'post', template, @@ -92,7 +92,7 @@ = hidden_field 'post', template, value: 'false' = check_box_tag name, 'true', value == 'true', class: 'form-control' - when 'select' - = select_tag name, options_for_select(@post.template_values_for(template), value), + = select_tag name, options_for_select(@post.template_values_for(template), @post.get_front_matter(template)), { class: 'form-control select2', multiple: @post.template_multiple_values?(template) } .form-group