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