From abc4bd6921576ae127dfddf5fcc83d0306874520 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 27 Jun 2018 19:03:21 -0300 Subject: [PATCH] no repetir los campos que son hashes #51 --- app/views/posts/template_field/_table.haml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/posts/template_field/_table.haml b/app/views/posts/template_field/_table.haml index 2d2ebb96..bd229fb2 100644 --- a/app/views/posts/template_field/_table.haml +++ b/app/views/posts/template_field/_table.haml @@ -13,6 +13,8 @@ - else -# Obtenemos todos los valores. Puede ser un Hash o un Array - groups = @post.get_front_matter(template.key) + - if groups.is_a? Hash + - groups = [ groups ] - groups.each_with_index do |group, i| -# A partir del segundo grupo todos son extra - classes = (i > 0) ? [template.key, 'extra'] : [template.key] @@ -41,7 +43,7 @@ -# Si el campo es un array, groups es un array de hashes -# y group un hash. De lo contrarios, groups va a ser un -# Hash - - value = template.array? ? group[nf.key] : groups[nf.key] + - value = (template.array? || template.nested?) ? group[nf.key] : groups[nf.key] = render 'posts/template_field/nested', template: nf, value: value,