Commit 3620fd93 by Vik Paruchuri

Create a result container and put results into it

parent 24bfe440
...@@ -248,6 +248,14 @@ class CombinedOpenEndedModule(XModule): ...@@ -248,6 +248,14 @@ class CombinedOpenEndedModule(XModule):
pass pass
return return_html return return_html
def get_results(self, get):
task_number=get['task_number']
self.update_task_states()
response_dict=self.get_last_response(task_number)
context = {'results' : response_dict['post_assessment']}
html = render_to_string('combined_open_ended_results.html', context)
return html
def handle_ajax(self, dispatch, get): def handle_ajax(self, dispatch, get):
""" """
This is called by courseware.module_render, to handle an AJAX call. This is called by courseware.module_render, to handle an AJAX call.
...@@ -262,6 +270,7 @@ class CombinedOpenEndedModule(XModule): ...@@ -262,6 +270,7 @@ class CombinedOpenEndedModule(XModule):
handlers = { handlers = {
'next_problem': self.next_problem, 'next_problem': self.next_problem,
'reset': self.reset, 'reset': self.reset,
'get_results' : self.get_results
} }
if dispatch not in handlers: if dispatch not in handlers:
......
...@@ -32,6 +32,13 @@ section.combined-open-ended { ...@@ -32,6 +32,13 @@ section.combined-open-ended {
width: 53%; width: 53%;
} }
.result-container
{
float:left;
width: 93%;
position:relative;
}
&:after &:after
{ {
content:"."; content:".";
......
...@@ -18,11 +18,17 @@ class @CombinedOpenEnded ...@@ -18,11 +18,17 @@ class @CombinedOpenEnded
@reset_button.click @reset @reset_button.click @reset
@next_problem_button = @$('.next-step-button') @next_problem_button = @$('.next-step-button')
@next_problem_button.click @next_problem @next_problem_button.click @next_problem
@show_results_button=@$('.show-results-button')
@show_results_button.click @show_results
# valid states: 'initial', 'assessing', 'post_assessment', 'done' # valid states: 'initial', 'assessing', 'post_assessment', 'done'
Collapsible.setCollapsibles(@el) Collapsible.setCollapsibles(@el)
@submit_evaluation_button = $('.submit-evaluation-button') @submit_evaluation_button = $('.submit-evaluation-button')
@submit_evaluation_button.click @message_post @submit_evaluation_button.click @message_post
@results_container = $('.result-container')
# Where to put the rubric once we load it # Where to put the rubric once we load it
@el = $(element).find('section.open-ended-child') @el = $(element).find('section.open-ended-child')
@errors_area = @$('.error') @errors_area = @$('.error')
...@@ -49,6 +55,17 @@ class @CombinedOpenEnded ...@@ -49,6 +55,17 @@ class @CombinedOpenEnded
$: (selector) -> $: (selector) ->
$(selector, @el) $(selector, @el)
show_results: (event) =>
status_item = $(event.target).parent().parent()
status_number = status_item.data('status-number')
data = {'task_number' : status_number}
$.postWithPrefix "#{@ajax_url}/get_results", data, (response) =>
if response.success
@results_container.after(response.html).remove()
@Collapsible.setCollapsibles(@results_container)
else
@errors_area.html(response.error)
rebind: () => rebind: () =>
# rebind to the appropriate function for the current state # rebind to the appropriate function for the current state
@submit_button.unbind('click') @submit_button.unbind('click')
......
...@@ -15,5 +15,9 @@ ...@@ -15,5 +15,9 @@
<input type="button" value="Reset" class="reset-button" name="reset"/> <input type="button" value="Reset" class="reset-button" name="reset"/>
<input type="button" value="Next Step" class="next-step-button" name="reset"/> <input type="button" value="Next Step" class="next-step-button" name="reset"/>
</div> </div>
<div class="result-container">
<h4>Results</h4><br/>
</div>
</section> </section>
<div class="result-container">
${results | n}
</div>
\ No newline at end of file
...@@ -9,13 +9,8 @@ ...@@ -9,13 +9,8 @@
Step ${status['task_number']} (${status['human_state']}) : ${status['score']} / ${status['max_score']} Step ${status['task_number']} (${status['human_state']}) : ${status['score']} / ${status['max_score']}
%if status['type']=="openended": %if status['type']=="openended":
<div class="collapsible external-grader-message"> <div class="show-results">
<header> <a href="#" class="show-results-button">Show results from step ${status['task_number']}</a>
<a href="#">Show feedback from step ${status['task_number']}</a>
</header>
<section id="post-assessment">
${status['post_assessment']}
</section>
</div> </div>
%endif %endif
</div> </div>
......
...@@ -20,4 +20,4 @@ ...@@ -20,4 +20,4 @@
<input type="button" value="Submit Feedback" class="submit-evaluation-button" name="reset"/> <input type="button" value="Submit Feedback" class="submit-evaluation-button" name="reset"/>
</section> </section>
</div> </div>
</div> </div>incorrect-icon.png
\ No newline at end of file \ No newline at end of file
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