From d25c8f08ff131c1c539274eb1fe25a255d291fe1 Mon Sep 17 00:00:00 2001 From: ichuang Date: Tue, 5 Jun 2012 23:15:08 -0400 Subject: [PATCH] fixes to quickedit and dogfood to use new static/coffee/* and ajax --- lib/dogfood/check.py | 2 +- lib/dogfood/views.py | 12 ++++--- templates/dogfood.html | 57 ++++++++++++++++++++++-------- templates/quickedit.html | 75 +++++++++++++++++++++++++++++----------- 4 files changed, 106 insertions(+), 40 deletions(-) diff --git a/lib/dogfood/check.py b/lib/dogfood/check.py index 53f11fc322..574a01e0b0 100644 --- a/lib/dogfood/check.py +++ b/lib/dogfood/check.py @@ -28,7 +28,7 @@ def check_problem_code(ans,the_lcp,correct_answers,false_answers): msg += '
' endmsg = """

Note: if the code text box disappears after clicking on "Check", - please click on "Show Answer" to make it refresh properly. This is a + please type something in the box to make it refresh properly. This is a bug with Chrome; it does not happen with Firefox. It is being fixed.

""" diff --git a/lib/dogfood/views.py b/lib/dogfood/views.py index 11f8adbf0b..ca9c89c0dc 100644 --- a/lib/dogfood/views.py +++ b/lib/dogfood/views.py @@ -187,6 +187,7 @@ def quickedit(request, id=None, qetemplate='quickedit.html',coursename=None): xml, id, state=None) + log.info('ajax_url = ' + instance.ajax_url) # create empty student state for this problem, if not previously existing s = StudentModule.objects.filter(student=request.user, @@ -242,9 +243,10 @@ def quickedit(request, id=None, qetemplate='quickedit.html',coursename=None): lcp = instance.lcp # get the rendered problem HTML - phtml = instance.get_problem_html() - init_js = instance.get_init_js() - destory_js = instance.get_destroy_js() + phtml = instance.get_html() + # phtml = instance.get_problem_html() + # init_js = instance.get_init_js() + # destory_js = instance.get_destroy_js() context = {'id':id, 'msg' : msg, @@ -252,8 +254,8 @@ def quickedit(request, id=None, qetemplate='quickedit.html',coursename=None): 'filename' : lcp.fileobject.name, 'pxmls' : pxmls, 'phtml' : phtml, - "destroy_js":destory_js, - 'init_js':init_js, + "destroy_js":'', + 'init_js':'', 'csrf':csrf(request)['csrf_token'], } diff --git a/templates/dogfood.html b/templates/dogfood.html index 178360e75b..301f319cf0 100644 --- a/templates/dogfood.html +++ b/templates/dogfood.html @@ -10,28 +10,53 @@ ## ## - - - +% if settings.MITX_FEATURES['USE_DJANGO_PIPELINE']: +## <%static:css group='application'/> +% endif + +% if not settings.MITX_FEATURES['USE_DJANGO_PIPELINE']: +## +% endif + + + - - - - - - +% if settings.MITX_FEATURES['USE_DJANGO_PIPELINE']: + <%static:js group='application'/> +% endif + +% if not settings.MITX_FEATURES['USE_DJANGO_PIPELINE']: + % for jsfn in [ '/static/%s' % x.replace('.coffee','.js') for x in settings.PIPELINE_JS['application']['source_filenames'] ]: + + % endfor +% endif + +## codemirror + + + +## alternate codemirror +## +## +## + +## image input: for clicking on images (see imageinput.html) + + <%include file="mathjax_include.html" /> - + +
+ ## ----------------------------------------------------------------------------- ## information @@ -90,15 +115,19 @@ } -
- ${phtml} -
+ + +
+
+ ${phtml} +
+
- +## diff --git a/templates/quickedit.html b/templates/quickedit.html index 08c9277bdd..ff44108a4f 100644 --- a/templates/quickedit.html +++ b/templates/quickedit.html @@ -11,18 +11,47 @@ ## ## - +% if settings.MITX_FEATURES['USE_DJANGO_PIPELINE']: + <%static:css group='application'/> +% endif - - +% if not settings.MITX_FEATURES['USE_DJANGO_PIPELINE']: +## +% endif + + + - - - - - - +% if settings.MITX_FEATURES['USE_DJANGO_PIPELINE']: + <%static:js group='application'/> +% endif + +% if not settings.MITX_FEATURES['USE_DJANGO_PIPELINE']: + % for jsfn in [ '/static/%s' % x.replace('.coffee','.js') for x in settings.PIPELINE_JS['application']['source_filenames'] ]: + + % endfor +% endif + +## codemirror + + + +## alternate codemirror +## +## +## + +## image input: for clicking on images (see imageinput.html) + + +## + + <%block name="headextra"/> @@ -30,14 +59,10 @@ It can't be run through static.url because MathJax uses crazy url introspection to do lazy loading of MathJax extension libraries --> <%include file="mathjax_include.html" /> -## - + - -
-
- ${phtml} -
-
+ + +
+
+
+ ${phtml} +
+
+
- +## + + + + <%block name="js_extra"/>