#41: spinner implemented for menu loading

This commit is contained in:
Jason White 2015-10-23 15:15:57 -05:00
parent 648bd3bb95
commit 3c1336a033

View File

@ -16,14 +16,26 @@ define(['jquery',
//TODO: set template //TODO: set template
initialize: function() { initialize: function() {
this.collection = new MenuCollection(); this.collection = new MenuCollection();
this.addSpinner();
this.listenTo(this.collection,'menuData:loaded',this.render); this.listenTo(this.collection,'menuData:loaded',this.render);
// this.listenTo(this,'menu:click',this.accordionMenu); // this.listenTo(this,'menu:click',this.accordionMenu);
this.curLessonLinkId = ''; this.curLessonLinkId = '';
}, },
addSpinner: function() {
//<i class="fa fa-spinner fa-spin"></i>
this.$el.append($('<i>',{class:'fa fa-3x fa-spinner fa-spin'}));
},
removeSpinner: function() {
this.$el.find('i.fa-spinner').remove();
},
// rendering top level menu // rendering top level menu
render: function (){ render: function (){
//for now, just brute force //for now, just brute force
//TODO: refactor into sub-views/components //TODO: refactor into sub-views/components
this.removeSpinner();
var items, catItems, stages; var items, catItems, stages;
items = this.collection.models; // top level items items = this.collection.models; // top level items
var menuMarkup = ''; var menuMarkup = '';