including restart lesson fix for lesson overview

This commit is contained in:
Jason White 2017-07-03 12:37:15 -04:00
parent daaf361dd2
commit 2e4e4ea716
3 changed files with 17 additions and 9 deletions

View File

@ -192,6 +192,7 @@ define(['jquery',
}).done(function(lessonLink) { }).done(function(lessonLink) {
self.loadLesson(self.name); self.loadLesson(self.name);
self.updateMenu(); self.updateMenu();
self.callPaginationUpdate();
}); });
}; };
@ -200,9 +201,14 @@ define(['jquery',
this.lessonContentView.showTestParam(param); this.lessonContentView.showTestParam(param);
}; };
this.callPaginationUpdate = function () {
this.lessonContentView.updatePagination();
}
}; };
return Controller; return Controller;
}); });

View File

@ -60,6 +60,9 @@ define(['jquery',
this.paginationControlView = new PaginationControlView(this.$contentPages,this.model.get('lessonUrl')); this.paginationControlView = new PaginationControlView(this.$contentPages,this.model.get('lessonUrl'));
}, },
updatePagination: function() {
this.paginationControlView.updateCollection();
},
getCurrentPage: function () { getCurrentPage: function () {
return this.currentPage; return this.currentPage;
@ -121,7 +124,7 @@ define(['jquery',
markAssignmentComplete: function () { markAssignmentComplete: function () {
this.curForm.reset(); this.curForm.reset();
$(this.curForm).siblings('.assignment-success').find('i').removeClass('hidden'); $(this.curForm).siblings('.assignment-success').find('i').removeClass('hidden');
this.paginationControlView.updateModel(); this.paginationControlView.updateCollection();
}, },
markAssignmentIncomplete: function () { markAssignmentIncomplete: function () {

View File

@ -15,13 +15,12 @@ define(['jquery',
initialize: function ($contentPages,baseLessonUrl) { initialize: function ($contentPages,baseLessonUrl) {
this.$contentPages = $contentPages; this.$contentPages = $contentPages;
this.collection = new LessonOverviewCollection(); this.collection = new LessonOverviewCollection();
this.listenTo(this.collection, 'change add reset delete update', this.render); this.listenTo(this.collection, 'reset', this.render);
this.numPages = this.$contentPages.length; this.numPages = this.$contentPages.length;
this.baseUrl = baseLessonUrl; this.baseUrl = baseLessonUrl;
this.collection.fetch({reset:true});
this.collection.fetch();
this.initPagination(); this.initPagination();
this.render(); //this.render();
}, },
render: function (e) { render: function (e) {
@ -32,8 +31,8 @@ define(['jquery',
this.hideShowNavButtons(); this.hideShowNavButtons();
}, },
updateModel: function() { updateCollection: function() {
this.collection.fetch(); this.collection.fetch({reset:true});
}, },
bindNavButtons: function() { bindNavButtons: function() {
@ -142,7 +141,7 @@ define(['jquery',
this.hideNextPageButton(); this.hideNextPageButton();
this.showPrevPageButton; this.showPrevPageButton;
} }
this.model.fetch(); this.collection.fetch({reset:true});
}, },
decrementPageView: function() { decrementPageView: function() {
@ -159,7 +158,7 @@ define(['jquery',
this.hidePrevPageButton(); this.hidePrevPageButton();
this.showNextPageButton() this.showNextPageButton()
} }
this.model.fetch(); this.collection.fetch({reset:true});
}, },
hideShowNavButtons: function () { hideShowNavButtons: function () {