From 386835153bbe4ea5428cca6eb417fbd0a21deabf Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Tue, 17 Apr 2012 00:17:12 -0400 Subject: [PATCH 1/3] Added histogram graph for courseware administrators. --- djangoapps/courseware/module_render.py | 11 ++++++-- templates/courseware.html | 5 ++++ templates/staff_problem_histogram.js | 38 ++++++++++++++++++++++++++ templates/staff_problem_info.html | 4 +-- 4 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 templates/staff_problem_histogram.js diff --git a/djangoapps/courseware/module_render.py b/djangoapps/courseware/module_render.py index 38f9e0211b..d10d13637a 100644 --- a/djangoapps/courseware/module_render.py +++ b/djangoapps/courseware/module_render.py @@ -144,12 +144,17 @@ def render_x_module(user, request, xml_module, module_object_preload): module_object_preload.append(smod) # Grab content content = instance.get_html() + init_js = instance.get_init_js() + destory_js = instance.get_destroy_js() if user.is_staff: content=content+render_to_string("staff_problem_info.html", {'xml':etree.tostring(xml_module), - 'histogram':grade_histogram(module_id)}) + 'module_id' : module_id}) + init_js = init_js+render_to_string("staff_problem_histogram.js", {'histogram' : grade_histogram(module_id), + 'module_id' : module_id}) + content = {'content':content, - "destroy_js":instance.get_destroy_js(), - 'init_js':instance.get_init_js(), + "destroy_js":destory_js, + 'init_js':init_js, 'type':module_type} return content diff --git a/templates/courseware.html b/templates/courseware.html index ec4be8c6c4..d8972f0935 100644 --- a/templates/courseware.html +++ b/templates/courseware.html @@ -1,7 +1,12 @@ <%inherit file="main.html" /> <%block name="title">Courseware – MITx 6.002x +<%block name="headextra"> + + + <%block name="js_extra"> +##Is there a reason this isn't in header_extra? Is it important that the javascript is at the bottom of the generated document?