mirror of
https://github.com/discourse/discourse.git
synced 2025-08-21 19:11:18 +08:00
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
5 changed files with 39 additions and 16 deletions
|
@ -26,7 +26,8 @@ export default Ember.Component.extend({
|
||||||
this.set("otherAccountsLoading", true);
|
this.set("otherAccountsLoading", true);
|
||||||
Discourse.AdminUser.findAll("active", {
|
Discourse.AdminUser.findAll("active", {
|
||||||
"ip": this.get("ip"),
|
"ip": this.get("ip"),
|
||||||
"exclude": this.get("user_id")
|
"exclude": this.get("user_id"),
|
||||||
|
"order": "trust_level DESC"
|
||||||
}).then(function (users) {
|
}).then(function (users) {
|
||||||
self.setProperties({
|
self.setProperties({
|
||||||
other_accounts: users,
|
other_accounts: users,
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if show}}
|
{{#if show}}
|
||||||
<div class="location-box">
|
<div class="location-box">
|
||||||
|
<a class="close" {{action "hide"}}>{{fa-icon "times"}}</a>
|
||||||
<h4>{{i18n ip_lookup.title}}</h4>
|
<h4>{{i18n ip_lookup.title}}</h4>
|
||||||
<dl>
|
<dl>
|
||||||
{{#if location}}
|
{{#if location}}
|
||||||
|
@ -40,21 +41,33 @@
|
||||||
<dd class="other-accounts">
|
<dd class="other-accounts">
|
||||||
{{#loading-spinner size="small" condition=otherAccountsLoading}}
|
{{#loading-spinner size="small" condition=otherAccountsLoading}}
|
||||||
{{#if other_accounts}}
|
{{#if other_accounts}}
|
||||||
<ul>
|
<table class="table table-condensed table-hover">
|
||||||
{{#each other_accounts}}
|
<thead>
|
||||||
<li>
|
<tr>
|
||||||
{{#link-to "adminUser" this}}{{avatar this usernamePath="user.username" imageSize="small"}} {{username}}{{/link-to}}
|
<th>{{i18n ip_lookup.username}}</th>
|
||||||
({{trustLevel.name}}),
|
<th>{{i18n ip_lookup.trust_level}}</th>
|
||||||
<strong>{{i18n ip_lookup.read_time}}</strong> {{time_read}},
|
<th>{{i18n ip_lookup.read_time}}</th>
|
||||||
<strong>{{i18n ip_lookup.topics_entered}}</strong> {{topics_entered}}
|
<th>{{i18n ip_lookup.topics_entered}}</th>
|
||||||
</li>
|
<th>{{i18n ip_lookup.post_count}}</th>
|
||||||
{{/each}}
|
</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}}
|
{{else}}
|
||||||
{{i18n ip_lookup.no_other_accounts}}
|
{{i18n ip_lookup.no_other_accounts}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/loading-spinner}}
|
{{/loading-spinner}}
|
||||||
<dd>
|
<dd>
|
||||||
</dl>
|
</dl>
|
||||||
<button class="btn close" {{action "hide"}}>{{i18n close}}</button>
|
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -30,7 +30,7 @@ class AdminUserSerializer < BasicUserSerializer
|
||||||
|
|
||||||
has_one :single_sign_on_record, serializer: SingleSignOnRecordSerializer, embed: :objects
|
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
|
attributes sym
|
||||||
define_method sym do
|
define_method sym do
|
||||||
object.user_stat.send(sym)
|
object.user_stat.send(sym)
|
||||||
|
|
|
@ -280,8 +280,11 @@ en:
|
||||||
phone: Phone
|
phone: Phone
|
||||||
other_accounts: "Other accounts with this IP address:"
|
other_accounts: "Other accounts with this IP address:"
|
||||||
no_other_accounts: (none)
|
no_other_accounts: (none)
|
||||||
read_time: "read time:"
|
username: "username"
|
||||||
topics_entered: "topics entered:"
|
trust_level: "TL"
|
||||||
|
read_time: "read time"
|
||||||
|
topics_entered: "topics entered"
|
||||||
|
post_count: "# posts"
|
||||||
|
|
||||||
user:
|
user:
|
||||||
said: "{{username}}:"
|
said: "{{username}}:"
|
||||||
|
|
|
@ -10,11 +10,17 @@ class AdminUserIndexQuery
|
||||||
attr_reader :params, :trust_levels
|
attr_reader :params, :trust_levels
|
||||||
|
|
||||||
def initialize_query_with_order(klass)
|
def initialize_query_with_order(klass)
|
||||||
|
order = [params[:order]]
|
||||||
|
|
||||||
if params[:query] == "active"
|
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
|
else
|
||||||
klass.order("created_at DESC, username")
|
order << "created_at DESC"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
order << "username"
|
||||||
|
|
||||||
|
klass.order(order.reject(&:blank?).join(","))
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter_by_trust
|
def filter_by_trust
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue