mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
d874e79dbd
Closes #3279 - Switch from this.session.get('user') to this.store.find('user') and some further limiting until a custom user adapter is created - Switch the deactivate logic to rollback the used model - Pass the user as the model in the link-to in user list template
24 lines
720 B
JavaScript
24 lines
720 B
JavaScript
var SettingsUserRoute = Ember.Route.extend({
|
|
model: function (params) {
|
|
// TODO: Make custom user adapter that uses /api/users/:slug endpoint
|
|
// return this.store.find('user', { slug: params.slug });
|
|
|
|
// Instead, get all the users and then find by slug
|
|
return this.store.find('user').then(function (result) {
|
|
return result.findBy('slug', params.slug);
|
|
});
|
|
},
|
|
|
|
deactivate: function () {
|
|
var model = this.modelFor('settings.users.user');
|
|
|
|
// we want to revert any unsaved changes on exit
|
|
if (model && model.get('isDirty')) {
|
|
model.rollback();
|
|
}
|
|
|
|
this._super();
|
|
}
|
|
});
|
|
|
|
export default SettingsUserRoute;
|