UX: Slightly improved reviewable user display, plus link to admin if possible

This commit is contained in:
Robin Ward 2019-04-03 17:07:24 -04:00
parent 3b581de3b8
commit a4ff593506
5 changed files with 44 additions and 5 deletions

View File

@ -1,7 +1,25 @@
<div class='reviewable-user-info'>
<div class='reviewable-user-details'>
<div class='reviewable-user-details username'>
<div class='name'>{{i18n "review.user.username"}}</div>
<div class='value'>
{{#if reviewable.link_admin}}
<a href={{get-url (concat "/admin/users/" reviewable.user_id "/" reviewable.payload.username)}}>
{{reviewable.payload.username}}
{{reviewable.payload.email}}
</a>
{{else}}
{{reviewable.payload.username}}
{{/if}}
</div>
</div>
{{#if reviewable.payload.name}}
<div class='reviewable-user-details name'>
<div class='name'>{{i18n "review.user.name"}}</div>
<div class='value'>{{reviewable.payload.name}}</div>
</div>
{{/if}}
<div class='reviewable-user-details email'>
<div class='name'>{{i18n "review.user.email"}}</div>
<div class='value'>{{reviewable.payload.email}}</div>
</div>
{{yield}}

View File

@ -44,8 +44,18 @@
}
}
.reviewable-user-details {
.reviewable-user-info {
margin: 0.5em 0;
.reviewable-user-details {
display: flex;
.name {
width: 8em;
font-weight: bold;
margin-right: 1em;
}
margin-bottom: 0.5em;
}
}
.no-review {

View File

@ -1,9 +1,15 @@
class ReviewableUserSerializer < ReviewableSerializer
attributes :link_admin
payload_attributes(
:username,
:email,
:name
)
def link_admin
scope.is_staff? && object.target.present?
end
end

View File

@ -29,7 +29,7 @@ class UserDestroyer
Reviewable.where(created_by_id: user.id).delete_all
if reviewable = Reviewable.find_by(target: user)
reviewable.perform(@actor, :reject, skip_delete: true)
reviewable.perform(@actor, :reject, skip_delete: true) rescue Reviewable::InvalidAction
end
if opts[:delete_posts]

View File

@ -381,6 +381,11 @@ en:
filtered_user: "User:"
show_all_topics: "show all topics"
deleted_user: "(deleted user)"
user:
username: "Username"
email: "Email"
name: "Name"
user_percentage:
summary:
one: "{{agreed}}, {{disagreed}}, {{ignored}} ({{count}} total flag)"