From cdfb66791e3aeb4d2fba1173aac5187458de814a Mon Sep 17 00:00:00 2001 From: f Date: Wed, 5 Sep 2018 16:18:09 -0300 Subject: [PATCH] =?UTF-8?q?mostrar=20el=20t=C3=ADtulo=20de=20la=20secci?= =?UTF-8?q?=C3=B3n?= 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, 6 insertions(+) diff --git a/app/models/post/template_field.rb b/app/models/post/template_field.rb index a4ad658..99d5495 100644 --- a/app/models/post/template_field.rb +++ b/app/models/post/template_field.rb @@ -16,6 +16,10 @@ class Post @contents = contents end + def title + contents.dig('title') if complex? + end + # Obtiene el valor def value complex? ? contents.dig('value') : contents diff --git a/app/views/posts/_form.haml b/app/views/posts/_form.haml index e61cb10..edd4d73 100644 --- a/app/views/posts/_form.haml +++ b/app/views/posts/_form.haml @@ -93,6 +93,8 @@ -# Genera todos los campos de la plantilla - @post.template_fields.each do |template| - next unless type = template.type + - if template.title.present? + %h1= template.title - value = @post.new? ? template.values : @post.get_front_matter(template.key) .form-group = label_tag "post_#{template}", id: template do