5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-04 16:25:45 +00:00

no fallar en articulos nuevos

This commit is contained in:
f 2018-06-27 20:56:47 -03:00
parent dd6b37bdd2
commit 6941f21a54
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7
2 changed files with 4 additions and 1 deletions

View file

@ -225,6 +225,8 @@ class Post
# Obtiene los valores posibles para el campo de la plantilla
def values
return 'false' if self.value == false
return 'true' if self.value == true
# XXX por alguna razón `value` no refiere a value() :/
return '' if STRING_VALUES.include? self.value
# Las listas cerradas no necesitan mayor procesamiento
@ -295,7 +297,7 @@ class Post
# [ [ 1, a ], [ 2, b ] ]
# aunque si no hay un : en el autocompletado, el array queda
# [ [ 1, 1 ], [ 2, 2 ] ]
values = _value.last.zip _value.first
values = _value.empty? ? [] : _value.last.zip(_value.first)
# En última instancia, traer el valor por defecto y ahorrarnos
# volver a procesar

View file

@ -2,6 +2,7 @@
- value = @post.get_front_matter(name.first).try(:[], name.second.to_i).try(:[], name.last)
- else
- value = @post.get_front_matter(template.key)
- value = [] if value.nil?
- values = template.values.empty? ? value : template.values
= select_tag field_name_for_post_as_string(name),
options_for_select(values, value),