This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/routes/users.js.es6
Mark VanLandingham e5311ab645 DEV: Import DiscourseRoute rather than Discourse.Route (#8225)
* DEV: Discourse.Route -> DiscourseRoute with import

* ran prettier on all routes

* prettiered one more file
2019-10-22 09:46:10 -04:00

60 lines
1.3 KiB
JavaScript

import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
queryParams: {
period: { refreshModel: true },
order: { refreshModel: true },
asc: { refreshModel: true },
name: { refreshModel: true, replace: true },
group: { refreshModel: true },
exclude_usernames: { refreshModel: true }
},
refreshQueryWithoutTransition: true,
titleToken() {
return I18n.t("directory.title");
},
resetController(controller, isExiting) {
if (isExiting) {
controller.setProperties({
period: "weekly",
order: "likes_received",
asc: null,
name: "",
group: null,
exclude_usernames: null
});
}
},
beforeModel() {
if (this.siteSettings.hide_user_profiles_from_public && !this.currentUser) {
this.replaceWith("discovery");
}
},
model(params) {
// If we refresh via `refreshModel` set the old model to loading
this._params = params;
return this.store.find("directoryItem", params);
},
setupController(controller, model) {
const params = this._params;
controller.setProperties({
model,
period: params.period,
nameInput: params.name
});
},
actions: {
didTransition() {
this.controllerFor("users")._showFooter();
return true;
}
}
});