no fallar si el sitio no tiene plantillas

This commit is contained in:
f 2018-05-17 15:14:51 -03:00
parent 1f377437e4
commit abade15c23
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7
2 changed files with 12 additions and 11 deletions

View file

@ -111,7 +111,7 @@ class Site
# Obtiene todas las plantillas de artículos
def templates
@templates ||= posts_for('templates')
@templates ||= posts_for('templates') || []
end
# Obtiene todos los posts de una colección determinada

View file

@ -12,6 +12,7 @@
.btn-group
= link_to t('posts.new'), new_site_post_path(@site, lang: @lang),
class: 'btn btn-success'
- unless @site.templates.empty?
%button.btn.btn-success.dropdown-toggle.dropdown-toggle-split{data: { toggle: 'split' },
aria: { haspopup: 'true', expanded: 'false' }}
%span.sr-only= t('posts.dropdown')