Commit b1726dae by Vik Paruchuri

Fix prompt UI in combined open ended to close by default and be collapsible

parent 5ef4af5a
...@@ -55,6 +55,9 @@ class @CombinedOpenEnded ...@@ -55,6 +55,9 @@ class @CombinedOpenEnded
@show_results_button=@$('.show-results-button') @show_results_button=@$('.show-results-button')
@show_results_button.click @show_results @show_results_button.click @show_results
@question_header = @$('.question-header')
@question_header.click @collapse_question
# 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')
...@@ -66,7 +69,7 @@ class @CombinedOpenEnded ...@@ -66,7 +69,7 @@ class @CombinedOpenEnded
@el = $(element).find('section.open-ended-child') @el = $(element).find('section.open-ended-child')
@errors_area = @$('.error') @errors_area = @$('.error')
@answer_area = @$('textarea.answer') @answer_area = @$('textarea.answer')
@prompt_container = @$('.prompt')
@rubric_wrapper = @$('.rubric-wrapper') @rubric_wrapper = @$('.rubric-wrapper')
@hint_wrapper = @$('.hint-wrapper') @hint_wrapper = @$('.hint-wrapper')
@message_wrapper = @$('.message-wrapper') @message_wrapper = @$('.message-wrapper')
...@@ -81,6 +84,11 @@ class @CombinedOpenEnded ...@@ -81,6 +84,11 @@ class @CombinedOpenEnded
@can_upload_files = false @can_upload_files = false
@open_ended_child= @$('.open-ended-child') @open_ended_child= @$('.open-ended-child')
if @task_number>1
@prompt_hide()
else if @task_number==1 and @child_state!='initial'
@prompt_hide()
@find_assessment_elements() @find_assessment_elements()
@find_hint_elements() @find_hint_elements()
...@@ -155,6 +163,8 @@ class @CombinedOpenEnded ...@@ -155,6 +163,8 @@ class @CombinedOpenEnded
@next_problem_button.hide() @next_problem_button.hide()
@hide_file_upload() @hide_file_upload()
@hint_area.attr('disabled', false) @hint_area.attr('disabled', false)
if @task_number==1 and @child_state=='assessing'
@prompt_hide()
if @child_state == 'done' if @child_state == 'done'
@rubric_wrapper.hide() @rubric_wrapper.hide()
if @child_type=="openended" if @child_type=="openended"
...@@ -389,3 +399,26 @@ class @CombinedOpenEnded ...@@ -389,3 +399,26 @@ class @CombinedOpenEnded
# wrap this so that it can be mocked # wrap this so that it can be mocked
reload: -> reload: ->
location.reload() location.reload()
collapse_question: () =>
@prompt_container.slideToggle()
@prompt_container.toggleClass('open')
if @question_header.text() == "(Hide)"
new_text = "(Show)"
else
new_text = "(Hide)"
@question_header.text(new_text)
prompt_show: () =>
if @prompt_container.is(":hidden")==true
@prompt_container.slideToggle()
@prompt_container.toggleClass('open')
@question_header.text("(Hide)")
prompt_hide: () =>
if @prompt_container.is(":visible")==true
@prompt_container.slideToggle()
@prompt_container.toggleClass('open')
@question_header.text("(Show)")
...@@ -413,7 +413,7 @@ class @PeerGradingProblem ...@@ -413,7 +413,7 @@ class @PeerGradingProblem
if score == actual_score if score == actual_score
calibration_wrapper.append("<p>Congratulations! Your score matches the actual score!</p>") calibration_wrapper.append("<p>Congratulations! Your score matches the actual score!</p>")
else else
calibration_wrapper.append("<p>Please try to understand the grading critera better to be more accurate next time.</p>") calibration_wrapper.append("<p>Please try to understand the grading criteria better to be more accurate next time.</p>")
# disable score selection and submission from the grading interface # disable score selection and submission from the grading interface
$("input[name='score-selection']").attr('disabled', true) $("input[name='score-selection']").attr('disabled', true)
......
...@@ -6,14 +6,13 @@ ...@@ -6,14 +6,13 @@
</div> </div>
<div class="item-container"> <div class="item-container">
<h4>Problem</h4> <h4>Prompt <a href="#" class="question-header">(Hide)</a> </h4>
<div class="problem-container"> <div class="problem-container">
% for item in items: % for item in items:
<div class="item">${item['content'] | n}</div> <div class="item">${item['content'] | n}</div>
% endfor % endfor
</div> </div>
<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>
......
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