Pagination fixes, lesson completion update
This commit is contained in:
parent
2803607901
commit
22a76624e6
@ -910,6 +910,10 @@ cookie-container {
|
|||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.show-prev-page {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.show-prev-page:hover {
|
.show-prev-page:hover {
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ define(['jquery',
|
|||||||
this.lessonContent = new LessonContentModel();
|
this.lessonContent = new LessonContentModel();
|
||||||
this.lessonProgressModel = new LessonProgressModel();
|
this.lessonProgressModel = new LessonProgressModel();
|
||||||
this.lessonProgressView = new LessonProgressView(this.lessonProgressModel);
|
this.lessonProgressView = new LessonProgressView(this.lessonProgressModel);
|
||||||
this.lessonView = options.lessonView;
|
this.lessonContentView = options.lessonContentView;
|
||||||
this.developerControlsView = new DeveloperControlsView();
|
this.developerControlsView = new DeveloperControlsView();
|
||||||
|
|
||||||
_.extend(Controller.prototype,Backbone.Events);
|
_.extend(Controller.prototype,Backbone.Events);
|
||||||
@ -69,10 +69,6 @@ define(['jquery',
|
|||||||
}
|
}
|
||||||
this.lessonContent.loadData({
|
this.lessonContent.loadData({
|
||||||
'name':name
|
'name':name
|
||||||
// 'scr': scr,
|
|
||||||
// 'menu': menu,
|
|
||||||
// 'stage': stage,
|
|
||||||
// 'num': num,
|
|
||||||
});
|
});
|
||||||
this.planView = {};
|
this.planView = {};
|
||||||
this.solutionView = {};
|
this.solutionView = {};
|
||||||
@ -96,6 +92,7 @@ define(['jquery',
|
|||||||
this.listenTo(this.helpControlsView,'source:show',this.hideShowHelps);
|
this.listenTo(this.helpControlsView,'source:show',this.hideShowHelps);
|
||||||
this.listenTo(this.helpControlsView,'lesson:restart',this.restartLesson);
|
this.listenTo(this.helpControlsView,'lesson:restart',this.restartLesson);
|
||||||
this.listenTo(this.developerControlsView, 'dev:labels', this.restartLesson);
|
this.listenTo(this.developerControlsView, 'dev:labels', this.restartLesson);
|
||||||
|
this.listenTo(this.lessonContentView, 'lesson:complete', this.updateMenu)
|
||||||
|
|
||||||
this.listenTo(this,'hints:show',this.onShowHints);
|
this.listenTo(this,'hints:show',this.onShowHints);
|
||||||
|
|
||||||
@ -104,14 +101,18 @@ define(['jquery',
|
|||||||
this.titleView.render(this.lessonInfoModel.get('lessonTitle'));
|
this.titleView.render(this.lessonInfoModel.get('lessonTitle'));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.updateMenu = function() {
|
||||||
|
this.trigger('menu:reload')
|
||||||
|
};
|
||||||
|
|
||||||
this.onContentLoaded = function(loadHelps) {
|
this.onContentLoaded = function(loadHelps) {
|
||||||
this.lessonInfoModel = new LessonInfoModel();
|
this.lessonInfoModel = new LessonInfoModel();
|
||||||
this.listenTo(this.lessonInfoModel,'info:loaded',this.onInfoLoaded);
|
this.listenTo(this.lessonInfoModel,'info:loaded',this.onInfoLoaded);
|
||||||
|
|
||||||
if (loadHelps) {
|
if (loadHelps) {
|
||||||
this.helpControlsView = null;
|
this.helpControlsView = null;
|
||||||
this.lessonView.model = this.lessonContent;
|
this.lessonContentView.model = this.lessonContent;
|
||||||
this.lessonView.render();
|
this.lessonContentView.render();
|
||||||
|
|
||||||
this.planView = new PlanView();
|
this.planView = new PlanView();
|
||||||
this.solutionView = new SolutionView();
|
this.solutionView = new SolutionView();
|
||||||
@ -179,7 +180,7 @@ define(['jquery',
|
|||||||
});
|
});
|
||||||
if (this.lessonInfoModel.get('numberHints') > 0) {
|
if (this.lessonInfoModel.get('numberHints') > 0) {
|
||||||
|
|
||||||
this.lessonView.$el.find('#show-hints-button').unbind().on('click',_.bind(this.showHints,this)).show();
|
this.lessonContentView.$el.find('#show-hints-button').unbind().on('click',_.bind(this.showHints,this)).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,7 @@ define(['jquery',
|
|||||||
MenuView,
|
MenuView,
|
||||||
DeveloperControlsView) {
|
DeveloperControlsView) {
|
||||||
|
|
||||||
var lessonView = new LessonContentView();
|
var lessonContentView = new LessonContentView();
|
||||||
var menuView = new MenuView();
|
var menuView = new MenuView();
|
||||||
var developerControlsView = new DeveloperControlsView();
|
var developerControlsView = new DeveloperControlsView();
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ define(['jquery',
|
|||||||
},
|
},
|
||||||
|
|
||||||
lessonController: new LessonController({
|
lessonController: new LessonController({
|
||||||
lessonView: lessonView
|
lessonContentView: lessonContentView
|
||||||
}),
|
}),
|
||||||
|
|
||||||
menuController: new MenuController({
|
menuController: new MenuController({
|
||||||
|
@ -75,8 +75,11 @@ define(['jquery',
|
|||||||
onSuccessResponse: function(data) {
|
onSuccessResponse: function(data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
this.renderFeedback(data.feedback);
|
this.renderFeedback(data.feedback);
|
||||||
// update menu if lessonCompleted is true
|
|
||||||
this.renderOutput(data.output || "");
|
this.renderOutput(data.output || "");
|
||||||
|
if (data.lessonComplete) {
|
||||||
|
this.trigger('lesson:complete');
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -107,17 +110,26 @@ define(['jquery',
|
|||||||
},
|
},
|
||||||
|
|
||||||
addPaginationControls: function() {
|
addPaginationControls: function() {
|
||||||
|
var pagingControlsDiv
|
||||||
|
this.$el.html();
|
||||||
this.$prevPageButton = $('<span>',{class:'glyphicon-class glyphicon glyphicon-circle-arrow-left show-prev-page'});
|
this.$prevPageButton = $('<span>',{class:'glyphicon-class glyphicon glyphicon-circle-arrow-left show-prev-page'});
|
||||||
this.$prevPageButton.unbind().on('click',this.decrementPageView.bind(this));
|
this.$prevPageButton.unbind().on('click',this.decrementPageView.bind(this));
|
||||||
|
|
||||||
this.$nextPageButton = $('<span>',{class:'glyphicon-class glyphicon glyphicon-circle-arrow-right show-next-page'});
|
this.$nextPageButton = $('<span>',{class:'glyphicon-class glyphicon glyphicon-circle-arrow-right show-next-page'});
|
||||||
this.$nextPageButton.unbind().on('click',this.incrementPageView.bind(this));
|
this.$nextPageButton.unbind().on('click',this.incrementPageView.bind(this));
|
||||||
|
|
||||||
var pagingControlsDiv = $('<div>',{class:'panel-body', id:'lessong-page-controls'});
|
if (this.$el.find('#lesson-page-controls').length < 1) {
|
||||||
|
pagingControlsDiv = $('<div>',{class:'panel-body', id:'lesson-page-controls'});
|
||||||
pagingControlsDiv.append(this.$prevPageButton);
|
pagingControlsDiv.append(this.$prevPageButton);
|
||||||
pagingControlsDiv.append(this.$nextPageButton);
|
pagingControlsDiv.append(this.$nextPageButton);
|
||||||
this.$el.append(pagingControlsDiv);
|
this.$el.append(pagingControlsDiv);
|
||||||
this.$prevPageButton.hide()
|
}
|
||||||
|
//
|
||||||
|
if (this.numPages > 0 ) {
|
||||||
|
this.$nextPageButton.show();
|
||||||
|
}
|
||||||
|
this.$prevPageButton.hide();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
incrementPageView: function() {
|
incrementPageView: function() {
|
||||||
@ -126,6 +138,10 @@ define(['jquery',
|
|||||||
this.showCurContentPage(true);
|
this.showCurContentPage(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.currentPage > 0) {
|
||||||
|
this.$prevPageButton.show();
|
||||||
|
}
|
||||||
|
|
||||||
if (this.currentPage >= this.numPages -1) {
|
if (this.currentPage >= this.numPages -1) {
|
||||||
this.$nextPageButton.hide();
|
this.$nextPageButton.hide();
|
||||||
this.$prevPageButton.show()
|
this.$prevPageButton.show()
|
||||||
@ -138,6 +154,10 @@ define(['jquery',
|
|||||||
this.showCurContentPage(false);
|
this.showCurContentPage(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.currentPage < this.numPages -1) {
|
||||||
|
this.$nextPageButton.show();
|
||||||
|
}
|
||||||
|
|
||||||
if (this.currentPage == 0) {
|
if (this.currentPage == 0) {
|
||||||
this.$prevPageButton.hide();
|
this.$prevPageButton.hide();
|
||||||
this.$nextPageButton.show();
|
this.$nextPageButton.show();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user