mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 12:39:53 +01:00
Create tabs for ban modal
This commit is contained in:
parent
1f3681ef50
commit
a0877b102a
4 changed files with 40 additions and 19 deletions
|
@ -11,20 +11,22 @@
|
|||
= 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('.is_banned'), checked: user.banned?
|
||||
#ban-controls{ class: user.banned? ? '' : 'd-none' }
|
||||
= f.check_box :permaban, label: t('.is_permanent'), checked: user.permanently_banned?
|
||||
#ban-controls-time{ class: user.permanently_banned? ? 'd-none' : '' }
|
||||
.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
|
||||
= f.text_field :reason, placeholder: t('.reason')
|
||||
.modal-footer
|
||||
%button.btn.btn-default{ name: 'stop-time', type: :button, data: { dismiss: :modal } }= t 'views.actions.close'
|
||||
= f.submit t('.hammertime'), class: 'btn btn-primary', name: 'hammer-time'
|
||||
- if user.bans.count > 1
|
||||
%div{ role: :tabpanel }
|
||||
%ul.nav.nav-tabs.mt-1{ role: :tablist }
|
||||
%li.nav-item{ role: 'presentation' }
|
||||
%a.nav-link.active{ href: '#ban-controls', aria: { controls: 'ban-controls' }, data: { toggle: :tab }, role: :tab }
|
||||
= t '.tabs.controls'
|
||||
%li.nav-item{ role: 'presentation' }
|
||||
%a.nav-link{ href: '#ban-history', aria: { controls: 'ban-history' }, data: { toggle: :tab }, role: :tab }
|
||||
= t '.tabs.history'
|
||||
.tab-content
|
||||
.tab-pane.active{ role: :tabpanel, id: 'ban-controls' }
|
||||
= render 'modal/ban/controls', f: f, user: user
|
||||
.tab-pane{ role: :tabpanel, id: 'ban-history' }
|
||||
= render 'modal/ban/history', user: user
|
||||
- else
|
||||
= render 'modal/ban/controls', f: f, user: user
|
||||
- else
|
||||
= f.hidden_field :ban, value: '0'
|
||||
.modal-body
|
||||
|
|
14
app/views/modal/ban/_controls.haml
Normal file
14
app/views/modal/ban/_controls.haml
Normal file
|
@ -0,0 +1,14 @@
|
|||
.modal-body
|
||||
= f.check_box :ban, label: t('.is_banned'), checked: user.banned?
|
||||
#ban-controls{ class: user.banned? ? '' : 'd-none' }
|
||||
= f.check_box :permaban, label: t('.is_permanent'), checked: user.permanently_banned?
|
||||
#ban-controls-time{ class: user.permanently_banned? ? 'd-none' : '' }
|
||||
.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
|
||||
= f.text_field :reason, placeholder: t('.reason')
|
||||
.modal-footer
|
||||
%button.btn.btn-default{ name: 'stop-time', type: :button, data: { dismiss: :modal } }= t 'views.actions.close'
|
||||
= f.submit t('.hammertime'), class: 'btn btn-primary', name: 'hammer-time'
|
1
app/views/modal/ban/_history.haml
Normal file
1
app/views/modal/ban/_history.haml
Normal file
|
@ -0,0 +1 @@
|
|||
Ban history here.
|
|
@ -83,14 +83,18 @@ en:
|
|||
title: "Save account changes"
|
||||
ban:
|
||||
title: "Ban Control Center"
|
||||
reason: "Reason"
|
||||
is_banned: "Ban?"
|
||||
is_permanent: "Permanently?"
|
||||
hammertime: "Hammer Time"
|
||||
unban: "Unban"
|
||||
controls:
|
||||
reason: "Reason"
|
||||
is_banned: "Ban?"
|
||||
is_permanent: "Permanently?"
|
||||
hammertime: "Hammer Time"
|
||||
tabs:
|
||||
controls: "Ban"
|
||||
history: "History"
|
||||
banned_permanently_html: "This user is currently permanently banned for <strong>%{reason}</strong>"
|
||||
banned_temporarily_html: "This user is currently banned until <strong>%{until}</strong> for <strong>%{reason}</strong>"
|
||||
banned_by_html: "This ban was instated by <strong>%{user}</strong> on <strong>%{on}</strong>"
|
||||
unban: "Unban"
|
||||
services:
|
||||
index:
|
||||
title: "Service Settings"
|
||||
|
|
Loading…
Reference in a new issue