2014-06-05 07:18:23 +04:00
|
|
|
// mixin used for routes to display a loading indicator when there is network activity
|
2014-10-25 01:09:50 +04:00
|
|
|
var loaderOptions,
|
|
|
|
loadingIndicator;
|
|
|
|
|
|
|
|
loaderOptions = {
|
|
|
|
showSpinner: false
|
2014-06-05 07:18:23 +04:00
|
|
|
};
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-06-05 07:18:23 +04:00
|
|
|
NProgress.configure(loaderOptions);
|
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
loadingIndicator = Ember.Mixin.create({
|
2014-06-05 07:18:23 +04:00
|
|
|
actions: {
|
|
|
|
|
|
|
|
loading: function () {
|
|
|
|
NProgress.start();
|
|
|
|
this.router.one('didTransition', function () {
|
|
|
|
NProgress.done();
|
|
|
|
});
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-06-05 07:18:23 +04:00
|
|
|
return true;
|
|
|
|
},
|
|
|
|
|
|
|
|
error: function () {
|
|
|
|
NProgress.done();
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-06-05 07:18:23 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
export default loadingIndicator;
|