From a7edb84bd8e35355031d2b7c63266771bc6bfa67 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 19 Jun 2018 14:37:45 -0300 Subject: [PATCH] =?UTF-8?q?mostrar=20la=20ayuda=20si=20est=C3=A1=20disponi?= =?UTF-8?q?ble?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/post/template_field.rb | 4 ++++ app/views/posts/_form.haml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/post/template_field.rb b/app/models/post/template_field.rb index 462cb323..890d8c28 100644 --- a/app/models/post/template_field.rb +++ b/app/models/post/template_field.rb @@ -114,6 +114,10 @@ class Post h end + def help + complex? && contents.dig('help') + end + # Obtiene los valores posibles para el campo de la plantilla def values return '' if %w[string text].include? value diff --git a/app/views/posts/_form.haml b/app/views/posts/_form.haml index 45dd74db..de6097d2 100644 --- a/app/views/posts/_form.haml +++ b/app/views/posts/_form.haml @@ -78,7 +78,7 @@ - @post.template_fields.each do |template| - next unless type = template.type .form-group - = label_tag "post_#{template}", template.human + = label_tag "post_#{template}", template.help.present? ? template.help : template.human - name = "post[#{template}]" - value = @post.new? ? template.values : @post.get_front_matter(template) - case type