sutty/app/views/sites/index.haml
f 7f75f5cd8a si los archivos del sitio no existen, saltearlo
lo correcto sería mostrar un error.  esto nos ayuda a tener pocos sitios
en staging en lugar de todos y que se puedan mostrar en el panel.
2021-05-17 17:54:21 -03:00

64 lines
2.5 KiB
Plaintext

%main.row
%aside.col-md-3
%h1= t('.title')
%p.lead= t('.help')
- if policy(Site).new?
= link_to t('sites.new.title'), new_site_path,
class: 'btn'
%section.col
- if @sites.empty?
:markdown
#{t('.welcome')}
%table.table.table-condensed
%tbody
- @sites.each do |site|
- next unless site.jekyll
- rol = current_usuarie.rol_for_site(site)
-#
TODO: Solo les usuaries cachean porque tenemos que separar
les botones por permisos.
- cache_if (rol.usuarie? && !rol.temporal), [site, I18n.locale] do
%tr
%td
%h2
- if policy(site).show?
= link_to site.title, site_posts_path(site, locale: site.default_locale)
- else
= site.title
%p.lead= site.description
%br
= 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
- 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)
- if policy(site).pull? && site.repository.needs_pull?
= render 'layouts/btn_with_tooltip',
tooltip: t('help.sites.pull'),
text: t('.pull'),
type: 'info',
link: site_pull_path(site)
= render 'sites/build', site: site