0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00
ghost/core/client/routes/application.js

48 lines
1.4 KiB
JavaScript
Raw Normal View History

2014-03-30 23:07:05 -05:00
var ApplicationRoute = Ember.Route.extend({
actions: {
signedIn: function (user) {
this.container.lookup('user:current').setProperties(user);
},
signedOut: function () {
this.container.lookup('user:current').setProperties({
id: null,
name: null,
image: null
});
},
2014-03-30 23:07:05 -05:00
openModal: function (modalName, model) {
modalName = 'modals/' + modalName;
// We don't always require a modal to have a controller
// so we're skipping asserting if one exists
if (this.controllerFor(modalName, true)) {
this.controllerFor(modalName).set('model', model);
}
return this.render(modalName, {
into: 'application',
outlet: 'modal'
});
},
closeModal: function () {
return this.disconnectOutlet({
outlet: 'modal',
parentView: 'application'
});
},
handleErrors: function (errors) {
this.notifications.clear();
errors.forEach(function (errorObj) {
this.notifications.showError(errorObj.message || errorObj);
if (errorObj.hasOwnProperty('el')) {
errorObj.el.addClass('input-error');
}
});
2014-03-30 23:07:05 -05:00
}
}
});
export default ApplicationRoute;