From 146e0919f12f6598d0a1553cb4bd0f56d8a6ec77 Mon Sep 17 00:00:00 2001 From: Vik Paruchuri Date: Mon, 7 Jan 2013 15:59:13 -0500 Subject: [PATCH] Work on alerts, transitions between pages --- .../xmodule/xmodule/combined_open_ended_module.py | 2 +- .../xmodule/js/src/combinedopenended/display.coffee | 12 +++++++++--- lms/templates/open_ended.html | 5 +++-- lms/templates/self_assessment_prompt.html | 5 +++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/common/lib/xmodule/xmodule/combined_open_ended_module.py b/common/lib/xmodule/xmodule/combined_open_ended_module.py index c47919095f..1761434a09 100644 --- a/common/lib/xmodule/xmodule/combined_open_ended_module.py +++ b/common/lib/xmodule/xmodule/combined_open_ended_module.py @@ -255,7 +255,7 @@ class CombinedOpenEndedModule(XModule): def next_problem(self, get): self.update_task_states() - return {'success' : True} + return {'success' : True, 'html' : self.get_html()} def reset(self, get): """ diff --git a/common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee b/common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee index 4ad0bde631..94cbdd5fe4 100644 --- a/common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee @@ -1,6 +1,11 @@ class @CombinedOpenEnded constructor: (element) -> + @element=element + @reinitialize(element) + + reinitialize: (element) -> @el = $(element).find('section.combined-open-ended') + @combined_open_ended=$(element).find('section.combined-open-ended') @id = @el.data('id') @ajax_url = @el.data('ajax-url') @state = @el.data('state') @@ -12,7 +17,6 @@ class @CombinedOpenEnded @reset_button.click @reset @next_problem_button = @$('.next-step-button') @next_problem_button.click @next_problem - @combined_open_ended= @$('.combined-open-ended') # valid states: 'initial', 'assessing', 'post_assessment', 'done' # Where to put the rubric once we load it @@ -74,7 +78,7 @@ class @CombinedOpenEnded @hint_area.attr('disabled', true) @submit_button.hide() if @task_number<@task_count - @next_problem + @next_problem() else @reset_button.show() @@ -166,9 +170,11 @@ class @CombinedOpenEnded @hint_wrapper.html('') @message_wrapper.html('') @child_state = 'initial' + @combined_open_ended.html(response.html) + @reinitialize(@element) @rebind() @next_problem_button.hide() - location.reload() + @gentle_alert "Moved to next step." else @errors_area.html(response.error) else diff --git a/lms/templates/open_ended.html b/lms/templates/open_ended.html index 838c847841..2c0600cee0 100644 --- a/lms/templates/open_ended.html +++ b/lms/templates/open_ended.html @@ -24,6 +24,9 @@ +
+
+ @@ -51,6 +54,4 @@ % endif -
-
diff --git a/lms/templates/self_assessment_prompt.html b/lms/templates/self_assessment_prompt.html index d8186954a7..4ef057fa34 100644 --- a/lms/templates/self_assessment_prompt.html +++ b/lms/templates/self_assessment_prompt.html @@ -9,6 +9,9 @@ +
+
+
${initial_rubric}
${initial_hint}
@@ -16,6 +19,4 @@
${initial_message}
-
-