Retrospring/app/views/modal/_ban.haml

40 lines
2.3 KiB
Plaintext
Raw Normal View History

- current_ban = user.bans.current.first
2020-05-10 03:53:30 -07:00
.modal.fade#modal-ban{ aria: { hidden: true, labelledby: 'modal-ban-label' }, role: :dialog, tabindex: -1 }
.modal-dialog
2021-12-29 15:20:09 -08:00
.modal-content#ban-control-super
.modal-header
2020-05-10 03:53:30 -07:00
%h5.modal-title#modal-ban-label
2022-07-02 02:34:46 -07:00
= t '.title'
2020-05-10 03:53:30 -07:00
%button.close{ data: { dismiss: :modal }, type: :button }
%span{ aria: { hidden: true } } ×
2022-07-02 02:34:46 -07:00
%span.sr-only= t 'views.actions.close'
2020-05-10 13:27:39 -07:00
= bootstrap_form_tag(url: '/mod/ban', html: { method: :post, novalidate: :novalidate }) do |f|
2020-05-10 03:53:30 -07:00
= f.hidden_field :user, value: user.screen_name
- if current_ban.nil?
2021-12-29 15:20:09 -08:00
.modal-body
2022-07-02 02:34:46 -07:00
= f.check_box :ban, label: t('.is_banned'), checked: user.banned?
2022-01-07 17:52:19 -08:00
#ban-controls{ class: user.banned? ? '' : 'd-none' }
2022-07-02 02:34:46 -07:00
= f.check_box :permaban, label: t('.is_permanent'), checked: user.permanently_banned?
#ban-controls-time{ class: user.permanently_banned? ? 'd-none' : '' }
2022-07-02 02:47:45 -07:00
.form-row
= f.number_field :duration, label: '', inputmode: :numeric, required: true, wrapper: { class: 'col-md-2' }
.form-check.form-check-inline.mt-3
- for unit in %i[hours days weeks months]
= f.radio_button :duration_unit, unit, label: unit, checked: true
2022-07-02 02:34:46 -07:00
= f.text_field :reason, placeholder: t('.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'
2022-07-02 02:34:46 -07:00
= f.submit t('.hammertime'), class: 'btn btn-primary', name: 'hammer-time'
- else
= f.hidden_field :ban, value: '0'
2021-12-29 15:20:09 -08:00
.modal-body
- if current_ban.expires_at.nil?
2022-07-02 02:34:46 -07:00
= t '.banned_permanently_html', reason: current_ban.reason
- else
2022-07-02 02:34:46 -07:00
= t '.banned_temporarily_html', reason: current_ban.reason, until: current_ban.expires_at.strftime('%Y-%m-%d %H:%M:%S')
- if current_ban.banned_by.present?
%br
2022-07-02 02:34:46 -07:00
= t '.banned_by_html', user: current_ban.banned_by.screen_name, on: current_ban.created_at.strftime('%Y-%m-%d %H:%M:%S')
.modal-footer
2022-07-02 02:34:46 -07:00
= f.submit t '.unban', class: 'btn btn-primary', name: 'hammer-time'