Commit 2a2e33df by Chris Dodge Committed by Muhammad Shoaib

Adjust lifecycle to make it work in Instructor Dashboard

parent 8aeb38da
......@@ -5,12 +5,4 @@ $(function() {
model: new ProctoredExamModel()
});
proctored_exam_view.render();
var container = $(".special-allowance-container");
var course_id = container.data('course-id');
var proctored_exam_allowance_view = new edx.instructor_dashboard.proctoring.ProctoredExamAllowanceView({
el: container,
allowance_template_url: '/static/proctoring/templates/add-allowance.underscore',
course_id: course_id
});
});
......@@ -8,10 +8,14 @@ var edx = edx || {};
edx.instructor_dashboard.proctoring.ProctoredExamAllowanceView = Backbone.View.extend({
initialize: function (options) {
this.$el = options.el;
this.collection = new edx.instructor_dashboard.proctoring.ProctoredExamAllowanceCollection();
this.course_id = options.course_id;
this.tempate_url = options.allowance_template_url;
/* unfortunately we have to make some assumptions about what is being set up in HTML */
this.$el = $('.special-allowance-container');
this.course_id = this.$el.data('course-id');
/* this should be moved to a 'data' attribute in HTML */
this.tempate_url = '/static/proctoring/templates/add-allowance.underscore';
this.template = null;
/* re-render if the model changes */
......@@ -25,6 +29,21 @@ var edx = edx || {};
this.collection.url = this.collection.url + '/' + this.course_id;
},
/*
This entry point is required for Instructor Dashboard
See setup_instructor_dashboard_sections() in
instructor_dashboard.coffee (in edx-platform)
*/
constructor: function(section){
/* the Instructor Dashboard javascript expects this to be set up */
$(section).data('wrapper', this);
this.initialize({});
},
onClickTitle: function(){
// called when this is selected in the instructor dashboard
return;
},
loadTemplateData: function(){
var self = this;
$.ajax({url: self.tempate_url, dataType: "html"})
......@@ -60,5 +79,4 @@ var edx = edx || {};
}
}
});
this.edx.instructor_dashboard.proctoring.ProctoredExamAllowanceView = edx.instructor_dashboard.proctoring.ProctoredExamAllowanceView;
}).call(this, Backbone, $, _);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment