diff --git a/app/models/post/template_field.rb b/app/models/post/template_field.rb index a4ad6584..99d54953 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 e61cb105..edd4d73e 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