5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-04 14:35:46 +00:00

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,17 +12,18 @@
.btn-group
= link_to t('posts.new'), new_site_post_path(@site, lang: @lang),
class: 'btn btn-success'
%button.btn.btn-success.dropdown-toggle.dropdown-toggle-split{data: { toggle: 'split' },
aria: { haspopup: 'true', expanded: 'false' }}
%span.sr-only= t('posts.dropdown')
.dropdown-menu
- @site.templates.each do |template|
= link_to template.id.camelize,
new_site_post_path(@site, lang: @lang, template: template.id),
- 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')
.dropdown-menu
- @site.templates.each do |template|
= link_to template.id.camelize,
new_site_post_path(@site, lang: @lang, template: template.id),
class: 'dropdown-item'
.dropdown-divider
= link_to t('templates.index'), site_templates_path(@site),
class: 'dropdown-item'
.dropdown-divider
= link_to t('templates.index'), site_templates_path(@site),
class: 'dropdown-item'
- @site.translations.each do |l|
= link_to t("i18n.#{l}"), site_posts_path(@site, category: @category, lang: l),
class: 'btn btn-info'