2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
2014-07-25 11:52:17 +04:00
|
|
|
var CurrentUserSettings = Ember.Mixin.create({
|
2014-10-25 01:09:50 +04:00
|
|
|
currentUser: function () {
|
|
|
|
return this.store.find('user', 'me');
|
|
|
|
},
|
2014-07-25 11:52:17 +04:00
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
transitionAuthor: function () {
|
|
|
|
var self = this;
|
2014-07-25 11:52:17 +04:00
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
return function (user) {
|
|
|
|
if (user.get('isAuthor')) {
|
|
|
|
return self.transitionTo('settings.users.user', user);
|
|
|
|
}
|
2014-07-25 11:52:17 +04:00
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
return user;
|
|
|
|
};
|
|
|
|
},
|
2014-07-25 11:52:17 +04:00
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
transitionEditor: function () {
|
|
|
|
var self = this;
|
2014-07-25 11:52:17 +04:00
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
return function (user) {
|
|
|
|
if (user.get('isEditor')) {
|
|
|
|
return self.transitionTo('settings.users');
|
|
|
|
}
|
2014-07-25 11:52:17 +04:00
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
return user;
|
|
|
|
};
|
|
|
|
}
|
2014-07-25 11:52:17 +04:00
|
|
|
});
|
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
export default CurrentUserSettings;
|