mostrar el título de la sección

This commit is contained in:
f 2018-09-05 16:18:09 -03:00
parent 667e3d252c
commit cdfb66791e
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7
2 changed files with 6 additions and 0 deletions

View file

@ -16,6 +16,10 @@ class Post
@contents = contents @contents = contents
end end
def title
contents.dig('title') if complex?
end
# Obtiene el valor # Obtiene el valor
def value def value
complex? ? contents.dig('value') : contents complex? ? contents.dig('value') : contents

View file

@ -93,6 +93,8 @@
-# Genera todos los campos de la plantilla -# Genera todos los campos de la plantilla
- @post.template_fields.each do |template| - @post.template_fields.each do |template|
- next unless type = template.type - next unless type = template.type
- if template.title.present?
%h1= template.title
- value = @post.new? ? template.values : @post.get_front_matter(template.key) - value = @post.new? ? template.values : @post.get_front_matter(template.key)
.form-group .form-group
= label_tag "post_#{template}", id: template do = label_tag "post_#{template}", id: template do