mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 16:06:23 +00:00
no fallar si el sitio no existe más
This commit is contained in:
parent
fdfc5db345
commit
a81b590356
1 changed files with 44 additions and 41 deletions
|
@ -14,47 +14,50 @@
|
||||||
%table.table.table-condensed
|
%table.table.table-condensed
|
||||||
%tbody
|
%tbody
|
||||||
- @sites.each do |site|
|
- @sites.each do |site|
|
||||||
|
-# Los sitios pueden fallar en cargar si los eliminamos físicamente del disco
|
||||||
- begin
|
- begin
|
||||||
- next unless site.jekyll
|
- next unless site.jekyll
|
||||||
- rol = current_usuarie.rol_for_site(site)
|
- rescue StandardError => e
|
||||||
-#
|
- ExceptionNotifier.notify_exception(e, data: { site: @site.name, usuarie: current_usuarie.id })
|
||||||
TODO: Solo les usuaries cachean porque tenemos que separar
|
- next
|
||||||
les botones por permisos.
|
|
||||||
- cache_if (rol.usuarie? && !rol.temporal), [site, I18n.locale] do
|
- rol = current_usuarie.rol_for_site(site)
|
||||||
%tr
|
-#
|
||||||
%td
|
TODO: Solo les usuaries cachean porque tenemos que separar
|
||||||
%h2
|
les botones por permisos.
|
||||||
- if policy(site).show?
|
- cache_if (rol.usuarie? && !rol.temporal), [site, I18n.locale] do
|
||||||
= link_to site.title, site_posts_path(site, locale: site.default_locale)
|
%tr
|
||||||
- else
|
%td
|
||||||
= site.title
|
%h2
|
||||||
%p.lead= site.description
|
- if policy(site).show?
|
||||||
%br
|
= link_to site.title, site_posts_path(site, locale: site.default_locale)
|
||||||
= link_to t('.visit'), site.url, class: 'btn'
|
|
||||||
- if rol.temporal
|
|
||||||
= button_to t('sites.invitations.accept'),
|
|
||||||
site_usuaries_accept_invitation_path(site),
|
|
||||||
method: :patch,
|
|
||||||
title: t('help.sites.invitations.accept'),
|
|
||||||
class: 'btn'
|
|
||||||
= button_to t('sites.invitations.reject'),
|
|
||||||
site_usuaries_reject_invitation_path(site),
|
|
||||||
method: :patch,
|
|
||||||
title: t('help.sites.invitations.reject'),
|
|
||||||
class: 'btn'
|
|
||||||
- else
|
- else
|
||||||
- if policy(site).show?
|
= site.title
|
||||||
= render 'layouts/btn_with_tooltip',
|
%p.lead= site.description
|
||||||
tooltip: t('help.sites.edit_posts'),
|
%br
|
||||||
type: 'success',
|
= link_to t('.visit'), site.url, class: 'btn'
|
||||||
link: site_path(site),
|
- if rol.temporal
|
||||||
text: t('sites.posts')
|
= button_to t('sites.invitations.accept'),
|
||||||
- if policy(SiteUsuarie.new(site, current_usuarie)).index?
|
site_usuaries_accept_invitation_path(site),
|
||||||
= render 'layouts/btn_with_tooltip',
|
method: :patch,
|
||||||
tooltip: t('usuaries.index.help.self'),
|
title: t('help.sites.invitations.accept'),
|
||||||
text: t('usuaries.index.title'),
|
class: 'btn'
|
||||||
type: 'info',
|
= button_to t('sites.invitations.reject'),
|
||||||
link: site_usuaries_path(site)
|
site_usuaries_reject_invitation_path(site),
|
||||||
= render 'sites/build', site: site
|
method: :patch,
|
||||||
- rescue ActionView::Template::Error => e
|
title: t('help.sites.invitations.reject'),
|
||||||
- ExceptionNotifier.notify_exception(e.cause, data: { site: @site.name, usuarie: current_usuarie.id })
|
class: 'btn'
|
||||||
|
- else
|
||||||
|
- if policy(site).show?
|
||||||
|
= render 'layouts/btn_with_tooltip',
|
||||||
|
tooltip: t('help.sites.edit_posts'),
|
||||||
|
type: 'success',
|
||||||
|
link: site_path(site),
|
||||||
|
text: t('sites.posts')
|
||||||
|
- if policy(SiteUsuarie.new(site, current_usuarie)).index?
|
||||||
|
= render 'layouts/btn_with_tooltip',
|
||||||
|
tooltip: t('usuaries.index.help.self'),
|
||||||
|
text: t('usuaries.index.title'),
|
||||||
|
type: 'info',
|
||||||
|
link: site_usuaries_path(site)
|
||||||
|
= render 'sites/build', site: site
|
||||||
|
|
Loading…
Reference in a new issue