no fallar si el sitio no tiene plantillas
This commit is contained in:
parent
1f377437e4
commit
abade15c23
2 changed files with 12 additions and 11 deletions
|
@ -111,7 +111,7 @@ class Site
|
||||||
|
|
||||||
# Obtiene todas las plantillas de artículos
|
# Obtiene todas las plantillas de artículos
|
||||||
def templates
|
def templates
|
||||||
@templates ||= posts_for('templates')
|
@templates ||= posts_for('templates') || []
|
||||||
end
|
end
|
||||||
|
|
||||||
# Obtiene todos los posts de una colección determinada
|
# Obtiene todos los posts de una colección determinada
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
.btn-group
|
.btn-group
|
||||||
= link_to t('posts.new'), new_site_post_path(@site, lang: @lang),
|
= link_to t('posts.new'), new_site_post_path(@site, lang: @lang),
|
||||||
class: 'btn btn-success'
|
class: 'btn btn-success'
|
||||||
|
- unless @site.templates.empty?
|
||||||
%button.btn.btn-success.dropdown-toggle.dropdown-toggle-split{data: { toggle: 'split' },
|
%button.btn.btn-success.dropdown-toggle.dropdown-toggle-split{data: { toggle: 'split' },
|
||||||
aria: { haspopup: 'true', expanded: 'false' }}
|
aria: { haspopup: 'true', expanded: 'false' }}
|
||||||
%span.sr-only= t('posts.dropdown')
|
%span.sr-only= t('posts.dropdown')
|
||||||
|
|
Loading…
Reference in a new issue