2014-03-30 23:07:05 -05:00
|
|
|
var ApplicationRoute = Ember.Route.extend({
|
|
|
|
actions: {
|
2014-05-14 18:36:13 -05:00
|
|
|
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'
|
|
|
|
});
|
2014-03-22 07:08:15 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
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;
|