UX: User directory tweaks.
Also includes Better refresh semantics for query params (avoids transition)
This commit is contained in:
parent
1931850151
commit
326dff6068
|
@ -2,6 +2,18 @@ import showModal from 'discourse/lib/show-modal';
|
||||||
|
|
||||||
const DiscourseRoute = Ember.Route.extend({
|
const DiscourseRoute = Ember.Route.extend({
|
||||||
|
|
||||||
|
refreshModel: null,
|
||||||
|
|
||||||
|
refresh: function() {
|
||||||
|
// Implement `refreshModel` to avoid a full transition to ourselves
|
||||||
|
if (!this.refreshModel) { return this._super(); }
|
||||||
|
|
||||||
|
if (!this.router.router.activeTransition) {
|
||||||
|
const params = this.controller.getProperties(Object.keys(this.queryParams));
|
||||||
|
this.refreshModel(params);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
NOT called every time we enter a route on Discourse.
|
NOT called every time we enter a route on Discourse.
|
||||||
Only called the FIRST time we enter a route.
|
Only called the FIRST time we enter a route.
|
||||||
|
|
|
@ -2,16 +2,18 @@ export default Discourse.Route.extend({
|
||||||
queryParams: {
|
queryParams: {
|
||||||
period: { refreshModel: true },
|
period: { refreshModel: true },
|
||||||
order: { refreshModel: true },
|
order: { refreshModel: true },
|
||||||
asc: { refreshModel: true },
|
asc: { refreshModel: true }
|
||||||
|
},
|
||||||
|
|
||||||
|
refreshModel(params) {
|
||||||
|
const controller = this.controllerFor('users');
|
||||||
|
controller.set('model.loading', true);
|
||||||
|
|
||||||
|
this.model(params).then(model => this.setupController(controller, model));
|
||||||
},
|
},
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
// If we refresh via `refreshModel` set the old model to loading
|
// If we refresh via `refreshModel` set the old model to loading
|
||||||
const existing = this.modelFor('users');
|
|
||||||
if (existing) {
|
|
||||||
existing.set('loading', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._period = params.period;
|
this._period = params.period;
|
||||||
return this.store.find('directoryItem', params);
|
return this.store.find('directoryItem', params);
|
||||||
},
|
},
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<td>{{number item.model.post_count}}</td>
|
<td>{{number item.model.post_count}}</td>
|
||||||
<td>{{number item.model.topics_entered}}</td>
|
<td>{{number item.model.topics_entered}}</td>
|
||||||
{{#if showTimeRead}}
|
{{#if showTimeRead}}
|
||||||
<td>{{unbound item.model.time_read}}</td>
|
<td><span class='time-read'>{{unbound item.model.time_read}}</span></td>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
|
@ -22,7 +22,11 @@
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
border-bottom: 1px solid scale-color-diff();
|
border-bottom: 1px solid scale-color-diff();
|
||||||
vertical-align: top;
|
|
||||||
|
.number, .time-read {
|
||||||
|
font-size: 1.4em;
|
||||||
|
color: darken(scale-color-diff(), 40%);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tr.me {
|
tr.me {
|
||||||
|
@ -41,7 +45,7 @@
|
||||||
margin-right: 0.5em;
|
margin-right: 0.5em;
|
||||||
}
|
}
|
||||||
i.fa-chevron-down, i.fa-chevron-up {
|
i.fa-chevron-down, i.fa-chevron-up {
|
||||||
margin-left: 1em;
|
margin-left: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|
|
@ -239,8 +239,8 @@ en:
|
||||||
|
|
||||||
directory:
|
directory:
|
||||||
title: "User Directory"
|
title: "User Directory"
|
||||||
likes_given: "Likes Given"
|
likes_given: "Given"
|
||||||
likes_received: "Likes Received"
|
likes_received: "Received"
|
||||||
topics_entered: "Topics Entered"
|
topics_entered: "Topics Entered"
|
||||||
time_read: "Time Read"
|
time_read: "Time Read"
|
||||||
topic_count: "Topics"
|
topic_count: "Topics"
|
||||||
|
|
Loading…
Reference in New Issue