Retrospring/app/views/modal/_ban.haml

48 lines
2.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

- current_ban = user.bans.current.first
.modal.fade#modal-ban{ aria: { hidden: true, labelledby: 'modal-ban-label' }, role: :dialog, tabindex: -1 }
.modal-dialog
.modal-content#ban-control-super
.modal-header
%h5.modal-title#modal-ban-label
= t 'views.modal.bancontrol.title'
%button.close{ data: { dismiss: :modal }, type: :button }
%span{ aria: { hidden: true } } ×
%span.sr-only Close
= bootstrap_form_tag(url: '/mod/ban', html: { method: :post, novalidate: :novalidate }) do |f|
= f.hidden_field :user, value: user.screen_name
- if current_ban.nil?
.modal-body
= f.check_box :ban, label: t('views.modal.bancontrol.ban'), checked: user.banned?
#ban-controls{ class: user.banned? ? '' : 'd-none' }
= f.check_box :permaban, label: t('views.modal.bancontrol.permanent'), checked: user.permanent?
#ban-controls-time{ class: user.permanent? ? 'd-none' : '' }
= f.text_field :duration, label: '', required: true
.form-check.form-check-inline
= f.radio_button :duration_unit, 'hours', label: 'Hours', checked: true
= f.radio_button :duration_unit, 'days', label: 'Days'
= f.radio_button :duration_unit, 'weeks', label: 'Weeks'
= f.radio_button :duration_unit, 'months', label: 'Months'
= f.text_field :reason, placeholder: t('views.modal.bancontrol.reason'), value: user.bans.current.first&.reason
.modal-footer
%button.btn.btn-default{ name: 'stop-time', type: :button, data: { dismiss: :modal } }= t 'views.actions.close'
= f.submit t('views.modal.bancontrol.hammertime'), class: 'btn btn-primary', name: 'hammer-time'
- else
= f.hidden_field :ban, value: '0'
.modal-body
- if current_ban.expires_at.nil?
This user is currently permanently banned for
%strong= current_ban.reason
- else
This user is currently banned until
%strong= current_ban.expires_at
for
%strong= current_ban.reason
- if current_ban.banned_by.present?
%br
This ban was instated by
%strong= current_ban.banned_by.profile.safe_name
on
%strong= current_ban.created_at
.modal-footer
= f.submit 'Unban', class: 'btn btn-primary', name: 'hammer-time'