#315 Adding UI handling and corresponding expected elements for html files for decoration. Inlucdes minor refactor

This commit is contained in:
Jason White
2017-01-25 11:18:24 -05:00
committed by Nanne Baars
parent dd76cb258c
commit ac16342c17
11 changed files with 361 additions and 345 deletions

View File

@ -64,8 +64,8 @@ define(['jquery',
this.listenTo(this.lessonContent,'content:loaded',this.onContentLoaded);
this.userAndInfoView = new UserAndInfoView();
this.menuButtonView = new MenuButtonView();
this.listenTo(this.lessonContentView, 'lesson:complete', this.updateMenu);
this.listenTo(this.lessonContentView, 'lesson:complete', this.updateLessonOverview);
this.listenTo(this.lessonContentView, 'assignment:complete', this.updateMenu);
this.listenTo(this.lessonContentView, 'assignment:complete', this.updateLessonOverview);
};
this.loadLesson = function(name,pageNum) {

View File

@ -114,13 +114,24 @@ define(['jquery',
this.renderFeedback(data.feedback);
this.renderOutput(data.output || "");
if (data.lessonCompleted) {
this.curForm.reset();
this.trigger('lesson:complete');
if (data.assignmentCompleted) {
this.markAssignmentComplete();
this.trigger('assignment:complete');
} else {
this.markAssignmentIncomplete();
}
return false;
},
markAssignmentComplete: function () {
this.curForm.reset();
$(this.curForm).siblings('.assignment-success').find('i').removeClass('hidden');
},
markAssignmentIncomplete: function () {
$(this.curForm).siblings('.assignment-success').find('i').addClass('hidden');
},
onErrorResponse: function (a,b,c) {
console.error(a);
console.error(b);

View File

@ -16,7 +16,7 @@ define(['jquery',
}
},
render: function () {
if (this.model.get("lessonCompleted")) {
if (this.model.get("assignmentCompleted")) {
this.$el.html(this.model.get('successMessage'));
} else {
this.$el.html("");