Move unban into own view

This commit is contained in:
Karina Kwiatek 2022-07-02 12:19:56 +02:00 committed by Karina Kwiatek
parent a0877b102a
commit 990c67baea
4 changed files with 36 additions and 16 deletions

View File

@ -28,14 +28,4 @@
- else
= render 'modal/ban/controls', f: f, user: user
- else
= f.hidden_field :ban, value: '0'
.modal-body
- if current_ban.expires_at.nil?
= t '.banned_permanently_html', reason: current_ban.reason
- else
= 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
= 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
= f.submit t '.unban', class: 'btn btn-primary', name: 'hammer-time'
= render 'modal/ban/unban', user: user

View File

@ -1 +1,14 @@
Ban history here.
.modal-body
%p= t '.count', user: user.screen_name, count: user.bans.count
.list-group
- user.bans.each do |ban|
.list-group-item
.d-flex.w-100.justify-content-between
%h5.mb-1= ban.reason
%small.text-muted= time_ago_in_words ban.created_at
- if ban.banned_by.present?
%p= t('.issued_by', user: ban.banned_by.screen_name)
- if ban.expires_at.present?
%small= t('.until', until: ban.expires_at.strftime('%Y-%m-%d %H:%M:%S'))
- else
%small= t('.permanent')

View File

@ -0,0 +1,11 @@
= f.hidden_field :ban, value: '0'
.modal-body
- if current_ban.expires_at.nil?
= t '.banned_permanently_html', reason: current_ban.reason
- else
= 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
= 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
= f.submit t '.unban', class: 'btn btn-primary', name: 'hammer-time'

View File

@ -91,10 +91,16 @@ en:
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"
unban:
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"
history:
count: "%{user} has been banned %{count} times."
issued_by: "Issued by %{user}"
permanent: "Permanent"
until: "Until %{until}"
services:
index:
title: "Service Settings"