discourse/app/assets/javascripts/admin/controllers/admin-users-list-show.js.es6

47 lines
1.1 KiB
Plaintext
Raw Normal View History

2018-06-15 23:03:24 +08:00
import debounce from "discourse/lib/debounce";
import { i18n } from "discourse/lib/computed";
import AdminUser from "admin/models/admin-user";
import CanCheckEmails from "discourse/mixins/can-check-emails";
import computed from "ember-addons/ember-computed-decorators";
2015-08-08 03:08:27 +08:00
export default Ember.Controller.extend(CanCheckEmails, {
model: null,
query: null,
order: null,
ascending: null,
showEmails: false,
refreshing: false,
listFilter: null,
selectAll: false,
2018-06-15 23:03:24 +08:00
searchHint: i18n("search_hint"),
@computed("query")
title(query) {
return I18n.t("admin.users.titles." + query);
},
2015-08-11 05:11:27 +08:00
_filterUsers: debounce(function() {
this._refreshUsers();
2018-06-15 23:03:24 +08:00
}, 250).observes("listFilter"),
_refreshUsers() {
2018-06-15 23:03:24 +08:00
this.set("refreshing", true);
AdminUser.findAll(this.query, {
filter: this.listFilter,
show_emails: this.showEmails,
order: this.order,
ascending: this.ascending
2018-06-15 23:03:24 +08:00
})
.then(result => this.set("model", result))
.finally(() => this.set("refreshing", false));
},
actions: {
toggleEmailVisibility() {
this.toggleProperty("showEmails");
this._refreshUsers();
}
}
});