UX: improve ip-lookup modal
- replace close button with cross - use table instead of ul/li - use trust level number instead of full name - sort users by descending trust level - add post count
This commit is contained in:
parent
0947191060
commit
98e8523eec
|
@ -26,7 +26,8 @@ export default Ember.Component.extend({
|
|||
this.set("otherAccountsLoading", true);
|
||||
Discourse.AdminUser.findAll("active", {
|
||||
"ip": this.get("ip"),
|
||||
"exclude": this.get("user_id")
|
||||
"exclude": this.get("user_id"),
|
||||
"order": "trust_level DESC"
|
||||
}).then(function (users) {
|
||||
self.setProperties({
|
||||
other_accounts: users,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
{{/if}}
|
||||
{{#if show}}
|
||||
<div class="location-box">
|
||||
<a class="close" {{action "hide"}}>{{fa-icon "times"}}</a>
|
||||
<h4>{{i18n ip_lookup.title}}</h4>
|
||||
<dl>
|
||||
{{#if location}}
|
||||
|
@ -40,21 +41,33 @@
|
|||
<dd class="other-accounts">
|
||||
{{#loading-spinner size="small" condition=otherAccountsLoading}}
|
||||
{{#if other_accounts}}
|
||||
<ul>
|
||||
{{#each other_accounts}}
|
||||
<li>
|
||||
{{#link-to "adminUser" this}}{{avatar this usernamePath="user.username" imageSize="small"}} {{username}}{{/link-to}}
|
||||
({{trustLevel.name}}),
|
||||
<strong>{{i18n ip_lookup.read_time}}</strong> {{time_read}},
|
||||
<strong>{{i18n ip_lookup.topics_entered}}</strong> {{topics_entered}}
|
||||
</li>
|
||||
{{/each}}
|
||||
<table class="table table-condensed table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{i18n ip_lookup.username}}</th>
|
||||
<th>{{i18n ip_lookup.trust_level}}</th>
|
||||
<th>{{i18n ip_lookup.read_time}}</th>
|
||||
<th>{{i18n ip_lookup.topics_entered}}</th>
|
||||
<th>{{i18n ip_lookup.post_count}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each other_accounts}}
|
||||
<tr>
|
||||
<td>{{#link-to "adminUser" this}}{{avatar this usernamePath="user.username" imageSize="small"}} {{username}}{{/link-to}}</td>
|
||||
<td>{{trustLevel.id}}</td>
|
||||
<td>{{time_read}}</td>
|
||||
<td>{{topics_entered}}</td>
|
||||
<td>{{post_count}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{else}}
|
||||
{{i18n ip_lookup.no_other_accounts}}
|
||||
{{/if}}
|
||||
{{/loading-spinner}}
|
||||
<dd>
|
||||
</dl>
|
||||
<button class="btn close" {{action "hide"}}>{{i18n close}}</button>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
@ -30,7 +30,7 @@ class AdminUserSerializer < BasicUserSerializer
|
|||
|
||||
has_one :single_sign_on_record, serializer: SingleSignOnRecordSerializer, embed: :objects
|
||||
|
||||
[:days_visited,:posts_read_count,:topics_entered].each do |sym|
|
||||
[:days_visited, :posts_read_count, :topics_entered, :post_count].each do |sym|
|
||||
attributes sym
|
||||
define_method sym do
|
||||
object.user_stat.send(sym)
|
||||
|
|
|
@ -280,8 +280,11 @@ en:
|
|||
phone: Phone
|
||||
other_accounts: "Other accounts with this IP address:"
|
||||
no_other_accounts: (none)
|
||||
read_time: "read time:"
|
||||
topics_entered: "topics entered:"
|
||||
username: "username"
|
||||
trust_level: "TL"
|
||||
read_time: "read time"
|
||||
topics_entered: "topics entered"
|
||||
post_count: "# posts"
|
||||
|
||||
user:
|
||||
said: "{{username}}:"
|
||||
|
|
|
@ -10,11 +10,17 @@ class AdminUserIndexQuery
|
|||
attr_reader :params, :trust_levels
|
||||
|
||||
def initialize_query_with_order(klass)
|
||||
order = [params[:order]]
|
||||
|
||||
if params[:query] == "active"
|
||||
klass.order("COALESCE(last_seen_at, to_date('1970-01-01', 'YYYY-MM-DD')) DESC, username")
|
||||
order << "COALESCE(last_seen_at, to_date('1970-01-01', 'YYYY-MM-DD')) DESC"
|
||||
else
|
||||
klass.order("created_at DESC, username")
|
||||
order << "created_at DESC"
|
||||
end
|
||||
|
||||
order << "username"
|
||||
|
||||
klass.order(order.reject(&:blank?).join(","))
|
||||
end
|
||||
|
||||
def filter_by_trust
|
||||
|
|
Loading…
Reference in New Issue