2014-07-01 17:58:26 +02:00
|
|
|
var SettingsUserRoute = Ember.Route.extend({
|
2014-07-16 21:16:31 -05:00
|
|
|
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);
|
2014-07-01 17:58:26 +02:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
deactivate: function () {
|
2014-07-16 21:16:31 -05:00
|
|
|
var model = this.modelFor('settings.users.user');
|
2014-07-01 17:58:26 +02:00
|
|
|
|
|
|
|
// we want to revert any unsaved changes on exit
|
2014-07-16 21:16:31 -05:00
|
|
|
if (model && model.get('isDirty')) {
|
|
|
|
model.rollback();
|
|
|
|
}
|
|
|
|
|
|
|
|
this._super();
|
2014-07-01 17:58:26 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default SettingsUserRoute;
|