Highlight current ban
This commit is contained in:
parent
c838263a2e
commit
32865b528d
|
@ -7,4 +7,8 @@ class UserBan < ApplicationRecord
|
||||||
def permanent?
|
def permanent?
|
||||||
expires_at.nil?
|
expires_at.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def current?
|
||||||
|
permanent? || expires_at > Time.now.utc
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
%p= t '.count', user: user.screen_name, count: user.bans.count
|
%p= t '.count', user: user.screen_name, count: user.bans.count
|
||||||
.list-group
|
.list-group
|
||||||
- user.bans.each do |ban|
|
- user.bans.each do |ban|
|
||||||
.list-group-item
|
.list-group-item{ class: ban.current? ? 'list-group-item-success' : '' }
|
||||||
.d-flex.w-100.justify-content-between
|
.d-flex.w-100.justify-content-between
|
||||||
%h5.mb-1= ban.reason
|
%h5.mb-1= ban.reason
|
||||||
%small.text-muted= time_ago_in_words ban.created_at
|
%small.text-muted= time_ago_in_words ban.created_at
|
||||||
- if ban.banned_by.present?
|
- if ban.banned_by.present?
|
||||||
%p= t('.issued_by', user: ban.banned_by.screen_name)
|
%p= t('.issued_by', user: ban.banned_by.screen_name)
|
||||||
- if ban.expires_at.present?
|
- if ban.expires_at.present?
|
||||||
%small= t('.until', until: ban.expires_at.strftime('%Y-%m-%d %H:%M:%S'))
|
%small= t(ban.expires_at.past? ? '.expired' : '.until', until: ban.expires_at.strftime('%Y-%m-%d %H:%M:%S'))
|
||||||
- else
|
- else
|
||||||
%small= t('.permanent')
|
%small= t('.permanent')
|
||||||
|
|
|
@ -101,6 +101,7 @@ en:
|
||||||
issued_by: "Issued by %{user}"
|
issued_by: "Issued by %{user}"
|
||||||
permanent: "Permanent"
|
permanent: "Permanent"
|
||||||
until: "Until %{until}"
|
until: "Until %{until}"
|
||||||
|
expired: "Expired at %{until}"
|
||||||
services:
|
services:
|
||||||
index:
|
index:
|
||||||
title: "Service Settings"
|
title: "Service Settings"
|
||||||
|
|
Loading…
Reference in New Issue