2014-12-20 14:26:46 +08:00
|
|
|
import Ember from 'ember';
|
2015-01-30 09:51:18 +08:00
|
|
|
import ApplicationRouteMixin from 'simple-auth/mixins/application-route-mixin';
|
|
|
|
|
|
|
|
export default Ember.Route.extend(ApplicationRouteMixin, {
|
2015-02-10 15:35:40 +08:00
|
|
|
actions: {
|
|
|
|
login: function() {
|
|
|
|
this.controllerFor('login').set('error', null);
|
|
|
|
this.send('showModal', 'login');
|
|
|
|
},
|
2015-01-30 09:51:18 +08:00
|
|
|
|
2015-02-10 15:35:40 +08:00
|
|
|
signup: function() {
|
|
|
|
this.controllerFor('signup').set('error', null);
|
|
|
|
this.send('showModal', 'signup');
|
|
|
|
},
|
2015-02-08 13:29:39 +08:00
|
|
|
|
2015-02-10 15:35:40 +08:00
|
|
|
showModal: function(name) {
|
|
|
|
this.render(name, {
|
|
|
|
into: 'application',
|
|
|
|
outlet: 'modal'
|
|
|
|
});
|
|
|
|
this.controllerFor('application').set('modalController', this.controllerFor(name));
|
|
|
|
},
|
2015-02-08 13:29:39 +08:00
|
|
|
|
2015-02-10 15:35:40 +08:00
|
|
|
closeModal: function() {
|
|
|
|
this.controllerFor('application').set('modalController', null);
|
|
|
|
},
|
2015-01-30 09:51:18 +08:00
|
|
|
|
2015-02-10 15:35:40 +08:00
|
|
|
destroyModal: function() {
|
|
|
|
this.disconnectOutlet({
|
|
|
|
outlet: 'modal',
|
|
|
|
parentView: 'application'
|
|
|
|
});
|
|
|
|
},
|
2015-02-08 13:29:39 +08:00
|
|
|
|
2015-02-10 15:35:40 +08:00
|
|
|
sessionChanged: function() {
|
|
|
|
this.refresh();
|
|
|
|
}
|
|
|
|
}
|
2015-02-08 13:29:39 +08:00
|
|
|
});
|