5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 20:16:23 +00:00
panel/app/views/usuaries/index.haml

61 lines
2.5 KiB
Text

.row.justify-content-center
.col.col-md-8
%h1= t('.title')
-# Una tabla de usuaries y otra de invitades, con acciones
- %i[usuaries invitades].each do |u|
%h2.mt-5= t(".#{u}")
.btn-group{ role: 'group', 'aria-label': t('.actions') }
- if @policy.invite?
= link_to t('.invite'),
site_usuaries_invite_path(@site, invite_as: u.to_s),
class: 'btn',
data: { toggle: 'tooltip' },
title: t('.help.invite', invite_as: u.to_s)
- if policy(Collaboration.new(@site)).collaborate?
= link_to t('.public_invite'),
site_collaborate_path(@site),
class: 'btn',
data: { toggle: 'tooltip' },
title: t('.help.public_invite')
%p.lead= t(".help.#{u}")
%table.table.table-condensed
%tbody
- @site.send(u).each do |cuenta|
- rol = cuenta.rol_for_site(@site)
%tr
-# TODO: avatares
%td= cuenta.email
%td
%time{ datetime: rol.created_at }
= time_ago_in_words rol.created_at
%td
- if rol.temporal
%span.badge.badge-info= t('.invited')
%td
.btn-group{ role: 'group',
aria: { label: t('.individual_actions') } }
- if @policy.demote? && @site.usuarie?(cuenta)
= link_to t('.demote.text'),
site_usuarie_demote_path(@site, cuenta),
class: 'btn',
data: { toggle: 'tooltip',
confirm: t('.demote.confirm') },
title: t('.help.demote'),
method: :patch
- if @policy.promote? && @site.invitade?(cuenta)
= link_to t('.promote.text'),
site_usuarie_promote_path(@site, cuenta),
class: 'btn',
data: { toggle: 'tooltip',
confirm: t('.promote.confirm') },
title: t('.help.promote'),
method: :patch
- if @policy.destroy?
= link_to t('.destroy.text'),
site_usuarie_path(@site, cuenta),
class: 'btn',
data: { toggle: 'tooltip',
confirm: t('.destroy.confirm') },
title: t('.help.destroy'),
method: :delete