mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-12 16:14:25 +03:00
a4f8088697
closes #2417 - Adds Notification(s)Component - Render notifications in application.hbs - Adds handleError in application route
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
var ApplicationRoute = Ember.Route.extend({
|
|
actions: {
|
|
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');
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
export default ApplicationRoute; |