2014-07-23 05:41:31 -05:00
|
|
|
var TransferOwnerController = Ember.Controller.extend({
|
|
|
|
actions: {
|
|
|
|
confirmAccept: function () {
|
|
|
|
var user = this.get('model'),
|
2014-07-30 10:40:30 -05:00
|
|
|
url = this.get('ghostPaths.url').api('users', 'owner'),
|
2014-07-23 05:41:31 -05:00
|
|
|
self = this;
|
|
|
|
|
2014-07-26 00:12:37 -05:00
|
|
|
self.get('popover').closePopovers();
|
|
|
|
|
2014-07-30 10:40:30 -05:00
|
|
|
ic.ajax.request(url, {
|
|
|
|
type: 'PUT',
|
|
|
|
data: {
|
|
|
|
owner: [{
|
|
|
|
'id': user.get('id')
|
|
|
|
}]
|
|
|
|
}
|
2014-07-26 00:12:37 -05:00
|
|
|
}).then(function () {
|
2014-07-23 05:41:31 -05:00
|
|
|
self.notifications.closePassive();
|
2014-07-26 00:12:37 -05:00
|
|
|
self.notifications.showSuccess('Ownership successfully transferred to ' + user.get('name'));
|
2014-07-30 10:40:30 -05:00
|
|
|
}).catch(function (error) {
|
2014-07-23 05:41:31 -05:00
|
|
|
self.notifications.closePassive();
|
2014-07-30 10:40:30 -05:00
|
|
|
self.notifications.showAPIError(error);
|
2014-07-23 05:41:31 -05:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
confirmReject: function () {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
confirm: {
|
|
|
|
accept: {
|
|
|
|
text: 'YEP - I\'M SURE',
|
|
|
|
buttonClass: 'button-delete'
|
|
|
|
},
|
|
|
|
reject: {
|
|
|
|
text: 'CANCEL',
|
|
|
|
buttonClass: 'button'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default TransferOwnerController;
|