46 lines
1.5 KiB
JavaScript
46 lines
1.5 KiB
JavaScript
import { getOwner } from '@ember/application';
|
|
import Route from '@ember/routing/route';
|
|
import $ from 'jquery'
|
|
|
|
export default Route.extend({
|
|
getLoginRoute() {
|
|
return getOwner(this).lookup('route:login');
|
|
},
|
|
transitionIntercept(transition) {
|
|
if (transition.targetName !== 'login') {
|
|
this.getLoginRoute().set('prevTransition', transition);
|
|
}
|
|
},
|
|
beforeModel: function(transition) {
|
|
console.info('Before application model.', transition);
|
|
this.transitionIntercept(transition);
|
|
},
|
|
activate() {
|
|
const me = this;
|
|
console.info('Application activate.');
|
|
$('body').addClass('no-skin');
|
|
try{ace.settings.check('navbar', 'fixed');}catch(e){console.log(e)}
|
|
try{ace.settings.check('main-container', 'fixed');}catch(e){console.log(e)}
|
|
},
|
|
actions: {
|
|
loading(transition, originRoute) {
|
|
console.info('Application loading...');
|
|
// var appCtrl = this.controllerFor('application');
|
|
this.router.one('didTransition', function() {
|
|
// appCtrl.set('loading', false);
|
|
});
|
|
return true;
|
|
},
|
|
willTransition(transition) {
|
|
console.info('Application Will Transition.', transition);
|
|
this.transitionIntercept(transition);
|
|
},
|
|
goback() {
|
|
history.back();
|
|
},
|
|
reload() {
|
|
this.refresh();
|
|
}
|
|
}
|
|
});
|