Update styles on quiz pages. fixes #9802
On quiz pages: * change background to light blue; * replace right/wrong indicators with new arrows; * change 'flag' question icon; * update layout of questions; * standardize question comment styles; * display radio and checkbox buttons on results * changed last-chance save to not be async to fix FF issue Test plan: * view all quiz pages (new/edit, take, review, history) and verify that they work as expected. Change-Id: I523f13324a34622a7fe5e50bae7b2239eaba8acc Reviewed-on: https://gerrit.instructure.com/12906 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Mark Ericksen <marke@instructure.com>
This commit is contained in:
parent
a0dbdcc10f
commit
10a357944c
|
@ -0,0 +1,9 @@
|
|||
require [
|
||||
'jquery'
|
||||
'quiz_arrows'
|
||||
'quiz_inputs'
|
||||
'quiz_history'
|
||||
], ($, createQuizArrows, disableInputs) ->
|
||||
$ ->
|
||||
createQuizArrows()
|
||||
disableInputs('[type=radio], [type=checkbox]')
|
|
@ -292,6 +292,9 @@ class QuizzesController < ApplicationController
|
|||
redirect_to named_context_url(@context, :context_quiz_url, @quiz)
|
||||
return
|
||||
end
|
||||
if params[:score_updated]
|
||||
js_env :SCORE_UPDATED => true
|
||||
end
|
||||
if authorized_action(@submission, @current_user, :read)
|
||||
dont_show_user_name = @submission.quiz.anonymous_submissions || (!@submission.user || @submission.user == @current_user)
|
||||
add_crumb((dont_show_user_name ? t(:default_history_crumb, "History") : @submission.user.name))
|
||||
|
|
|
@ -110,6 +110,26 @@ module QuizzesHelper
|
|||
res
|
||||
end
|
||||
|
||||
# Build the question-level comments. Lists in the order of :correct_comments, :incorrect_comments, :neutral_comments.
|
||||
# ==== Arguments
|
||||
# * <tt>user_answer</tt> - The user_answer hash.
|
||||
# * <tt>question</tt> - The question hash.
|
||||
def question_comment(user_answer, question)
|
||||
correct_text = (hash_get(user_answer, :correct) == true) ? comment_get(question, :correct_comments) : nil
|
||||
incorrect_text = (hash_get(user_answer, :correct) == false) ? comment_get(question, :incorrect_comments) : nil
|
||||
neutral_text = (hash_get(question, :neutral_comments).present?) ? comment_get(question, :neutral_comments) : nil
|
||||
|
||||
text = []
|
||||
text << content_tag(:p, correct_text, {:class => 'correct_comments'}) if correct_text.present?
|
||||
text << content_tag(:p, incorrect_text, {:class => 'incorrect_comments'}) if incorrect_text.present?
|
||||
text << content_tag(:p, neutral_text, {:class => 'neutral_comments'}) if neutral_text.present?
|
||||
if text.empty?
|
||||
''
|
||||
else
|
||||
content_tag(:div, text.join('').html_safe, {:class => 'quiz_comment'})
|
||||
end
|
||||
end
|
||||
|
||||
def comment_get(hash, field)
|
||||
if html = hash_get(hash, "#{field}_html".to_sym)
|
||||
raw(html)
|
||||
|
@ -121,19 +141,35 @@ module QuizzesHelper
|
|||
def fill_in_multiple_blanks_question(options)
|
||||
question = hash_get(options, :question)
|
||||
answers = hash_get(options, :answers).dup
|
||||
answer_list = hash_get(options, :answer_list)
|
||||
res = user_content hash_get(question, :question_text)
|
||||
answers.delete_if { |k, v| !k.match /^question_#{hash_get(question, :id)}/ }
|
||||
answers.each { |k, v| res.sub! /\{\{#{k}\}\}/, v }
|
||||
|
||||
res.gsub /\{\{question_[^}]+\}\}/, ""
|
||||
if answer_list && !answer_list.empty?
|
||||
index = 0
|
||||
res.gsub %r{<input.*?name=['"](question_.*?)['"].*?/>} do |match|
|
||||
a = answer_list[index]
|
||||
index += 1
|
||||
match.sub(/\{\{question_.*?\}\}/, a.to_s)
|
||||
end
|
||||
else
|
||||
answers.delete_if { |k, v| !k.match /^question_#{hash_get(question, :id)}/ }
|
||||
answers.each { |k, v| res.sub! /\{\{#{k}\}\}/, v }
|
||||
res.gsub /\{\{question_[^}]+\}\}/, ""
|
||||
end
|
||||
end
|
||||
|
||||
def multiple_dropdowns_question(options)
|
||||
question = hash_get(options, :question)
|
||||
answers = hash_get(options, :answers)
|
||||
answer_list = hash_get(options, :answer_list)
|
||||
res = user_content hash_get(question, :question_text)
|
||||
index = 0
|
||||
res.gsub %r{<select.*?name=['"](question_.*?)['"].*?>.*?</select>} do |match|
|
||||
a = hash_get(answers, $1)
|
||||
if answer_list && !answer_list.empty?
|
||||
a = answer_list[index]
|
||||
index += 1
|
||||
else
|
||||
a = hash_get(answers, $1)
|
||||
end
|
||||
match.sub(%r{(<option.*?value=['"]#{ERB::Util.h(a)}['"])}, '\\1 selected')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,44 @@
|
|||
@import environment.sass
|
||||
|
||||
div.question
|
||||
border-radius: 3px
|
||||
$backgroundColor: #dfe9f0
|
||||
$borderColor: #AAA
|
||||
$questionHeaderBackground: #F5F5F5
|
||||
|
||||
div#content
|
||||
overflow: visible
|
||||
padding: 0
|
||||
|
||||
#right-side-wrapper
|
||||
position: absolute
|
||||
|
||||
.quiz-header
|
||||
border-bottom: 1px solid #a4a4a4
|
||||
overflow: hidden
|
||||
padding: 16px
|
||||
|
||||
.quiz-submission, .question_editing
|
||||
background: $backgroundColor
|
||||
border: 1px solid #fff
|
||||
padding: 16px
|
||||
|
||||
.question_editing .question_holder
|
||||
overflow: hidden
|
||||
|
||||
.question_editing.brief
|
||||
min-height: 80px
|
||||
|
||||
.add_question
|
||||
border: none
|
||||
|
||||
#submit_quiz_form
|
||||
.question_holder
|
||||
overflow: hidden
|
||||
.button-container
|
||||
padding-right: 10%
|
||||
|
||||
#submit_quiz_form, .question_form
|
||||
.button-container
|
||||
text-align: right
|
||||
|
||||
#sort_questions
|
||||
:max-height 250px
|
||||
|
@ -15,47 +52,36 @@ div.question
|
|||
clear: both
|
||||
.question
|
||||
.header
|
||||
:float right
|
||||
:margin-right 20px
|
||||
:font-size 1.0em
|
||||
:background-color $questionHeaderBackground
|
||||
.answers
|
||||
.answer
|
||||
clear: both
|
||||
margin: 0 0 8px 0
|
||||
position: relative
|
||||
+opacity(0.5)
|
||||
&.correct_answer
|
||||
:background none
|
||||
+opacity(1)
|
||||
&.selected_answer
|
||||
:background url(/images/incorrect_answer.png) no-repeat 3px 5px
|
||||
&.selected_answer.correct_answer
|
||||
:background url(/images/correct_answer.png) no-repeat 3px 5px
|
||||
&.selected_answer.unspecified_answer
|
||||
:background url(/images/neutral_answer.png) no-repeat 3px 5px
|
||||
+opacity(1)
|
||||
&.wrong_answer,
|
||||
+border-radius(6px)
|
||||
border: 2px solid red
|
||||
padding-bottom: 8px
|
||||
+opacity(1)
|
||||
|
||||
.ui-selectmenu-status
|
||||
:color red
|
||||
|
||||
&.full-opacity
|
||||
+opacity(1)
|
||||
&.hide_right_arrow,&.selected_answer.hide_right_arrow
|
||||
:background-image none
|
||||
|
||||
&.hover
|
||||
.answers
|
||||
.answer.selected_answer.correct_answer
|
||||
:background url(/images/correct_answer.png) no-repeat 3px 5px
|
||||
.answer.selected_answer.unspecified_answer
|
||||
:background url(/images/neutral_answer.png) no-repeat 3px 5px
|
||||
.answer.correct_answer
|
||||
:background url(/images/partial_answer.png) no-repeat 3px 5px
|
||||
.answer.hide_right_arrow,.answer.selected_answer.hide_right_arrow
|
||||
:background-image none
|
||||
&.correct
|
||||
:border-color #4a4
|
||||
&.incorrect
|
||||
:border-color #faa
|
||||
.text_box_answer
|
||||
color: #ab3636
|
||||
.correct_text_box_answer
|
||||
color: #44AA44
|
||||
#questions.assessment_results.survey_results
|
||||
.question
|
||||
.answers
|
||||
.answer
|
||||
&.selected_answer
|
||||
:background url(/images/correct_answer.png) no-repeat 3px 5px
|
||||
&.selected_answer.correct_answer
|
||||
:background url(/images/correct_answer.png) no-repeat 3px 5px
|
||||
&.hover
|
||||
.answers
|
||||
.answer.selected_answer.correct_answer
|
||||
|
@ -68,25 +94,22 @@ div.question
|
|||
:border-color inherit
|
||||
&.incorrect
|
||||
:border-color inherit
|
||||
.user_points,.question_points_holder
|
||||
display: none
|
||||
|
||||
#questions.assessing,#questions.assessment_results
|
||||
.question_holder
|
||||
.question
|
||||
&.related
|
||||
:border-width 2px
|
||||
.header
|
||||
:float right
|
||||
:margin-right 10px
|
||||
:font-size 0.9em
|
||||
.move
|
||||
:display none
|
||||
|
||||
#questions.assessing
|
||||
background: $backgroundColor
|
||||
border: 1px solid #fff
|
||||
padding: 16px
|
||||
.answer
|
||||
:padding 5px 5px
|
||||
:margin 0 25px
|
||||
:margin 0
|
||||
|
||||
&:last-child
|
||||
:border-bottom 0
|
||||
|
@ -94,7 +117,7 @@ div.question
|
|||
#questions.brief
|
||||
.question_holder .display_question
|
||||
:font-size 0.9em
|
||||
.answer, .question_comment
|
||||
.answer, .question_comment, .quiz_comment
|
||||
:display none
|
||||
.calculated_question_answers
|
||||
:display none
|
||||
|
@ -112,12 +135,10 @@ div.question
|
|||
:border-right 1px solid #aaa
|
||||
:border-left 1px solid #aaa
|
||||
.group_top
|
||||
:border 1px solid #aaa
|
||||
:border-bottom-width 1px
|
||||
:-moz-border-radius-topright 5px
|
||||
:-moz-border-radius-topleft 5px
|
||||
:padding 5px 10px
|
||||
:background-color #eee
|
||||
border: 1px solid #aaa
|
||||
padding: 5px 10px
|
||||
overflow: hidden
|
||||
background-color: #eee
|
||||
&.question_bank_top
|
||||
.local_group_links
|
||||
display: none
|
||||
|
@ -185,6 +206,18 @@ div.question
|
|||
.question_points_holder
|
||||
:display none
|
||||
|
||||
.question_bank
|
||||
border-bottom: 1px solid #b6babf
|
||||
border-top: 1px solid #fff
|
||||
overflow: hidden
|
||||
|
||||
&:first-child
|
||||
border-top: none
|
||||
|
||||
&:last-child
|
||||
border-bottom: none
|
||||
|
||||
|
||||
.question_holder
|
||||
:position relative
|
||||
> .question
|
||||
|
@ -196,25 +229,24 @@ div.question
|
|||
white-space: pre-wrap
|
||||
|
||||
.question
|
||||
:border 1px solid #888
|
||||
:margin-bottom 30px
|
||||
:margin-top 0.7em
|
||||
:-moz-border-radius 5px
|
||||
:border 1px solid $borderColor
|
||||
:background-color #fff
|
||||
:position relative
|
||||
:min-height 50px
|
||||
:min-width 415px
|
||||
:width 80%
|
||||
:margin 0.7em auto 30px auto
|
||||
:_height 10px
|
||||
|
||||
|
||||
&.modified_but_not_saved
|
||||
border-width: 3px
|
||||
.move
|
||||
:float left
|
||||
:margin-top -0.8em
|
||||
:_margin-top 0
|
||||
:margin-left 20px
|
||||
:width 16px
|
||||
:height 16px
|
||||
:padding 2px
|
||||
background: none !important
|
||||
float: left
|
||||
margin: 8px 8px 0 8px
|
||||
width: 16px
|
||||
height: 16px
|
||||
padding: 2px
|
||||
|
||||
.move_icon
|
||||
:display none
|
||||
|
@ -222,19 +254,24 @@ div.question
|
|||
.header
|
||||
:font-size 1.2em
|
||||
:font-weight bold
|
||||
:float left
|
||||
:background-color #fff
|
||||
:margin-left 10px
|
||||
:margin-top -0.7em
|
||||
:_margin-top 0px
|
||||
:padding 0px 3px
|
||||
|
||||
:border-bottom 1px solid $borderColor
|
||||
:background-color $questionHeaderBackground
|
||||
:padding 8px 20px
|
||||
:margin 0
|
||||
.question_points_holder
|
||||
:float right
|
||||
:font-size 0.9em
|
||||
:font-weight bold
|
||||
:color #777
|
||||
:margin-top 0.1em
|
||||
|
||||
.text
|
||||
:clear left
|
||||
:padding 5px 20px
|
||||
|
||||
.question_text
|
||||
:margin-top 1.5em
|
||||
:margin-bottom 1.5em
|
||||
.answer_select
|
||||
:border 2px solid #888
|
||||
.text_after_answers
|
||||
|
@ -273,42 +310,13 @@ div.question
|
|||
.quiz_response_text
|
||||
word-wrap: break-word
|
||||
.answer
|
||||
:padding 5px 30px
|
||||
:padding 8px 30px 0 30px
|
||||
|
||||
.answer_list
|
||||
:margin 5px
|
||||
:padding-left 0
|
||||
:font-weight bold
|
||||
|
||||
.answer_percent
|
||||
:padding-left 20px
|
||||
:font-size 0.8em
|
||||
|
||||
.answer_comment_holder
|
||||
:-moz-border-radius 5px
|
||||
:border 2px solid #faa
|
||||
:margin-left 20px
|
||||
:padding 3px 5px
|
||||
:margin-top 5px
|
||||
:font-size 0.8em
|
||||
:position relative
|
||||
:float left
|
||||
:width auto
|
||||
:min-width 50px
|
||||
|
||||
.answer_comment
|
||||
:background-image none
|
||||
|
||||
.comment_top
|
||||
:position absolute
|
||||
:display block
|
||||
:top -8px
|
||||
:left 10px
|
||||
:width 19px
|
||||
:height 8px
|
||||
:background-repeat no-repeat
|
||||
:background-image url(/images/comment_top.png)
|
||||
|
||||
.answer_input
|
||||
:vertical-align top
|
||||
.answer_label
|
||||
|
@ -325,16 +333,16 @@ div.question
|
|||
:border-color #abd
|
||||
.comment_top
|
||||
:background-image url(/images/comment_top_neutral.png)
|
||||
&.correct_answer
|
||||
:background url(/images/correct_answer.png) no-repeat 3px 5px
|
||||
|
||||
|
||||
.answer_text, .answer_html
|
||||
:font-weight bold
|
||||
:font-weight normal
|
||||
|
||||
.answer_comment_holder
|
||||
:border-color #4a4
|
||||
|
||||
.comment_top
|
||||
+vertical-gradient(#d7e7c9, #c3deac)
|
||||
|
||||
|
||||
.comment_top
|
||||
:background-image url(/images/comment_top_correct.png)
|
||||
|
||||
&.partial_answer
|
||||
|
@ -349,12 +357,6 @@ div.question
|
|||
.answer_text
|
||||
:font-weight bold
|
||||
|
||||
.answer_percent
|
||||
color: #a00
|
||||
|
||||
.answer_percent
|
||||
:display none
|
||||
|
||||
.question_comment
|
||||
:position relative
|
||||
:float left
|
||||
|
@ -382,35 +384,25 @@ div.question
|
|||
.comment_top
|
||||
:background-image url(/images/comment_top_correct.png)
|
||||
.links
|
||||
:float right
|
||||
:top 2px
|
||||
:right 2px
|
||||
:visibility hidden
|
||||
.user_points
|
||||
:float right
|
||||
:margin-right 5px
|
||||
:font-size 1.1em
|
||||
:font-weight bold
|
||||
:background-color #fff
|
||||
.points_possible
|
||||
:font-size 0.8em
|
||||
:font-weight normal
|
||||
float: right
|
||||
margin: 8px 8px 0 0
|
||||
visibility: hidden
|
||||
.flag_question
|
||||
:float left
|
||||
:margin-top -0.8em
|
||||
:margin-left 20px
|
||||
:width 20px
|
||||
:height 20px
|
||||
:padding 2px
|
||||
:background url(/images/answers_sprite.png) -42px top
|
||||
:cursor pointer
|
||||
.flag_icon
|
||||
:display none
|
||||
:position absolute
|
||||
:left -30px
|
||||
:margin-top 13px
|
||||
:height 16px
|
||||
:width 20px
|
||||
+opacity(1)
|
||||
&:hover
|
||||
:background-position -62px top
|
||||
+opacity(0.65)
|
||||
&.marked,&.marked:hover
|
||||
.flag_question
|
||||
:background-color #fff
|
||||
.flag_icon
|
||||
:display inline
|
||||
+opacity(1.0)
|
||||
:background-position -62px -16px
|
||||
+opacity(1)
|
||||
.no-touch &.hover
|
||||
.move
|
||||
:background-color #fff
|
||||
|
@ -421,12 +413,18 @@ div.question
|
|||
.flag_question
|
||||
:background-color #fff
|
||||
.flag_icon
|
||||
+opacity(0.5)
|
||||
+opacity(0.2)
|
||||
:display inline
|
||||
|
||||
.question.multiple_choice_question, .question.multiple_answers_question, .question.matching_question
|
||||
.answer
|
||||
:border-bottom 1px solid #ddd
|
||||
.question
|
||||
&.multiple_choice_question, &.multiple_answers_question,
|
||||
&.matching_question, &.true_false_question
|
||||
.answer
|
||||
border-top: 1px solid #ddd
|
||||
|
||||
.question.fill_in_multiple_blanks_question, .question.multiple_dropdowns_question
|
||||
.answer_group
|
||||
:border-top 1px solid #ddd
|
||||
&:last-child
|
||||
:border-bottom 0
|
||||
|
||||
|
@ -444,17 +442,22 @@ div.question
|
|||
.answer_match_left, .answer_match_left_html
|
||||
:float left
|
||||
:width 45%
|
||||
:font-weight bold
|
||||
:overflow auto
|
||||
|
||||
.answer_match_middle
|
||||
:float left
|
||||
:width 10%
|
||||
:background url(/images/matching_arrow.png) no-repeat center center
|
||||
|
||||
|
||||
.answer_match_right
|
||||
:float left
|
||||
:width 45%
|
||||
:overflow auto
|
||||
float: left
|
||||
width: 45%
|
||||
.answer
|
||||
border-top: none
|
||||
.correct_answer
|
||||
padding-left: 5px
|
||||
.answer_text
|
||||
font-weight: bold
|
||||
|
||||
.form_answers
|
||||
.answer
|
||||
|
@ -480,19 +483,19 @@ div.question
|
|||
.answer_select .answer_box
|
||||
:background-repeat no-repeat
|
||||
:cursor pointer
|
||||
&.hover .answer_box
|
||||
:background-image url(/images/correct_answer.png)
|
||||
|
||||
&.hover
|
||||
.answer_select .answer_box
|
||||
:background-image url(/images/partial_answer.png)
|
||||
&.correct_answer .answer_select .answer_box
|
||||
:background-image url(/images/correct_answer.png)
|
||||
&.partial_answer .answer_select .answer_box
|
||||
:background-image url(/images/partial_answer.png)
|
||||
&.negative_answer .answer_select .answer_box
|
||||
:background-image url(/images/negative_answer.png)
|
||||
.survey_quiz .question
|
||||
|
||||
.skipped
|
||||
display: none
|
||||
|
||||
.survey_quiz .question, .question_holder
|
||||
.text
|
||||
.answers
|
||||
.answer
|
||||
|
@ -508,6 +511,10 @@ div.question
|
|||
|
||||
&.negative_answer
|
||||
:background-image none
|
||||
|
||||
.answer_text, .answer_html
|
||||
:display inline-block
|
||||
|
||||
&.selectable
|
||||
.answer
|
||||
.answer_select
|
||||
|
@ -544,6 +551,8 @@ div.question
|
|||
:color inherit
|
||||
|
||||
form.question_form
|
||||
.question .header
|
||||
overflow: hidden
|
||||
.multi_answer_sets
|
||||
display: none
|
||||
.fill_in_multiple_blanks_question,.multiple_dropdowns_question
|
||||
|
@ -890,3 +899,197 @@ ul#quiz_versions
|
|||
.multiple_answers_question .question_actions .atr-edit
|
||||
display: inline-block
|
||||
|
||||
// styles for the correct/incorrect arrows on the quiz
|
||||
// review page.
|
||||
.answer_arrow
|
||||
background-image: url(/images/answers_sprite.png)
|
||||
background-repeat: repeat-x
|
||||
display: inline-block
|
||||
font-size: 12px
|
||||
font-weight: bold
|
||||
line-height: 27px
|
||||
min-width: 96px
|
||||
padding: 0 8px
|
||||
position: absolute
|
||||
text-align: center
|
||||
text-shadow: 0 -1px 0 rgba(#000, 0.5)
|
||||
|
||||
&.correct:before, &.correct:after,
|
||||
&.incorrect:before, &.incorrect:after,
|
||||
&.info:before, &.info:after
|
||||
background-image: url(/images/answers_sprite.png)
|
||||
background-repeat: no-repeat
|
||||
content: ' '
|
||||
height: 27px
|
||||
position: absolute
|
||||
top: 0
|
||||
|
||||
&.correct:before, &.incorrect:before, &.info:before
|
||||
left: -3px
|
||||
width: 3px
|
||||
|
||||
&.correct:after, &.incorrect:after, &.info:after
|
||||
right: -11px
|
||||
width: 11px
|
||||
|
||||
&.correct
|
||||
background-position: left -32px
|
||||
color: #fff
|
||||
|
||||
&:before
|
||||
background-position: top left
|
||||
|
||||
&:after
|
||||
background-position: -9px top
|
||||
|
||||
&.incorrect
|
||||
background-position: left -59px
|
||||
color: #fff
|
||||
|
||||
&:before
|
||||
background-position: -3px top
|
||||
|
||||
&:after
|
||||
background-position: -20px top
|
||||
|
||||
&.info
|
||||
background-position: left -86px
|
||||
color: #333
|
||||
text-shadow: 0 -1px 0 rgba(#fff, 0.5)
|
||||
|
||||
&:before
|
||||
background-position: -6px top
|
||||
|
||||
&:after
|
||||
background-position: -31px top
|
||||
|
||||
// styles for teacher comments on quiz answers (comment bubbles).
|
||||
@mixin comment-arrow
|
||||
border: 10px solid transparent
|
||||
content: ' '
|
||||
height: 0
|
||||
position: absolute
|
||||
width: 0
|
||||
|
||||
.quiz_comment
|
||||
+vertical-gradient(#fff, #f4f5f6)
|
||||
border: 1px solid #b5bfc7
|
||||
+border-radius(5px)
|
||||
+box-shadow(0 1px 2px rgba(#000, 0.2))
|
||||
font-size: 14px
|
||||
min-width: 100px
|
||||
padding: 14px
|
||||
position: relative
|
||||
margin: 16px 30px
|
||||
text-align: left
|
||||
display: inline-block
|
||||
|
||||
&.empty
|
||||
display: none
|
||||
|
||||
p
|
||||
margin-bottom: 0.5em
|
||||
&:last-child
|
||||
:margin-bottom 0
|
||||
|
||||
&:before
|
||||
@include comment-arrow
|
||||
border-bottom-color: #b5bfc7
|
||||
left: 30px
|
||||
top: -20px
|
||||
|
||||
&:after
|
||||
@include comment-arrow
|
||||
border-bottom-color: #fff
|
||||
left: 30px
|
||||
top: -19px
|
||||
|
||||
.answer_comment_holder
|
||||
:-moz-border-radius 5px
|
||||
:border-radius 5px
|
||||
:border 1px solid #faa
|
||||
:margin-left 20px
|
||||
:padding 5px
|
||||
:margin-top 5px
|
||||
:font-size 0.8em
|
||||
:position relative
|
||||
:float left
|
||||
:width auto
|
||||
:min-width 50px
|
||||
+vertical-gradient(#ffeae7, #fdd7d7)
|
||||
|
||||
.answer_comment
|
||||
:background-image none
|
||||
|
||||
.comment_top
|
||||
:position absolute
|
||||
:display block
|
||||
:top -8px
|
||||
:left 10px
|
||||
:width 19px
|
||||
:height 8px
|
||||
:background-repeat no-repeat
|
||||
:background-image url(/images/comment_top.png)
|
||||
|
||||
.answers
|
||||
.quiz_comment
|
||||
font-size: 0.9em
|
||||
margin: 16px 0 8px 0
|
||||
padding: 5px 10px
|
||||
|
||||
// quiz history-specific styles
|
||||
#update_history_form
|
||||
.assessment_results
|
||||
clear: none
|
||||
|
||||
.question .text
|
||||
clear: none
|
||||
|
||||
.button-container
|
||||
padding: 16px
|
||||
|
||||
#questions
|
||||
.user_points, .question_points_holder
|
||||
display: block
|
||||
|
||||
.header .question_points_holder
|
||||
font-size: 12px
|
||||
margin: 0
|
||||
|
||||
.question_input
|
||||
width: 30px
|
||||
&:focus
|
||||
+transform(scale(1.3))
|
||||
|
||||
.short_answer_question
|
||||
.answers
|
||||
.question_input
|
||||
font-size: 13px
|
||||
width: 125px
|
||||
|
||||
.summary .footnote
|
||||
font-size: 12px
|
||||
text-align: right
|
||||
|
||||
.answer-group-heading
|
||||
display: block
|
||||
margin: 8px 0
|
||||
|
||||
.answers_wrapper
|
||||
position: relative
|
||||
|
||||
.question, .answer
|
||||
img
|
||||
max-width: 100%
|
||||
|
||||
#questions
|
||||
.short_answer_question, .numerical_question
|
||||
.answers_wrapper
|
||||
border-top: 1px solid #ddd
|
||||
padding-top: 8px
|
||||
.answer
|
||||
margin: 0 !important
|
||||
padding-top: 0
|
||||
#questions.question_editing .question
|
||||
.answers_wrapper
|
||||
border-top: none
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<% content_for :stylesheets do %>
|
||||
<style>
|
||||
.question_bank {
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
.question_bank .header {
|
||||
padding: 3px 5px;
|
||||
|
@ -46,16 +46,18 @@
|
|||
</div>
|
||||
<% end %>
|
||||
|
||||
<h2>
|
||||
<% case @context.class.to_s %>
|
||||
<% when 'Course' %>
|
||||
<%= t 'course_question_banks', "Course Question Banks" %>
|
||||
<% when 'User' %>
|
||||
<%= t 'user_question_banks', "User Question Banks" %>
|
||||
<% when 'Account' %>
|
||||
<%= t 'account_question_banks', "Account Question Banks" %>
|
||||
<% end %>
|
||||
</h2>
|
||||
<div class="quiz-header">
|
||||
<h2>
|
||||
<% case @context.class.to_s %>
|
||||
<% when 'Course' %>
|
||||
<%= t 'course_question_banks', "Course Question Banks" %>
|
||||
<% when 'User' %>
|
||||
<%= t 'user_question_banks', "User Question Banks" %>
|
||||
<% when 'Account' %>
|
||||
<%= t 'account_question_banks', "Account Question Banks" %>
|
||||
<% end %>
|
||||
</h2>
|
||||
</div>
|
||||
<% if @context != @current_user %>
|
||||
<%= render :partial => "question_bank" %>
|
||||
|
||||
|
|
|
@ -40,30 +40,32 @@
|
|||
<%= render :partial => 'shared/find_outcome', :locals => {:purpose => 'question_bank'} %>
|
||||
<% end %>
|
||||
|
||||
<% form_for @bank, :url => context_url(@context, :context_question_bank_url), :html => {:id => "edit_bank_form", :method => :put} do |f| %>
|
||||
<div class="displaying">
|
||||
<h2><%= @bank.title %></h2>
|
||||
<div class="quiz-header">
|
||||
<% form_for @bank, :url => context_url(@context, :context_question_bank_url), :html => {:id => "edit_bank_form", :method => :put} do |f| %>
|
||||
<div class="displaying">
|
||||
<h2><%= @bank.title %></h2>
|
||||
</div>
|
||||
<div class="editing" style="display: none;">
|
||||
<b><%= f.label :title, :en => "Bank Name" %></b>
|
||||
<%= f.text_field :title, :class => "bank_name_box" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<p>
|
||||
<%= t('edit_warning', "Remember, changes to question templates won't automatically update quizzes that are already using those questions.") %>
|
||||
</p>
|
||||
<div style="margin-bottom: 5px; <%= hidden if @questions.total_pages > 1 %>">
|
||||
<input type="checkbox" id="show_question_details" <%= 'checked' if @questions.total_pages > 1 %> /><label for="show_question_details"> <%= t('show_details', 'Show Question Details') %></label>
|
||||
</div>
|
||||
<div class="editing" style="display: none;">
|
||||
<b><%= f.label :title, :en => "Bank Name" %></b>
|
||||
<%= f.text_field :title, :class => "bank_name_box" %>
|
||||
<div id="bank_urls" style="display: none;">
|
||||
<a href="<%= context_url(@context, :context_question_bank_questions_url, @bank, :page => "{{ page }}") %>" class="more_questions_url"> </a>
|
||||
<a href="<%= context_url(@context, :context_question_bank_assessment_questions_url, @bank) %>" class="add_question_url"> </a>
|
||||
<a href="<%= context_url(@context, :context_question_bank_assessment_question_move_question_url, "{{ id }}") %>" class="move_question_url"> </a>
|
||||
<a href="<%= context_url(@context, :context_question_bank_move_questions_url, @bank.id) %>" class="move_questions_url"> </a>
|
||||
<a href="<%= context_url(@context, :context_question_banks_url) %>" class="assessment_question_banks_url"> </a>
|
||||
<a href="<%= context_url(@context, :context_question_banks_url, :managed => '1') %>" class="managed_banks_url"> </a>
|
||||
<a href="<%= context_url(@context, :context_question_bank_reorder_url, @bank.id) %>" class="reorder_questions_url" style="display: none;"> </a>
|
||||
<span class="current_question_bank_id"><%= @bank.id %></span>
|
||||
</div>
|
||||
<% end %>
|
||||
<p>
|
||||
<%= t('edit_warning', "Remember, changes to question templates won't automatically update quizzes that are already using those questions.") %>
|
||||
</p>
|
||||
<div style="margin-bottom: 5px; <%= hidden if @questions.total_pages > 1 %>">
|
||||
<input type="checkbox" id="show_question_details" <%= 'checked' if @questions.total_pages > 1 %> /><label for="show_question_details"> <%= t('show_details', 'Show Question Details') %></label>
|
||||
</div>
|
||||
<div id="bank_urls" style="display: none;">
|
||||
<a href="<%= context_url(@context, :context_question_bank_questions_url, @bank, :page => "{{ page }}") %>" class="more_questions_url"> </a>
|
||||
<a href="<%= context_url(@context, :context_question_bank_assessment_questions_url, @bank) %>" class="add_question_url"> </a>
|
||||
<a href="<%= context_url(@context, :context_question_bank_assessment_question_move_question_url, "{{ id }}") %>" class="move_question_url"> </a>
|
||||
<a href="<%= context_url(@context, :context_question_bank_move_questions_url, @bank.id) %>" class="move_questions_url"> </a>
|
||||
<a href="<%= context_url(@context, :context_question_banks_url) %>" class="assessment_question_banks_url"> </a>
|
||||
<a href="<%= context_url(@context, :context_question_banks_url, :managed => '1') %>" class="managed_banks_url"> </a>
|
||||
<a href="<%= context_url(@context, :context_question_bank_reorder_url, @bank.id) %>" class="reorder_questions_url" style="display: none;"> </a>
|
||||
<span class="current_question_bank_id"><%= @bank.id %></span>
|
||||
</div>
|
||||
<div id="questions" class="<%= 'uneditable' unless can_do(@bank, @current_user, :manage) %> question_editing brief question_bank">
|
||||
<% if @questions.total_pages <= 1 %>
|
||||
|
|
|
@ -4,25 +4,40 @@
|
|||
question ||= nil
|
||||
answer_type = question_type ? question_type.answer_type : "select_answer"
|
||||
user_answer ||= nil
|
||||
matched_answer ||= nil
|
||||
show_correct_answers = @quiz.try_rescue(:show_correct_answers) || (!assessment_results && !user_answer)#rescue false
|
||||
show_correct_answers = false if @quiz.try_rescue(:quiz_type) == 'survey' || @quiz.try_rescue(:quiz_type) == 'graded_survey'
|
||||
selected_answer = user_answer && answer && hash_get(user_answer, :answer_id) == hash_get(answer, :id)
|
||||
selected_answer = true if user_answer && question_type.answer_type == "matching_answer"
|
||||
selected_answer = (hash_get(user_answer, "answer_#{answer[:id]}") == "1") if user_answer && hash_get(question, :question_type) == "multiple_answers_question"
|
||||
selected_answer = false if question_type && question_type.display_answers == "single"
|
||||
selected_answer = true if hash_get(question, :question_type) == "fill_in_multiple_blanks_question" && hash_get(matched_answer, :id) == hash_get(answer, :id)
|
||||
correct_answer = answer && hash_get(answer, :weight) == 100
|
||||
correct_answer = (hash_get(user_answer, "answer_#{answer[:id]}").to_i == hash_get(answer, :match_id).to_i) if user_answer && answer && question_type && question_type.answer_type == "matching_answer"
|
||||
correct_answer = false if !user_answer && question && hash_get(question, :question_type) == "matching_question"
|
||||
correct_answer = false unless show_correct_answers || selected_answer
|
||||
correct_answer_class = !['multiple_answers_question'].include?(question_type.question_type) || show_correct_answers ? (correct_answer ? "correct_answer" : "") : "unspecified_answer"
|
||||
hide_right_arrow = user_answer && question_type.display_answers == "single"
|
||||
hide_right_arrow = true if !show_correct_answers && !selected_answer
|
||||
wrong_answer = selected_answer && !correct_answer
|
||||
no_answer = wrong_answer && (hash_get(user_answer, "answer_#{answer[:id]}") == '')
|
||||
hide_right_arrow = false
|
||||
show_comment = !assessment_results || selected_answer
|
||||
has_answer_comment = hash_get(answer, :comments_html).present? || comment_get(answer, :comments).present?
|
||||
skip_if_correct ||= nil
|
||||
should_skip = (skip_if_correct && selected_answer && correct_answer) ||
|
||||
(hash_get(question, :question_type) == 'fill_in_multiple_blanks_question' &&
|
||||
answer.respond_to?(:[]) && answer['text'].blank? && answer['html'].blank?) ||
|
||||
(hash_get(question, :question_type) == 'multiple_dropdowns_question' && !correct_answer)
|
||||
%>
|
||||
<% unless question && [ "short_answer_question", "fill_in_multiple_blanks_question" ].include?(question[:question_type]) && !show_correct_answers %>
|
||||
<div class="answer answer_for_<%= hash_get(answer, :blank_id) %> <%= "hide_right_arrow" if hide_right_arrow %> <%= "selected_answer" if selected_answer %> <%= correct_answer_class %>" id="answer_<%= hash_get(answer, :id, "template") %>" style="<%= hidden unless answer %>" title="<%= t(:selected_answer, "You selected this answer.") if selected_answer %> <%= t(:correct_answer, "This was the correct answer.") if correct_answer && show_correct_answers %>">
|
||||
<% if false %>
|
||||
<!-- Display skipped -->
|
||||
<% else %>
|
||||
<div class="answer answer_for_<%= hash_get(answer, :blank_id) %> <%= "hide_right_arrow" if hide_right_arrow %> <%= 'skipped' if should_skip %> <%= 'wrong_answer' if wrong_answer %> <%= 'no_answer' if no_answer %> <%= "selected_answer" if selected_answer %> <%= correct_answer_class %>" id="answer_<%= hash_get(answer, :id, "template") %>" style="<%= hidden unless answer %>" title="<%= t(:selected_answer, "You selected this answer.") if selected_answer %> <%= t(:correct_answer, "This was the correct answer.") if correct_answer && show_correct_answers %>">
|
||||
<% if !user_answer || question_type.display_answers != "xsingle" %>
|
||||
<div class="select_answer answer_type" <%= hidden(true) unless answer_type == "select_answer" %>>
|
||||
<% if %w{radio checkbox}.include?(question_type.entry_type) %>
|
||||
<input type="<%= question_type.entry_type %>" <%= 'checked' if selected_answer %> class="question_input" />
|
||||
<% end %>
|
||||
<div class="answer_text" <%= hidden(true) if hash_get(answer, :html).present? %>><%= hash_get(answer, :text) %></div>
|
||||
<div class="answer_html"><%= hash_get(answer, :html).to_s.html_safe %></div>
|
||||
</div>
|
||||
|
@ -35,21 +50,29 @@
|
|||
<div class="answer_match_middle"> </div>
|
||||
<div class="answer_match_right">
|
||||
<% if user_answer %>
|
||||
<% if hash_get(user_answer, "answer_#{hash_get(answer,:id)}").to_i == hash_get(answer, :match_id).to_i %>
|
||||
<%= (hash_get(answer, :right) || (question && hash_get(question, :matches, []).find{|m| hash_get(m, :match_id).to_i == hash_get(user_answer, "answer_#{hash_get(answer, :id)}").to_i}[:text] rescue '')) %>
|
||||
<% show_comment = false if answer_type == "matching_answer" %>
|
||||
<% if answer_type == 'matching_answer'
|
||||
user_answer_choice = hash_get(user_answer, "answer_#{hash_get(answer, :id)}".to_sym).to_i
|
||||
display_choice = hash_get(question, :matches).find {|m| hash_get(m, :match_id) == user_answer_choice }
|
||||
%>
|
||||
<select class="question_input" readonly='readonly' style="max-width: 90%;">
|
||||
<option value="" selected><%= display_choice[:text] rescue '' %></option>
|
||||
</select>
|
||||
<% show_comment = wrong_answer %>
|
||||
<% else %>
|
||||
<% matched = (hash_get(question, :matches) || hash_get(question, :answers, [])).find{|a| hash_get(a, :match_id).to_i == hash_get(user_answer, "answer_#{hash_get(answer, :id)}").to_i} %>
|
||||
<span class="text_box_answer <%= 'correct_text_box_answer' if matched && matched[:weight] == 100 %>">
|
||||
<%= before_label(:your_answer, 'Your Answer') %>
|
||||
<% user_text = (hash_get(matched, :right) || hash_get(matched, :text))
|
||||
user_text = nil if user_text.blank? %>
|
||||
<b><%= user_text || t(:you_left_this_blank, 'You left this blank') %></b>
|
||||
</span>
|
||||
<% if show_correct_answers %>
|
||||
<br/>It was really: <%= (hash_get(answer, :right) || (question && hash_get(question, :matches, []).find{|m| hash_get(m, :match_id).to_i == hash_get(user_answer, :match_id).to_i}[:text] rescue '')) %>
|
||||
<% if hash_get(user_answer, "answer_#{hash_get(answer,:id)}").to_i == hash_get(answer, :match_id).to_i %>
|
||||
<%= (hash_get(answer, :right) || (question && hash_get(question, :matches, []).find{|m| hash_get(m, :match_id).to_i == hash_get(user_answer, "answer_#{hash_get(answer, :id)}").to_i}[:text] rescue '')) %>
|
||||
<% else %>
|
||||
<% matched = (hash_get(question, :matches) || hash_get(question, :answers, [])).find{|a| hash_get(a, :match_id).to_i == hash_get(user_answer, "answer_#{hash_get(answer, :id)}").to_i} %>
|
||||
<span class="text_box_answer <%= 'correct_text_box_answer' if matched && matched[:weight] == 100 %>">
|
||||
<%= before_label(:your_answer, 'Your Answer') %>
|
||||
<% user_text = (hash_get(matched, :right) || hash_get(matched, :text))
|
||||
user_text = nil if user_text.blank? %>
|
||||
<b><%= user_text || t(:you_left_this_blank, '(You left this blank)') %></b>
|
||||
</span>
|
||||
<% if show_correct_answers %>
|
||||
<br/>It was really: <%= (hash_get(answer, :right) || (question && hash_get(question, :matches, []).find{|m| hash_get(m, :match_id).to_i == hash_get(user_answer, :match_id).to_i}[:text] rescue '')) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% show_comment = true if answer_type == "matching_answer" %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= (hash_get(answer, :right) || (question && hash_get(question, :matches, []).find{|m| hash_get(m, :match_id).to_i == hash_get(answer, :match_id).to_i}[:text] rescue '')) %>
|
||||
|
@ -84,17 +107,38 @@
|
|||
<span class="answer_tolerance"><%= hash_get(question, :answer_tolerance) %></span>
|
||||
</span>
|
||||
</div>
|
||||
<% if show_correct_answers %>
|
||||
<div class="answer_percent"><%= t(:percent_of_points, "%{percent}% of points", :percent => raw("<span class=\"answer_weight\">#{hash_get(answer, :weight, 0)}</span>")) %></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<span class="answer_weight" style="display: none;"><%= hash_get(answer, :weight, 0) %></span>
|
||||
<% if show_comment %>
|
||||
<div class="answer_comment_holder <%= "empty" unless comment_get(answer, :comments).present? %>" <%= hidden(true) unless !answer || comment_get(answer, :comments) %>>
|
||||
<div class="comment_top"></div>
|
||||
<div class="answer_comment" <%= hidden(true) if hash_get(answer, :comments_html).present? %>><%= comment_get(answer, :comments) %></div>
|
||||
<span class="answer_comment_html"><%= raw hash_get(answer, :comments_html) %></span>
|
||||
</div>
|
||||
<div class="quiz_comment <%= "empty" unless has_answer_comment %>">
|
||||
<% if hash_get(answer, :comments_html).present? %>
|
||||
<div class="answer_comment_html"><%= raw(hash_get(answer, :comments_html)) %></div>
|
||||
<% else %>
|
||||
<div class="answer_comment"><%= comment_get(answer, :comments) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<% if answer_type == 'matching_answer' && wrong_answer && show_correct_answers %>
|
||||
<div class="answer full-opacity">
|
||||
<div class="answer_match matching_answer answer_type">
|
||||
<div class="answer_match_left"> </div>
|
||||
<div class="answer_match_left_html"></div>
|
||||
<div class="answer_match_middle"> </div>
|
||||
<div class="answer_match_right">
|
||||
<div class='answer correct_answer'>
|
||||
<div class='answer_text'>
|
||||
<%= (hash_get(answer, :right) || (question && hash_get(question, :matches, []).find{|m| hash_get(m, :match_id).to_i == hash_get(user_answer, :match_id).to_i}[:text] rescue '')) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="clear"></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
editing ||= false
|
||||
in_group ||= false
|
||||
question_bank_id ||= nil
|
||||
correct = user_answer && hash_get(user_answer, :correct) == true
|
||||
incorrect = user_answer && hash_get(user_answer, :correct) == false
|
||||
unanswered = (%w{multiple_choice_question true_false_question}.include?(hash_get(question, 'question_type')) && incorrect && hash_get(user_answer, 'text').blank?) ||
|
||||
(hash_get(question, 'question_type') == 'multiple_answers_question' && incorrect && user_answer.select{|k, v| k.to_s.match(/answer_/) && v.to_s != '0' }.length == 0) || false
|
||||
asset_string ||= (question_bank_id ? 'assessment_question' : 'quiz_question') + "_#{hash_get(question, :id)}"
|
||||
if question_type.display_answers == "multiple" && hash_get(question, :question_type) != "missing_word_question"
|
||||
right_answers = hash_get(question, :answers, {})
|
||||
|
@ -19,17 +23,31 @@
|
|||
<div class="question_holder <%= "group" if in_group %>" id="<%= "question_template" unless question %>" style="<%= hidden unless question %>">
|
||||
<div style="display: block; height: 1px; overflow: hidden;"> </div>
|
||||
<a name="question_<%= hash_get(question, :id, "blank") %>"></a>
|
||||
<div class="display_question question <%= question_type.question_type %> <%= "marked" if assessing && @stored_params && @stored_params["question_#{hash_get(question, :id)}_marked"] %> <%= "correct" if user_answer && hash_get(user_answer, :correct) == true %> <%= "incorrect" if user_answer && hash_get(user_answer, :correct) == false %>" id="question_<%= hash_get(question, :id, "new") %>">
|
||||
<div class="display_question question <%= question_type.question_type %> <%= "marked" if assessing && @stored_params && @stored_params["question_#{hash_get(question, :id)}_marked"] %> <%= "correct" if correct %> <%= "incorrect" if !correct %> <%= "unanswered" if unanswered %>" id="question_<%= hash_get(question, :id, "new") %>">
|
||||
<div class="move"><%= image_tag "move.png", :class => "move_icon" %></div>
|
||||
<% if assessing %>
|
||||
<div class="flag_question">
|
||||
<%= image_tag "flag_question.png", :title => t('titles.mark_to_revisit', "Mark this question to come back to later"), :class => "flag_icon" %>
|
||||
</div>
|
||||
<div class="flag_question"></div>
|
||||
<% end %>
|
||||
<div class="header" <%= hidden(true) if (assessing || assessment_results) && question_type && question_type.entry_type == "none" %>>
|
||||
<span class="name question_name"><%= hash_get(question, :question_name) %></span>:
|
||||
<span class="name question_name"><%= hash_get(question, :question_name) %></span>
|
||||
<span class="question_points_holder" style="<%= hidden if question_type && question_type.entry_type == "none" %>">
|
||||
<% if user_answer %>
|
||||
<div class="user_points" <%= hidden(true) if (assessing || assessment_results) && question_type && question_type.entry_type == "none" %>>
|
||||
<% if editable %>
|
||||
<input type="text" class="question_input" name="question_score_<%= hash_get(question, :id) %>" value="<%= hash_get(user_answer, :correct) == "undefined" ? "--" : hash_get(user_answer, :points) %>" autocomplete='off'/>
|
||||
<% else %>
|
||||
<% if hash_get(user_answer, :correct) == "undefined" %>
|
||||
<%= t(:not_yet_graded, 'Not yet graded') %>
|
||||
<% else %>
|
||||
<%= hash_get(user_answer, :points) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% question[:points_possible] = 0 if question_type.answer_type == 'none' %>
|
||||
<%= t(:points_possible, "%{points_possible} pts", :points_possible => raw("<span class=\"points question_points\"> / #{hash_get(question, :points_possible, "0")}</span>")) %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= t(:points_possible, "%{points_possible} pts", :points_possible => raw("<span class=\"points question_points\">#{hash_get(question, :points_possible, "0")}</span>")) %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% if question && hash_get(question, :question_type) != "missing_word_question" && hash_get(question, :question_text) && hash_get(question, :question_text).length < 255 %>
|
||||
<span class='ui-helper-hidden-accessible'><%= hash_get(question, :question_text) %></span>
|
||||
|
@ -51,7 +69,6 @@
|
|||
<% end %>
|
||||
<span class="assessment_question_id"><%= hash_get(question, :assessment_question_id, nbsp) %></span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="text">
|
||||
<div class="original_question_text" style="display: none;">
|
||||
<textarea style="display: none;" name="text_after_answers" class="textarea_text_after_answers"><%= h(hash_get(question, :text_after_answers)) %></textarea>
|
||||
|
@ -68,9 +85,21 @@
|
|||
</select>
|
||||
<span class="text_after_answers"><%= user_content(hash_get(question, :text_after_answers)) %></span>
|
||||
<% elsif question && hash_get(question, :question_type) == "fill_in_multiple_blanks_question" && @stored_params %>
|
||||
<%= fill_in_multiple_blanks_question :question => question, :answers => @stored_params %>
|
||||
<% answer_list = []
|
||||
if assessment_results
|
||||
variables = hash_get(question, :answers, []).map{|a| hash_get(a, :blank_id) }.compact.uniq
|
||||
variables.each {|var| answer_list << hash_get(user_answer, "answer_for_#{var}") }
|
||||
end
|
||||
%>
|
||||
<%= fill_in_multiple_blanks_question :question => question, :answers => @stored_params, :answer_list => answer_list %>
|
||||
<% elsif question && hash_get(question, :question_type) == "multiple_dropdowns_question" %>
|
||||
<%= multiple_dropdowns_question :question => question, :answers => @stored_params %>
|
||||
<% answer_list = []
|
||||
if assessment_results
|
||||
variables = hash_get(question, :answers, []).map{|a| hash_get(a, :blank_id) }.compact.uniq
|
||||
variables.each {|var| answer_list << hash_get(user_answer, "answer_id_for_#{var}") }
|
||||
end
|
||||
%>
|
||||
<%= multiple_dropdowns_question :question => question, :answers => @stored_params, :answer_list => answer_list %>
|
||||
<% else %>
|
||||
<%= user_content(hash_get(question, :question_text)) %>
|
||||
<% end %>
|
||||
|
@ -162,13 +191,12 @@
|
|||
<div class="answers">
|
||||
<% if assessing %>
|
||||
<% if question %>
|
||||
<% if question_type.display_answers == "multiple" && hash_get(question, :question_type) != "missing_word_question" %>
|
||||
<% if question_type.display_answers == "multiple" && !["missing_word_question", "fill_in_multiple_blanks_question"].include?(hash_get(question, :question_type)) %>
|
||||
<% list = hash_get(question, :answers, []) %>
|
||||
|
||||
<%= render :partial => "quizzes/multi_answer", :collection => list, :locals =>
|
||||
<%= render :partial => "quizzes/multi_answer", :collection => list, :locals =>
|
||||
{:question => question, :right_answers => right_answers, :question_type => question_type, :user_answer => user_answer} %>
|
||||
<% elsif question_type.display_answers == "single" %>
|
||||
<%= render :partial => "quizzes/single_answer", :locals =>
|
||||
<%= render :partial => "quizzes/single_answer", :locals =>
|
||||
{:question => question, :right_answers => right_answers, :question_type => question_type, :user_answer => user_answer} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
@ -177,48 +205,46 @@
|
|||
<% variables = hash_get(question, :original_question_text, "").scan(/\[[^\]]+\]/).to_a.compact.map{|v| v[1..-2] } %>
|
||||
<% variables = variables & hash_get(question, :answers, []).map{|a| hash_get(a, :blank_id) }.compact.uniq %>
|
||||
<% variables.each_with_index do |variable, idx| %>
|
||||
<b><%= before_label(:for_answer_number, "For answer %{answer_number}", :answer_number => idx + 1) %></b>
|
||||
<div style="margin-left: 20px;">
|
||||
<% answers = hash_get(question, :answers, []).select{|a| hash_get(a, :blank_id) == variable } %>
|
||||
<% answers = hash_get(question, :answers, []).select{|a| hash_get(a, :blank_id) == variable } %>
|
||||
<% user_answer[:text] = hash_get(user_answer, "answer_for_#{variable}")
|
||||
user_answer[:text] = nil if user_answer[:text].blank?
|
||||
matched_answer = answers.find{|a| hash_get(a, :text) == hash_get(user_answer, :text) || hash_get(a, :id) == hash_get(user_answer, :answer_id) }
|
||||
%>
|
||||
<div class="answer_group">
|
||||
<b class="answer-group-heading"><%= before_label(:for_answer_number, "Answer %{answer_number}", :answer_number => idx + 1) %></b>
|
||||
<% if question_type.entry_type == "text_box" %>
|
||||
<% user_answer[:text] = hash_get(user_answer, "answer_for_#{variable}")
|
||||
user_answer[:text] = nil if user_answer[:text].blank?
|
||||
<% answer_classes = ['selected_answer']
|
||||
answer_classes << ((matched_answer && matched_answer[:weight] == 100) ? 'correct_answer' : 'wrong_answer')
|
||||
answer_classes << 'no_answer' if hash_get(user_answer, :text).blank?
|
||||
%>
|
||||
<% matched_answer = answers.find{|a| hash_get(a, :text) == hash_get(user_answer, :text) || hash_get(a, :id) == hash_get(user_answer, :answer_id) } %>
|
||||
<span class="text_box_answer <%= 'correct_text_box_answer' if matched_answer && matched_answer[:weight] == 100 %>">
|
||||
<%= before_label(:your_answer, "Your Answer") %>
|
||||
<b><%= h(hash_get(user_answer, :text) || t(:you_left_this_blank, "You left this blank")) %></b>
|
||||
</span>
|
||||
<% if matched_answer && comment_get(matched_answer, :comments).present? %>
|
||||
<div class="answer hide_right_arrow correct_answer">
|
||||
<div class="answer_comment_holder">
|
||||
<div class="comment_top"></div>
|
||||
<div class="answer_comment"><%= comment_get(matched_answer, :comments) %></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<% end %>
|
||||
<% show_headers = @quiz && @quiz.show_correct_answers %>
|
||||
<% if show_headers %>
|
||||
<div style="font-size: 0.8em; margin-top: 5px; margin-bottom: 5px;">
|
||||
<u><%= before_label(:correct_answers, {:one => "Correct Answer", :other => "Correct Answers"}, :count => answers.size) %></u>
|
||||
<div style="xfont-size: 0.8em;">
|
||||
<% end %>
|
||||
<% if editing || show_headers || !question_type.entry_type.match(/text_box/) %>
|
||||
<%= render :partial => "quizzes/display_answer", :collection => answers, :locals => {:assessment_results => assessment_results, :question_type => question_type, :user_answer => user_answer, :question => question} %>
|
||||
<% end %>
|
||||
<% if show_headers %>
|
||||
</div></div>
|
||||
<div class='answer <%= answer_classes.compact.join(' ') %>'>
|
||||
<%= h(hash_get(user_answer, :text) || t(:you_left_this_blank, "(You left this blank)")) %>
|
||||
<% if matched_answer && comment_get(matched_answer, :comments).present? %>
|
||||
<div class="hide_right_arrow correct_answer">
|
||||
<div class="quiz_comment">
|
||||
<%= comment_get(matched_answer, :comments) %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if editing || @quiz.try(:show_correct_answers) %>
|
||||
<%= render :partial => "quizzes/display_answer", :collection => answers, :locals => {:assessment_results => assessment_results, :question_type => question_type, :user_answer => user_answer, :question => question, :skip_if_correct => true, :matched_answer => matched_answer} %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% user_answer[:answer_id] = hash_get(user_answer, "answer_id_for_#{variable}") %>
|
||||
<% if user_answer[:answer_id].nil? %>
|
||||
<div class='answer selected_answer wrong_answer no_answer'>
|
||||
<%= t(:you_left_this_blank, "(You left this blank)") %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= render :partial => "quizzes/display_answer", :collection => answers, :locals => {:assessment_results => assessment_results, :question_type => question_type, :user_answer => user_answer, :question => question} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if user_answer && question_type.display_answers == "single" %>
|
||||
<div style="padding: 5px 20px;">
|
||||
<div>
|
||||
<% if question_type.entry_type == 'textarea' %>
|
||||
Your Answer:
|
||||
<div class="user_content quiz_response_text"><%= hash_get(user_answer, :text).html_safe %></div>
|
||||
|
@ -229,18 +255,19 @@
|
|||
matched_answer = a if hash_get(a, :numerical_answer_type) == 'exact_answer' && val <= (hash_get(a, :exact) + hash_get(a, :margin)) && val >= (hash_get(a, :exact) - hash_get(a, :margin))
|
||||
matched_answer = a if hash_get(a, :numerical_answer_type) == 'range_answer' && val <= hash_get(a, :end) && val >= hash_get(a, :start)
|
||||
end %>
|
||||
<span class="text_box_answer <%= 'correct_text_box_answer' if user_answer[:correct] %>">
|
||||
<%= before_label(:your_answer, 'Your Answer') %>
|
||||
<% user_text = hash_get(user_answer, :text)
|
||||
user_text = nil if user_text.blank? %>
|
||||
<b><%= h(user_text || t(:you_left_this_blank, 'You left this blank')) %></b>
|
||||
</span>
|
||||
<% answer_classes = ['selected_answer']
|
||||
answer_classes << ((hash_get(user_answer, :correct) == true) ? 'correct_answer' : 'wrong_answer')
|
||||
answer_classes << 'no_answer' if hash_get(user_answer, :text).blank?
|
||||
%>
|
||||
<div class='answer <%= answer_classes.compact.join(' ') %>'>
|
||||
<%= render :partial => "quizzes/single_answer", :locals =>
|
||||
{:question => question, :right_answers => right_answers, :question_type => question_type, :user_answer => user_answer} %>
|
||||
</div>
|
||||
<% if matched_answer && comment_get(matched_answer, :comments).present? %>
|
||||
<div class="answer hide_right_arrow correct_answer">
|
||||
<div class="answer_comment_holder">
|
||||
<div class="comment_top"></div>
|
||||
<div class="answer_comment"><%= comment_get(matched_answer, :comments) %></div>
|
||||
</div>
|
||||
<div class="hide_right_arrow correct_answer">
|
||||
<div class="quiz_comment">
|
||||
<%= comment_get(matched_answer, :comments) %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<% end %>
|
||||
|
@ -250,16 +277,10 @@
|
|||
<% question[:answers] = [] if editing && question && hash_get(question, :question_type) == 'calculated_question' %>
|
||||
<% if question && (user_answer || assessment_results || !@quiz || @quiz.show_correct_answers || (!assessment_results && !user_answer)) %>
|
||||
<% show_headers = @quiz && @quiz.show_correct_answers && user_answer && question_type.display_answers == "single" && hash_get(question, :question_type) != "essay_question" %>
|
||||
<% if show_headers %>
|
||||
<div style="margin-left: 20px; font-size: 0.8em;">
|
||||
<u><%= before_label :correct_answers2, 'Correct Answer(s)' %></u>
|
||||
<div style="xfont-size: 0.8em;">
|
||||
<% end %>
|
||||
<% if editing || show_headers || !question_type.entry_type.match(/text_box/) %>
|
||||
<%= render :partial => "quizzes/display_answer", :collection => hash_get(question, :answers), :locals => {:assessment_results => assessment_results, :question_type => question_type, :user_answer => user_answer, :question => question} %>
|
||||
<% end %>
|
||||
<% if show_headers %>
|
||||
</div></div>
|
||||
<div class="answers_wrapper">
|
||||
<%= render :partial => "quizzes/display_answer", :collection => hash_get(question, :answers), :locals => {:assessment_results => assessment_results, :question_type => question_type, :user_answer => user_answer, :question => question} %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
@ -280,34 +301,15 @@
|
|||
</div>
|
||||
</div>
|
||||
<% if user_answer %>
|
||||
<% if hash_get(user_answer, :correct) == true && comment_get(question, :correct_comments).present? %>
|
||||
<div class="question_comment question_correct_comment">
|
||||
<div class="comment_top"></div>
|
||||
<div class="question_comment_text correct_comments"><%= comment_get(question, :correct_comments) %></div>
|
||||
</div>
|
||||
<% elsif hash_get(user_answer, :correct) == false && comment_get(question, :incorrect_comments).present? %>
|
||||
<div class="question_comment question_incorrect_comment">
|
||||
<div class="comment_top"></div>
|
||||
<div class="question_comment_text incorrect_comments"><%= comment_get(question, :incorrect_comments) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if hash_get(question, :neutral_comments) && comment_get(question, :neutral_comments).present? %>
|
||||
<div class="question_comment question_neutral_comment">
|
||||
<div class="comment_top"></div>
|
||||
<div class="question_comment_text neutral_comments"><%= comment_get(question, :neutral_comments) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= question_comment(user_answer, question) %>
|
||||
<% if (hash_get(user_answer, :more_comments) && comment_get(user_answer, :more_comments).present?) || (editable && question_type && question_type.entry_type != "none") %>
|
||||
<div class="question_comment question_neutral_comment">
|
||||
<div class="comment_top"></div>
|
||||
<div class="question_comment_text">
|
||||
<% if editable %>
|
||||
<span style="font-size: 0.8em;"><%= before_label(:additional_comments, "Additional Comments") %></span>
|
||||
<textarea name="question_comment_<%= hash_get(question, :id) %>" style="display: block; width: auto; margin-left: 5px; margin-right: 5px; height: 50px;"><%= comment_get(user_answer, :more_comments) || "" %></textarea>
|
||||
<% else %>
|
||||
<%= comment_get(user_answer, :more_comments) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="quiz_comment">
|
||||
<% if editable %>
|
||||
<span style="font-size: 0.8em;"><%= before_label(:additional_comments, "Additional Comments") %></span>
|
||||
<textarea name="question_comment_<%= hash_get(question, :id) %>" style="display: block; width: auto; margin-left: 5px; margin-right: 5px; height: 50px;"><%= comment_get(user_answer, :more_comments) || "" %></textarea>
|
||||
<% else %>
|
||||
<%= comment_get(user_answer, :more_comments) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% elsif !assessing %>
|
||||
|
@ -327,21 +329,6 @@
|
|||
<div class="question_comment_html neutral_comments_html"><%= raw hash_get(question, :neutral_comments_html) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if user_answer %>
|
||||
<div class="user_points" <%= hidden(true) if (assessing || assessment_results) && question_type && question_type.entry_type == "none" %>>
|
||||
<% if editable %>
|
||||
<input type="text" class="question_input" name="question_score_<%= hash_get(question, :id) %>" style="width: 30px; font-size: 1.2em;" value="<%= hash_get(user_answer, :correct) == "undefined" ? "--" : hash_get(user_answer, :points) %>" autocomplete='off'/>
|
||||
<% else %>
|
||||
<% if hash_get(user_answer, :correct) == "undefined" %>
|
||||
--
|
||||
<% else %>
|
||||
<%= hash_get(user_answer, :points) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% question[:points_possible] = 0 if question_type.answer_type == 'none' %>
|
||||
<span class="points_possible"> / <%= hash_get(question, :points_possible).to_f %></span>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if question_bank_id %>
|
||||
<div class="bottom_links">
|
||||
<a href="#" class="move_question_link"><%= t('links.move_copy_question', "move/copy question to another bank") %></a>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="answer" id="form_answer_template" style="display: none; _width: 100%;">
|
||||
|
||||
|
||||
<table style="width: 100%; position: relative; _height: 10px; min-height: 10px;">
|
||||
<tr>
|
||||
<td class="answer_select" style="width: 30px;">
|
||||
|
|
|
@ -9,30 +9,25 @@
|
|||
<form id="question_form_template" class="question_form" style="display: none;">
|
||||
<div class="question">
|
||||
<div class="header" style="background-color: transparent;">
|
||||
<div style="float: left; background-color: #fff;">
|
||||
<input type="text" style="width: 150px;" name="question_name"/>
|
||||
<span class="question_points_holder">
|
||||
<span style="padding-left: 20px;"><%= before_label :points, 'pts' %></span>
|
||||
<input class="float_value" type="text" style="width: 25px;" name="question_points"/>
|
||||
</span>
|
||||
</div>
|
||||
<div style="float: right; margin-right: 25px; margin-left: 25px; margin-top: 2px;">
|
||||
<select class="question_type" name="question_type">
|
||||
<option value="multiple_choice_question" style="padding: 2px;"><%= t('question_type.multiple_choice', "Multiple Choice") %></option>
|
||||
<option value="true_false_question" style="padding: 2px;"><%= t('question_type.true_false', "True/False") %></option>
|
||||
<option value="short_answer_question" style="padding: 2px;"><%= t('question_type.short_answer', "Fill In the Blank") %></option>
|
||||
<option value="fill_in_multiple_blanks_question" style="padding: 2px;"><%= t('question_type.fill_in_multiple_blanks', "Fill In Multiple Blanks") %></option>
|
||||
<option value="multiple_answers_question" style="padding: 2px;"><%= t('question_type.multiple_answers', "Multiple Answers") %></option>
|
||||
<option value="multiple_dropdowns_question" style="padding: 2px;"><%= t('question_type.multiple_dropdowns', "Multiple Dropdowns") %></option>
|
||||
<option value="matching_question" style="padding: 2px;"><%= t('question_type.matching', "Matching") %></option>
|
||||
<option value="numerical_question" style="padding: 2px;"><%= t('question_type.numerical', "Numerical Answer") %></option>
|
||||
<option value="calculated_question" style="padding: 2px;"><%= t('question_type.calculated', "Formula Question") %></option>
|
||||
<option value="missing_word_question" style="padding: 2px;" class="missing_word"><%= t('question_type.missing_word', "Missing Word") %></option>
|
||||
<option value="essay_question" style="padding: 2px;"><%= t('question_type.essay', "Essay Question") %></option>
|
||||
<option value="text_only_question" style="padding: 2px;"><%= t('question_type.text_only', "Text (no question)") %></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<input type="text" style="width: 150px;" name="question_name"/>
|
||||
<select class="question_type" name="question_type">
|
||||
<option value="multiple_choice_question" style="padding: 2px;"><%= t('question_type.multiple_choice', "Multiple Choice") %></option>
|
||||
<option value="true_false_question" style="padding: 2px;"><%= t('question_type.true_false', "True/False") %></option>
|
||||
<option value="short_answer_question" style="padding: 2px;"><%= t('question_type.short_answer', "Fill In the Blank") %></option>
|
||||
<option value="fill_in_multiple_blanks_question" style="padding: 2px;"><%= t('question_type.fill_in_multiple_blanks', "Fill In Multiple Blanks") %></option>
|
||||
<option value="multiple_answers_question" style="padding: 2px;"><%= t('question_type.multiple_answers', "Multiple Answers") %></option>
|
||||
<option value="multiple_dropdowns_question" style="padding: 2px;"><%= t('question_type.multiple_dropdowns', "Multiple Dropdowns") %></option>
|
||||
<option value="matching_question" style="padding: 2px;"><%= t('question_type.matching', "Matching") %></option>
|
||||
<option value="numerical_question" style="padding: 2px;"><%= t('question_type.numerical', "Numerical Answer") %></option>
|
||||
<option value="calculated_question" style="padding: 2px;"><%= t('question_type.calculated', "Formula Question") %></option>
|
||||
<option value="missing_word_question" style="padding: 2px;" class="missing_word"><%= t('question_type.missing_word', "Missing Word") %></option>
|
||||
<option value="essay_question" style="padding: 2px;"><%= t('question_type.essay', "Essay Question") %></option>
|
||||
<option value="text_only_question" style="padding: 2px;"><%= t('question_type.text_only', "Text (no question)") %></option>
|
||||
</select>
|
||||
<span class="question_points_holder">
|
||||
<span style="padding-left: 20px;"><%= before_label :points, 'pts' %></span>
|
||||
<input class="float_value" type="text" style="width: 25px;" name="question_points"/>
|
||||
</span>
|
||||
</div>
|
||||
<div class="links">
|
||||
</div>
|
||||
|
@ -203,8 +198,8 @@
|
|||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="button-container">
|
||||
<button type="submit" class="button small-button submit_button"><%= t('buttons.create_update_question', "Create/Update Question") %></button>
|
||||
<button type="button" class="button-secondary cancel_link"><%= t('#buttons.cancel', "Cancel") %></button>
|
||||
<button type="button" class="button small-button cancel_link"><%= t('#buttons.cancel', "Cancel") %></button>
|
||||
<button type="submit" class="button small-button submit_button btn-primary"><%= t('buttons.create_update_question', "Create/Update Question") %></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -10,29 +10,46 @@
|
|||
</div>
|
||||
<div>
|
||||
<table class="summary" style="font-size: 1.1em;">
|
||||
<tr>
|
||||
<th><%= before_label(:time, "Time") %></th>
|
||||
<td><%= time_ago_in_words(Time.now - ((@submission.finished_at || @submission.end_at || @submission.started_at) - @submission.started_at)) %></td>
|
||||
</tr>
|
||||
<% unless @quiz.assignment.present? && @quiz.assignment.muted? %>
|
||||
<tr style="<%= hidden if @quiz.quiz_type == 'survey' %>">
|
||||
<th><%= before_label(:current_score, "Current Score") %></th>
|
||||
<td><%= t(:score_out_of_points_possible, "%{score} out of %{points_possible}",
|
||||
:score => render(:partial => "submission_score", :object => @submission),
|
||||
:points_possible => params[:preview] ? @submission.points_possible_at_submission_time : @quiz.points_possible) %></td>
|
||||
</tr>
|
||||
<tr style="<%= hidden if @quiz.quiz_type == 'survey' %>">
|
||||
<th><%= before_label(:kept_score, "Kept Score") %></th>
|
||||
<td><%= t(:score_out_of_points_possible, "%{score} out of %{points_possible}",
|
||||
:score => @submission.kept_score,
|
||||
:points_possible => params[:preview] ? @submission.points_possible_at_submission_time : @quiz.points_possible) %></td>
|
||||
</tr>
|
||||
<% if @submission.manually_scored %>
|
||||
<tr>
|
||||
<td colspan="2"><%= t('score_set_manually', 'This score was set by the teacher') %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @submission.pending_review? %>
|
||||
<tfoot>
|
||||
<tr style="<%= hidden if @quiz.quiz_type == 'survey' %>">
|
||||
<td colspan="2" class="footnote">
|
||||
*
|
||||
<% if can_do(@quiz, @current_user, :grade) %>
|
||||
<%= link_to t(:questions_not_graded, 'Some questions not yet graded'), context_url(@context, :context_quiz_history_url, @quiz, :version => @submission.version_number, :user_id => @submission.user_id) %>
|
||||
<% else %>
|
||||
<%= t(:questions_not_graded, 'Some questions not yet graded') %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<% end %>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><%= before_label(:time, "Time") %></th>
|
||||
<td><%= time_ago_in_words(Time.now - ((@submission.finished_at || @submission.end_at || @submission.started_at) - @submission.started_at)) %></td>
|
||||
</tr>
|
||||
<% unless @quiz.assignment.present? && @quiz.assignment.muted? %>
|
||||
<tr style="<%= hidden if @quiz.quiz_type == 'survey' %>">
|
||||
<th><%= before_label(:current_score, "Current Score") %></th>
|
||||
<td><%= t(:score_out_of_points_possible, "%{score} out of %{points_possible}",
|
||||
:score => @submission.score,
|
||||
:points_possible => params[:preview] ? @submission.points_possible_at_submission_time : @quiz.points_possible) %>
|
||||
<%= '*' if @submission.pending_review? %></td>
|
||||
</tr>
|
||||
<tr style="<%= hidden if @quiz.quiz_type == 'survey' %>">
|
||||
<th><%= before_label(:kept_score, "Kept Score") %></th>
|
||||
<td><%= t(:score_out_of_points_possible, "%{score} out of %{points_possible}",
|
||||
:score => @submission.kept_score,
|
||||
:points_possible => params[:preview] ? @submission.points_possible_at_submission_time : @quiz.points_possible) %></td>
|
||||
</tr>
|
||||
<% if @submission.manually_scored %>
|
||||
<tr>
|
||||
<td colspan="2"><%= t('score_set_manually', 'This score was set by the teacher') %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<div class="quiz-submission">
|
||||
<% if !(@current_submission || @submission).results_visible? %>
|
||||
<h4><%= @quiz.hide_results == 'until_after_last_attempt' ?
|
||||
t(:quiz_results_protected_until_last_attempt, "Quiz results are protected for this quiz, and are not visible to students until they have submitted their last attempt.") :
|
||||
|
@ -19,8 +20,18 @@
|
|||
<%= before_label(:score_for_quiz, "Score for this quiz") %>
|
||||
<% end %>
|
||||
<%= t(:score_out_of_points_possible, "%{score} out of %{points_possible}",
|
||||
:score => raw("<span class=\"score_value\">#{render :partial => "submission_score", :object => @submission, :locals => {:quiz => @quiz, :context => @context}}</span>"),
|
||||
:score => raw("<span class=\"score_value\">#{@submission.score}</span>"),
|
||||
:points_possible => params[:preview] ? @submission.points_possible_at_submission_time : @quiz.points_possible) %>
|
||||
<% if submission_score.pending_review? %>
|
||||
*
|
||||
<div>
|
||||
<% if can_do(@quiz, @current_user, :grade) %>
|
||||
<%= link_to t(:questions_not_graded, 'Some questions not yet graded'), context_url(@context, :context_quiz_history_url, @quiz, :version => @submission.version_number, :user_id => @submission.user_id) %>
|
||||
<% else %>
|
||||
<%= t(:questions_not_graded, 'Some questions not yet graded') %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<% @stored_params ||= {}
|
||||
|
@ -62,9 +73,20 @@
|
|||
<%= before_label(:score_for_quiz, "Score for this quiz") %>
|
||||
<% end %>
|
||||
<%= t(:score_out_of_points_possible, "%{score} out of %{points_possible}",
|
||||
:score => raw("<span class=\"score_value\">#{render :partial => "submission_score", :object => @submission, :locals => {:quiz => @quiz, :context => @context}}</span>"),
|
||||
:score => raw("<span class=\"score_value\">#{@submission.score}</span>"),
|
||||
:points_possible => params[:preview] ? @submission.points_possible_at_submission_time : @quiz.points_possible) %>
|
||||
</div>
|
||||
<%= '*' if @submission.pending_review? %>
|
||||
</div>
|
||||
<% if @submission.pending_review? %>
|
||||
<div>
|
||||
*
|
||||
<% if can_do(@quiz, @current_user, :grade) %>
|
||||
<%= link_to t(:questions_not_graded, 'Some questions not yet graded'), context_url(@context, :context_quiz_history_url, @quiz, :version => @submission.version_number, :user_id => @submission.user_id) %>
|
||||
<% else %>
|
||||
<%= t(:questions_not_graded, 'Some questions not yet graded') %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @submission.finished_at %>
|
||||
<div>
|
||||
<%= t(:submitted_at, "Submitted %{when}", :when => datetime_string(@submission.finished_at)) %>
|
||||
|
@ -188,7 +210,6 @@ $(document).ready(function() {
|
|||
<%= t(:survey_fudged_negative, "This survey score has been manually adjusted by %{fudge} points.", :fudge => @submission.fudge_points) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
This quiz score has been manually adjusted by <%= '+' if @submission.fudge_points > 0 %><%= pluralize(@submission.fudge_points, "point") %>.
|
||||
<% if @submission.fudge_points > 0 %>
|
||||
<%= t(:quiz_fudged_positive, "This quiz score has been manually adjusted by +%{fudge} points.", :fudge => @submission.fudge_points) %>
|
||||
<% else %>
|
||||
|
@ -206,9 +227,21 @@ $(document).ready(function() {
|
|||
<%= before_label(:quiz_score, "Quiz Score") %>
|
||||
<% end %>
|
||||
<%= t(:score_out_of_points_possible, "%{score} out of %{points_possible}",
|
||||
:score => raw("<span class=\"score_value\">#{render :partial => "submission_score", :object => @submission, :locals => {:quiz => @quiz, :context => @context}}</span>"),
|
||||
:score => raw("<span class=\"score_value\">#{@submission.score}</span>"),
|
||||
:points_possible => params[:preview] ? @submission.points_possible_at_submission_time : @quiz.points_possible) %>
|
||||
<% if @submission.pending_review? %>
|
||||
*
|
||||
<div>
|
||||
*
|
||||
<% if can_do(@quiz, @current_user, :grade) %>
|
||||
<%= link_to t(:questions_not_graded, 'Some questions not yet graded'), context_url(@context, :context_quiz_history_url, @quiz, :version => @submission.version_number, :user_id => @submission.user_id) %>
|
||||
<% else %>
|
||||
<%= t(:questions_not_graded, 'Some questions not yet graded') %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<div style="margin-left: 30px;">
|
||||
<div>
|
||||
<% value = (@stored_params.present?) ? h(@stored_params["question_#{hash_get(question, :id)}"]) : h(hash_get(user_answer, :text).to_s) %>
|
||||
<% if question_type.entry_type == "text_box" %>
|
||||
<input type="text" name="question_<%= hash_get(question, :id) %>" value="<%= h(@stored_params["question_#{hash_get(question, :id)}"]) %>" class="question_input" autocomplete='off'/>
|
||||
<input type="text" name="question_<%= hash_get(question, :id) %>" value="<%= value %>" class="question_input" autocomplete='off'/>
|
||||
<% elsif question_type.entry_type == "numerical_text_box" %>
|
||||
<input type="text" name="question_<%= hash_get(question, :id) %>" value="<%= h(@stored_params["question_#{hash_get(question, :id)}"]) %>" class="question_input numerical_question_input" autocomplete='off'/>
|
||||
<input type="text" name="question_<%= hash_get(question, :id) %>" value="<%= value %>" class="question_input numerical_question_input" autocomplete='off'/>
|
||||
<% elsif question_type.entry_type == "textarea" %>
|
||||
<textarea name="question_<%= hash_get(question, :id) %>" class="question_input" style="width: 90%;" autocomplete='off'><%= h(@stored_params["question_#{hash_get(question, :id)}"]) %></textarea>
|
||||
<textarea name="question_<%= hash_get(question, :id) %>" class="question_input" style="width: 90%;" autocomplete='off'><%= value %></textarea>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<% quiz ||= submission_score.quiz; context ||= quiz.context %>
|
||||
<% if submission_score.pending_review? %>
|
||||
<% if can_do(quiz, @current_user, :grade) %>
|
||||
<a href="<%= context_url(context, :context_quiz_history_url, quiz) %>?version=<%= submission_score.version_number %><%= "&user_id=#{@submission.user_id}" %>" class="no-hover">
|
||||
<%= image_tag "pending_review.png", :title => t('titles.score_needs_review', "This score needs review") %></a>
|
||||
<% else %>
|
||||
<%= image_tag "hourglass.png", :title => t('titles.score_pending_review', "This score is pending review, and may change") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= submission_score.score %>
|
|
@ -14,11 +14,11 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<% unless params[:headless] %>
|
||||
<h2>
|
||||
<%= @quiz.survey? ?
|
||||
t('headers.survey_submissions', "Survey Submissions") :
|
||||
t('headers.quiz_submissions', "Quiz Submissions") %>
|
||||
</h2>
|
||||
<h2>
|
||||
<%= @quiz.survey? ?
|
||||
t('headers.survey_submissions', "Survey Submissions") :
|
||||
t('headers.quiz_submissions', "Quiz Submissions") %>
|
||||
</h2>
|
||||
<div class="rs-margin-lr">
|
||||
<ul id="quiz_versions" style="max-height: 250px; overflow: auto;">
|
||||
<% @version_instances.each do |version_instance| %>
|
||||
|
@ -61,15 +61,17 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<h2>
|
||||
<% if @quiz.quiz_title %>
|
||||
<%= t(:named_quiz_results, "%{quiz_name} Results for %{user}", :quiz_name => @quiz.quiz_title, :user => user_name) %>
|
||||
<% elsif @quiz.survey? %>
|
||||
<%= t(:unnamed_survey_results, "Survey Results for %{user}", :user => user_name) %>
|
||||
<% else %>
|
||||
<%= t(:unnamed_quiz_results, "Quiz Results for %{user}", :user => user_name) %>
|
||||
<% end %>
|
||||
</h2>
|
||||
<header class="quiz-header">
|
||||
<h2>
|
||||
<% if @quiz.quiz_title %>
|
||||
<%= t(:named_quiz_results, "%{quiz_name} Results for %{user}", :quiz_name => @quiz.quiz_title, :user => user_name) %>
|
||||
<% elsif @quiz.survey? %>
|
||||
<%= t(:unnamed_survey_results, "Survey Results for %{user}", :user => user_name) %>
|
||||
<% else %>
|
||||
<%= t(:unnamed_quiz_results, "Quiz Results for %{user}", :user => user_name) %>
|
||||
<% end %>
|
||||
</h2>
|
||||
</header>
|
||||
<div id="feel_free_to_toggle_message">
|
||||
</div>
|
||||
<% if !@submission || @submission.settings_only? %>
|
||||
|
@ -95,166 +97,10 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% js_block do %>
|
||||
<script>
|
||||
require([
|
||||
'INST' /* INST */,
|
||||
'jquery' /* $ */,
|
||||
'jquery.instructure_misc_plugins' /* fragmentChange */,
|
||||
'jquery.templateData' /* getTemplateData */,
|
||||
'vendor/jquery.scrollTo' /* /\.scrollTo/ */
|
||||
], function(INST, $) {
|
||||
|
||||
$(document).ready(function() {
|
||||
$(":text").focus(function() {
|
||||
$(this).select();
|
||||
});
|
||||
<% if params[:score_updated] %>
|
||||
window.parent &&
|
||||
window.parent.INST &&
|
||||
$.isFunction(window.parent.INST.refreshGrades) &&
|
||||
window.parent.INST.refreshGrades();
|
||||
<% end %>
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
<div style="display: none;" id="submission_details">
|
||||
<div class="version_number"><%= @version_number.to_s %></div>
|
||||
<div class="user_id"><%= @submission.user_id %></div>
|
||||
</div>
|
||||
<% js_block do %>
|
||||
<script>
|
||||
require([
|
||||
'jquery' /* $ */,
|
||||
'jquery.instructure_misc_plugins' /* fragmentChange */,
|
||||
'jquery.templateData' /* getTemplateData */,
|
||||
'vendor/jquery.scrollTo' /* /\.scrollTo/ */,
|
||||
'compiled/behaviors/quiz_selectmenu'
|
||||
], function($) {
|
||||
|
||||
var data = $("#submission_details").getTemplateData({textValues: ['version_number', 'user_id']});
|
||||
var scoringSnapshot = {
|
||||
snapshot: {
|
||||
user_id: parseInt(data.user_id, 10) || null,
|
||||
version_number: data.version_number,
|
||||
last_question_touched: null,
|
||||
question_updates: {},
|
||||
fudge_points: 0
|
||||
},
|
||||
getSnapshot: function() {
|
||||
return scoringSnapshot.snapshot;
|
||||
},
|
||||
jumpToQuestion: function(question_id) {
|
||||
var top = $("#question_" + question_id).offset().top - 10;
|
||||
$("html,body").scrollTo({top: top, left:0});
|
||||
},
|
||||
externallySet: false,
|
||||
setSnapshot: function(data, cancelIfAlreadyExternallySet) {
|
||||
if(data) {
|
||||
if(cancelIfAlreadyExternallySet && scoringSnapshot.externallySet) { return; }
|
||||
scoringSnapshot.externallySet = true;
|
||||
scoringSnapshot.snapshot = data;
|
||||
for(var idx in data.question_updates) {
|
||||
var question = data.question_updates[idx];
|
||||
var $question = $("#question_" + idx);
|
||||
$question.addClass('modified_but_not_saved');
|
||||
$question.find(".user_points :text").val(question.points).end()
|
||||
.find(".question_neutral_comment .question_comment_text textarea").val(question.comments);
|
||||
}
|
||||
if(window.parent && window.parent.INST && window.parent.INST.lastQuestionTouched) {
|
||||
scoringSnapshot.jumpToQuestion(window.parent.INST.lastQuestionTouched);
|
||||
} else if(scoringSnapshot.snapshot.last_question_touched) {
|
||||
scoringSnapshot.jumpToQuestion(scoringSnapshot.snapshot.last_question_touched);
|
||||
}
|
||||
} else if(cancelIfAlreadyExternallySet) {
|
||||
if(window.parent && window.parent.INST && window.parent.INST.lastQuestionTouched) {
|
||||
scoringSnapshot.jumpToQuestion(window.parent.INST.lastQuestionTouched);
|
||||
}
|
||||
}
|
||||
if(scoringSnapshot.externallySet || cancelIfAlreadyExternallySet) {
|
||||
$("#feel_free_to_toggle_message").show();
|
||||
}
|
||||
if(window.parent && window.parent.INST && window.parent.INST.refreshQuizSubmissionSnapshot && $.isFunction(window.parent.INST.refreshQuizSubmissionSnapshot)) {
|
||||
window.parent.INST.refreshQuizSubmissionSnapshot(scoringSnapshot.snapshot);
|
||||
}
|
||||
}
|
||||
}
|
||||
$(document).ready(function() {
|
||||
$(":text").focus(function() {
|
||||
$(this).select();
|
||||
});
|
||||
$(document).fragmentChange(function(event, hash) {
|
||||
if(hash.indexOf("#question") == 0) {
|
||||
var id = hash.substring(10);
|
||||
scoringSnapshot.jumpToQuestion(id);
|
||||
}
|
||||
});
|
||||
if(window.parent && window.parent.INST && window.parent.INST.getQuizSubmissionSnapshot && $.isFunction(window.parent.INST.getQuizSubmissionSnapshot)) {
|
||||
$("#feel_free_to_toggle_message").show();
|
||||
var data = window.parent.INST.getQuizSubmissionSnapshot(scoringSnapshot.snapshot.user_id, scoringSnapshot.snapshot.version_number);
|
||||
if(data) {
|
||||
scoringSnapshot.setSnapshot(data);
|
||||
} else {
|
||||
scoringSnapshot.setSnapshot(null, true);
|
||||
}
|
||||
}
|
||||
$(".question_holder .user_points :text,.question_holder .question_neutral_comment .question_comment_text textarea").change(function() {
|
||||
var $question = $(this).parents(".display_question");
|
||||
var question_id = parseInt($question.attr('id').substring(9), 10) || null;
|
||||
if(question_id) {
|
||||
var data = {};
|
||||
$question.addClass('modified_but_not_saved');
|
||||
data.points = parseFloat($question.find(".user_points :text").val(), 10);
|
||||
data.comments = $question.find(".question_neutral_comment .question_comment_text textarea").val() || "";
|
||||
scoringSnapshot.snapshot.question_updates[question_id] = data;
|
||||
scoringSnapshot.snapshot.last_question_touched = question_id;
|
||||
scoringSnapshot.setSnapshot();
|
||||
}
|
||||
$(document).triggerHandler('score_changed');
|
||||
});
|
||||
$("#fudge_points_entry").change(function() {
|
||||
var points = parseFloat($(this).val(), 10);
|
||||
if(points || points === 0) {
|
||||
scoringSnapshot.snapshot.fudge_points = points;
|
||||
scoringSnapshot.setSnapshot();
|
||||
}
|
||||
$(document).triggerHandler('score_changed');
|
||||
});
|
||||
$(document).bind('score_changed', function() {
|
||||
var $total = $("#after_fudge_points_total");
|
||||
var total = 0;
|
||||
$(".display_question .user_points:visible").each(function() {
|
||||
var points = parseFloat($(this).find(":text:first").val(), 10) || 0;
|
||||
points = Math.round(points * 100.0) / 100.0;
|
||||
total = total + points;
|
||||
});
|
||||
var fudge = (parseFloat($("#fudge_points_entry").val(), 10) || 0);
|
||||
fudge = Math.round(fudge * 100.0) / 100.0;
|
||||
total = total + fudge;
|
||||
$total.text(total || "0");
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% if params[:score_updated] %>
|
||||
<script>
|
||||
require([
|
||||
'jquery' /* $ */,
|
||||
'jquery.instructure_misc_plugins' /* fragmentChange */,
|
||||
'jquery.templateData' /* getTemplateData */,
|
||||
'vendor/jquery.scrollTo' /* /\.scrollTo/ */
|
||||
], function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
if(window.parent && window.parent.INST && window.parent.INST.refreshGrades && $.isFunction(window.parent.INST.refreshGrades)) {
|
||||
window.parent.INST.refreshGrades();
|
||||
}
|
||||
if(window.parent && window.parent.INST && window.parent.INST.clearQuizSubmissionSnapshot && $.isFunction(window.parent.INST.clearQuizSubmissionSnapshot)) {
|
||||
window.parent.INST.clearQuizSubmissionSnapshot(scoringSnapshot.snapshot);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% js_bundle :quiz_history %>
|
||||
|
|
|
@ -269,6 +269,7 @@ $(document).ready(function() {
|
|||
</script>
|
||||
<% end %>
|
||||
|
||||
<header class="quiz-header">
|
||||
<h2><%= @quiz && !@quiz.new_record? ? t('headers.edit_quiz', "Edit Quiz") : t('headers.create_new_quiz', "Create a New Quiz") %></h2>
|
||||
<div style="display: none;" id="quiz_urls">
|
||||
<a href="<%= context_url(@context, :context_quiz_url, @quiz.id) %>" class="update_quiz_url"> </a>
|
||||
|
@ -307,6 +308,7 @@ $(document).ready(function() {
|
|||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div id="questions" class="question_editing brief">
|
||||
<% @quiz.root_entries.each do |question| %>
|
||||
<% if question[:entry_type] == "quiz_group" %>
|
||||
|
|
|
@ -110,9 +110,13 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% js_bundle :quiz_show %>
|
||||
<% jammit_css :quizzes %>
|
||||
<a id="context_quzzes_url" style="display:none;" href="<%= context_url(@context, :context_quizzes_url) %>"> <!-- needed by quiz_show.js --></a>
|
||||
|
||||
<a id="context_quzzes_url" style="display:none;" href="<%= context_url(@context, :context_quizzes_url) %>"> <!-- This is needed by quiz_show.js --></a>
|
||||
|
||||
<header class="quiz-header">
|
||||
<h2 id="quiz_title"><%= @quiz.quiz_title || @quiz.readable_type %></h2>
|
||||
<% if @submission && params[:preview] %>
|
||||
<h3>
|
||||
|
@ -213,6 +217,7 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</header>
|
||||
<% if @submission && @submission.completed? %>
|
||||
<%= @quiz.assignment && @quiz.assignment.muted? ? render(:partial => "quizzes/muted") : render(:partial => "quizzes/quiz_submission") %>
|
||||
<% end %>
|
||||
|
|
|
@ -41,12 +41,14 @@
|
|||
<% end %>
|
||||
<% jammit_css :quizzes, :tinymce %>
|
||||
|
||||
<h2><%= @quiz.quiz_title || @quiz.readable_type %></h2>
|
||||
<% if @submission.preview? %>
|
||||
<h3><%= image_tag "warning.png" %> <%= t('headers.draft_preview', "This is a preview of the draft version of the quiz") %></h3>
|
||||
<% end %>
|
||||
<%= before_label(:started, "Started") %>
|
||||
<%= datetime_string(@submission.started_at) %>
|
||||
<header class="quiz-header">
|
||||
<h2><%= @quiz.quiz_title || @quiz.readable_type %></h2>
|
||||
<% if @submission.preview? %>
|
||||
<h3><%= image_tag "warning.png" %> <%= t('headers.draft_preview', "This is a preview of the draft version of the quiz") %></h3>
|
||||
<% end %>
|
||||
<%= before_label(:started, "Started") %>
|
||||
<%= datetime_string(@submission.started_at) %>
|
||||
</header>
|
||||
|
||||
<% js_bundle :take_quiz %>
|
||||
<div id="questions" class="assessing">
|
||||
|
@ -70,7 +72,7 @@
|
|||
</div>
|
||||
<%= render :partial => "display_question", :collection => @submission.questions_as_object, :locals => {:assessing => true } %>
|
||||
<div class="button-container">
|
||||
<button type="submit" class="button submit_button"><%= t('buttons.submit_answer', "Submit Answers") %></button>
|
||||
<button type="submit" class="button submit_button btn-primary"><%= t('buttons.submit_answer', "Submit Answers") %></button>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 544 B |
Binary file not shown.
Before Width: | Height: | Size: 436 B After Width: | Height: | Size: 204 B |
Binary file not shown.
Before Width: | Height: | Size: 363 B |
|
@ -43,14 +43,16 @@ define([
|
|||
|
||||
$message_students_dialog.find("ul li:not(.blank)").remove();
|
||||
|
||||
for(var idx in settings.students) {
|
||||
for (var i = 0; i < settings.students.length; i++) {
|
||||
var $student = $li.clone(true).removeClass('blank');
|
||||
$student.find(".name").text(settings.students[idx].name);
|
||||
$student.find(".score").text(settings.students[idx].score);
|
||||
$student.data('id', settings.students[idx].id);
|
||||
$student.user_data = settings.students[idx]
|
||||
|
||||
$student.find('.name').text(settings.students[i].name);
|
||||
$student.find('.score').text(settings.students[i].score);
|
||||
$student.data('id', settings.students[i].id);
|
||||
$student.user_data = settings.students[i];
|
||||
|
||||
$ul.append($student.show());
|
||||
students_hash[settings.students[idx].id] = $student;
|
||||
students_hash[settings.students[i].id] = $student;
|
||||
}
|
||||
|
||||
$ul.show();
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/**
|
||||
* Copyright (C) 2012 Instructure, Inc.
|
||||
*
|
||||
* This file is part of Canvas.
|
||||
*
|
||||
* Canvas is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, version 3 of the License.
|
||||
*
|
||||
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
define(['i18n!quizzes.show', 'jquery'], function(I18n, $) {
|
||||
// Create and append right/wrong arrows to all appropriate
|
||||
// answers on a quiz results page.
|
||||
return function() {
|
||||
var rightAnswers = $('.selected_answer.correct_answer'),
|
||||
wrongAnswers = $('.selected_answer.wrong_answer'),
|
||||
correctAnswers = $('.question:not(.short_answer_question, .numerical_question) .correct_answer:not(.selected_answer)'),
|
||||
shortAnswers = $('.short_answer_question .answers_wrapper, .numerical_question .answers_wrapper'),
|
||||
unansweredQ = $('.question.unanswered .header .question_name'),
|
||||
rightTpl = $('<span />', { 'class': 'answer_arrow correct' }),
|
||||
wrongTpl = $('<span />', { 'class': 'answer_arrow incorrect' }),
|
||||
correctTpl = $('<span />', { 'class': 'answer_arrow info' }),
|
||||
shortTpl = $('<span />', { 'class': 'answer_arrow info' }),
|
||||
unansweredTpl = $('<span />', { 'class': 'answer_arrow incorrect' }).css({ left: -108, top: 5 });
|
||||
|
||||
$.each([rightTpl, wrongTpl, correctTpl, shortTpl], function() {
|
||||
this.css({ left: -128, top: 0 });
|
||||
});
|
||||
|
||||
|
||||
rightTpl.text(I18n.t('answers.correct', 'Correct!'));
|
||||
wrongTpl.text(I18n.t('answers.incorrect', 'You Answered'));
|
||||
correctTpl.text(I18n.t('answers.right', 'Correct Answer'));
|
||||
shortTpl.text(I18n.t('answers.correct_answers', 'Correct Answers'));
|
||||
unansweredTpl.text(I18n.t('answers.unanswered', 'Unanswered'));
|
||||
|
||||
rightAnswers.append(rightTpl);
|
||||
wrongAnswers.append(wrongTpl);
|
||||
correctAnswers.append(correctTpl);
|
||||
shortAnswers.append(shortTpl);
|
||||
unansweredQ.append(unansweredTpl);
|
||||
|
||||
// adjust these downw a little so they align better w/ answers.
|
||||
$('.short_answer_question .answer_arrow').css('top', 5);
|
||||
};
|
||||
});
|
|
@ -0,0 +1,123 @@
|
|||
define([
|
||||
'jquery' /* $ */,
|
||||
'jquery.instructure_misc_plugins' /* fragmentChange */,
|
||||
'jquery.templateData' /* getTemplateData */,
|
||||
'vendor/jquery.scrollTo' /* /\.scrollTo/ */,
|
||||
'compiled/behaviors/quiz_selectmenu'
|
||||
], function($) {
|
||||
|
||||
var data = $("#submission_details").getTemplateData({textValues: ['version_number', 'user_id']});
|
||||
var scoringSnapshot = {
|
||||
snapshot: {
|
||||
user_id: parseInt(data.user_id, 10) || null,
|
||||
version_number: data.version_number,
|
||||
last_question_touched: null,
|
||||
question_updates: {},
|
||||
fudge_points: 0
|
||||
},
|
||||
getSnapshot: function() {
|
||||
return scoringSnapshot.snapshot;
|
||||
},
|
||||
jumpToQuestion: function(question_id) {
|
||||
var top = $("#question_" + question_id).offset().top - 10;
|
||||
$("html,body").scrollTo({top: top, left:0});
|
||||
},
|
||||
externallySet: false,
|
||||
setSnapshot: function(data, cancelIfAlreadyExternallySet) {
|
||||
if(data) {
|
||||
if(cancelIfAlreadyExternallySet && scoringSnapshot.externallySet) { return; }
|
||||
scoringSnapshot.externallySet = true;
|
||||
scoringSnapshot.snapshot = data;
|
||||
for(var idx in data.question_updates) {
|
||||
var question = data.question_updates[idx];
|
||||
var $question = $("#question_" + idx);
|
||||
$question.addClass('modified_but_not_saved');
|
||||
$question.find(".user_points :text").val(question.points).end()
|
||||
.find(".question_neutral_comment .question_comment_text textarea").val(question.comments);
|
||||
}
|
||||
if(window.parent && window.parent.INST && window.parent.INST.lastQuestionTouched) {
|
||||
scoringSnapshot.jumpToQuestion(window.parent.INST.lastQuestionTouched);
|
||||
} else if(scoringSnapshot.snapshot.last_question_touched) {
|
||||
scoringSnapshot.jumpToQuestion(scoringSnapshot.snapshot.last_question_touched);
|
||||
}
|
||||
} else if(cancelIfAlreadyExternallySet) {
|
||||
if(window.parent && window.parent.INST && window.parent.INST.lastQuestionTouched) {
|
||||
scoringSnapshot.jumpToQuestion(window.parent.INST.lastQuestionTouched);
|
||||
}
|
||||
}
|
||||
if(scoringSnapshot.externallySet || cancelIfAlreadyExternallySet) {
|
||||
$("#feel_free_to_toggle_message").show();
|
||||
}
|
||||
if(window.parent && window.parent.INST && window.parent.INST.refreshQuizSubmissionSnapshot && $.isFunction(window.parent.INST.refreshQuizSubmissionSnapshot)) {
|
||||
window.parent.INST.refreshQuizSubmissionSnapshot(scoringSnapshot.snapshot);
|
||||
}
|
||||
}
|
||||
}
|
||||
$(document).ready(function() {
|
||||
$(":text").focus(function() {
|
||||
$(this).select();
|
||||
});
|
||||
$(document).fragmentChange(function(event, hash) {
|
||||
if(hash.indexOf("#question") == 0) {
|
||||
var id = hash.substring(10);
|
||||
scoringSnapshot.jumpToQuestion(id);
|
||||
}
|
||||
});
|
||||
if(window.parent && window.parent.INST && window.parent.INST.getQuizSubmissionSnapshot && $.isFunction(window.parent.INST.getQuizSubmissionSnapshot)) {
|
||||
$("#feel_free_to_toggle_message").show();
|
||||
var data = window.parent.INST.getQuizSubmissionSnapshot(scoringSnapshot.snapshot.user_id, scoringSnapshot.snapshot.version_number);
|
||||
if(data) {
|
||||
scoringSnapshot.setSnapshot(data);
|
||||
} else {
|
||||
scoringSnapshot.setSnapshot(null, true);
|
||||
}
|
||||
}
|
||||
$(".question_holder .user_points :text,.question_holder .question_neutral_comment .question_comment_text textarea").change(function() {
|
||||
var $question = $(this).parents(".display_question");
|
||||
var question_id = parseInt($question.attr('id').substring(9), 10) || null;
|
||||
if(question_id) {
|
||||
var data = {};
|
||||
$question.addClass('modified_but_not_saved');
|
||||
data.points = parseFloat($question.find(".user_points :text").val(), 10);
|
||||
data.comments = $question.find(".question_neutral_comment .question_comment_text textarea").val() || "";
|
||||
scoringSnapshot.snapshot.question_updates[question_id] = data;
|
||||
scoringSnapshot.snapshot.last_question_touched = question_id;
|
||||
scoringSnapshot.setSnapshot();
|
||||
}
|
||||
$(document).triggerHandler('score_changed');
|
||||
});
|
||||
$("#fudge_points_entry").change(function() {
|
||||
var points = parseFloat($(this).val(), 10);
|
||||
if(points || points === 0) {
|
||||
scoringSnapshot.snapshot.fudge_points = points;
|
||||
scoringSnapshot.setSnapshot();
|
||||
}
|
||||
$(document).triggerHandler('score_changed');
|
||||
});
|
||||
$(document).bind('score_changed', function() {
|
||||
var $total = $("#after_fudge_points_total");
|
||||
var total = 0;
|
||||
$(".display_question .user_points:visible").each(function() {
|
||||
var points = parseFloat($(this).find(":text:first").val(), 10) || 0;
|
||||
points = Math.round(points * 100.0) / 100.0;
|
||||
total = total + points;
|
||||
});
|
||||
var fudge = (parseFloat($("#fudge_points_entry").val(), 10) || 0);
|
||||
fudge = Math.round(fudge * 100.0) / 100.0;
|
||||
total = total + fudge;
|
||||
$total.text(total || "0");
|
||||
});
|
||||
});
|
||||
|
||||
if (ENV.SCORE_UPDATED) {
|
||||
$(document).ready(function() {
|
||||
if(window.parent && window.parent.INST && window.parent.INST.refreshGrades && $.isFunction(window.parent.INST.refreshGrades)) {
|
||||
window.parent.INST.refreshGrades();
|
||||
}
|
||||
if(window.parent && window.parent.INST && window.parent.INST.clearQuizSubmissionSnapshot && $.isFunction(window.parent.INST.clearQuizSubmissionSnapshot)) {
|
||||
window.parent.INST.clearQuizSubmissionSnapshot(scoringSnapshot.snapshot);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* Copyright (C) 2011 Instructure, Inc.
|
||||
*
|
||||
* This file is part of Canvas.
|
||||
*
|
||||
* Canvas is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, version 3 of the License.
|
||||
*
|
||||
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
define(['jquery'], function($) {
|
||||
return function(inputs) {
|
||||
var body = $('body'),
|
||||
inputCover = $('<div />', { 'class': 'input_cover' });
|
||||
|
||||
inputCover.on('mouseleave', function(e) { $(this).remove(); });
|
||||
|
||||
$(inputs).on('mouseenter', function(e) {
|
||||
var el = $(this),
|
||||
cover = inputCover.clone(true);
|
||||
|
||||
cover.css({
|
||||
height : el.height() + 10,
|
||||
width : el.width() + 10,
|
||||
position : 'absolute',
|
||||
left : el.offset().left - 5,
|
||||
top : el.offset().top - 5,
|
||||
zIndex : 15
|
||||
});
|
||||
|
||||
body.append(cover);
|
||||
});
|
||||
};
|
||||
});
|
|
@ -19,29 +19,29 @@
|
|||
define([
|
||||
'i18n!quizzes.show',
|
||||
'jquery' /* $ */,
|
||||
'quiz_arrows',
|
||||
'quiz_inputs',
|
||||
'jquery.instructure_date_and_time' /* dateString, time_field, datetime_field */,
|
||||
'jqueryui/dialog',
|
||||
'jquery.instructure_misc_helpers' /* scrollSidebar */,
|
||||
'jquery.instructure_misc_plugins' /* ifExists, confirmDelete */,
|
||||
'message_students' /* messageStudents */
|
||||
], function(I18n, $) {
|
||||
], function(I18n, $, showAnswerArrows, disableInputs) {
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
function loadStudents() {
|
||||
var students_hash = {};
|
||||
$(".student_list .student").each(function(i) {
|
||||
var student = {};
|
||||
student.id = $(this).attr('data-id');
|
||||
student.name = $.trim($(this).find(".name").text());
|
||||
student.submitted = $(this).closest(".student_list").hasClass('submitted');
|
||||
students_hash[student.id] = student;
|
||||
return $('.student_list .student').not('.blank').map(function() {
|
||||
return {
|
||||
id : $(this).attr('data-id'),
|
||||
name : $.trim($(this).find(".name").text()),
|
||||
submitted: $(this).closest(".student_list").hasClass('submitted')
|
||||
};
|
||||
});
|
||||
var students = [];
|
||||
for(var idx in students_hash) {
|
||||
students.push(students_hash[idx]);
|
||||
}
|
||||
return students;
|
||||
}
|
||||
|
||||
showAnswerArrows();
|
||||
disableInputs('[type=radio], [type=checkbox]');
|
||||
|
||||
$(".delete_quiz_link").click(function(event) {
|
||||
event.preventDefault();
|
||||
|
|
|
@ -58,7 +58,7 @@ define([
|
|||
started_at: started_at,
|
||||
end_at: end_at,
|
||||
time_limit: parseInt($(".time_limit").text(), 10) || null,
|
||||
updateSubmission: function(repeat) {
|
||||
updateSubmission: function(repeat, beforeLeave) {
|
||||
if(quizSubmission.submitting && !repeat) { return; }
|
||||
var now = new Date();
|
||||
if((now - quizSubmission.lastSubmissionUpdate) < 1000) { return }
|
||||
|
@ -71,44 +71,63 @@ define([
|
|||
});
|
||||
|
||||
$last_saved.text(I18n.t('saving', 'Saving...'));
|
||||
$.ajaxJSON($(".backup_quiz_submission_url").attr('href'), 'PUT', data, function(data) {
|
||||
$last_saved.text(I18n.t('saved_at', 'Saved at %{t}', { t: $.friendlyDatetime(new Date()) }));
|
||||
quizSubmission.currentlyBackingUp = false;
|
||||
if(repeat) {
|
||||
setTimeout(function() {quizSubmission.updateSubmission(true) }, 30000);
|
||||
}
|
||||
if(data && data.end_at) {
|
||||
var endAtFromServer = Date.parse(data.end_at),
|
||||
submissionEndAt = Date.parse(quizSubmission.end_at.text()),
|
||||
serverEndAtTime = endAtFromServer.getTime(),
|
||||
submissionEndAtTime = submissionEndAt.getTime();
|
||||
var url = $(".backup_quiz_submission_url").attr('href');
|
||||
// If called before leaving the page (ie. onbeforeunload), we can't use any async or FF will kill the PUT request.
|
||||
if (beforeLeave){
|
||||
$.flashMessage(I18n.t('saving', 'Saving...'));
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: data,
|
||||
type: 'PUT',
|
||||
dataType: 'json',
|
||||
async: false // NOTE: Not asynchronous. Otherwise Firefox will cancel the request as navigating away from the page.
|
||||
// NOTE: No callbacks. Don't care about response. Just making effort to save the quiz
|
||||
});
|
||||
}
|
||||
else {
|
||||
$.ajaxJSON(url, 'PUT', data,
|
||||
// Success callback
|
||||
function(data) {
|
||||
$last_saved.text(I18n.t('saved_at', 'Saved at %{t}', { t: $.friendlyDatetime(new Date()) }));
|
||||
quizSubmission.currentlyBackingUp = false;
|
||||
if(repeat) {
|
||||
setTimeout(function() {quizSubmission.updateSubmission(true) }, 30000);
|
||||
}
|
||||
if(data && data.end_at) {
|
||||
var endAtFromServer = Date.parse(data.end_at),
|
||||
submissionEndAt = Date.parse(quizSubmission.end_at.text()),
|
||||
serverEndAtTime = endAtFromServer.getTime(),
|
||||
submissionEndAtTime = submissionEndAt.getTime();
|
||||
|
||||
quizSubmission.referenceDate = null;
|
||||
quizSubmission.referenceDate = null;
|
||||
|
||||
// if the new end_at from the server is different than our current end_at, then notify
|
||||
// the user that their time limit's changed and let updateTime do the rest.
|
||||
if (serverEndAtTime !== submissionEndAtTime) {
|
||||
serverEndAtTime > submissionEndAtTime ?
|
||||
$.flashMessage(I18n.t('notices.extra_time', 'You have been given extra time on this attempt')) :
|
||||
$.flashMessage(I18n.t('notices.less_time', 'Your time for this quiz has been reduced.'));
|
||||
// if the new end_at from the server is different than our current end_at, then notify
|
||||
// the user that their time limit's changed and let updateTime do the rest.
|
||||
if (serverEndAtTime !== submissionEndAtTime) {
|
||||
serverEndAtTime > submissionEndAtTime ?
|
||||
$.flashMessage(I18n.t('notices.extra_time', 'You have been given extra time on this attempt')) :
|
||||
$.flashMessage(I18n.t('notices.less_time', 'Your time for this quiz has been reduced.'));
|
||||
|
||||
quizSubmission.end_at.text(data.end_at);
|
||||
endAtText = data.end_at;
|
||||
endAtParsed = new Date(data.end_at);
|
||||
quizSubmission.end_at.text(data.end_at);
|
||||
endAtText = data.end_at;
|
||||
endAtParsed = new Date(data.end_at);
|
||||
}
|
||||
}
|
||||
},
|
||||
// Error callback
|
||||
function() {
|
||||
var current_user_id = $("#identity .user_id").text() || "none";
|
||||
quizSubmission.currentlyBackingUp = false;
|
||||
$.ajaxJSON(location.protocol + '//' + location.host + "/simple_response.json?user_id=" + current_user_id + "&rnd=" + Math.round(Math.random() * 9999999), 'GET', {}, function() {
|
||||
}, function() {
|
||||
ajaxErrorFlash(I18n.t('errors.connection_lost', "Connection to %{host} was lost. Please make sure you're connected to the Internet before continuing.", {'host': location.host}), request);
|
||||
}, {skipDefaultError: true});
|
||||
|
||||
if(repeat) {
|
||||
setTimeout(function() {quizSubmission.updateSubmission(true) }, 30000);
|
||||
}
|
||||
}
|
||||
}, function() {
|
||||
var current_user_id = $("#identity .user_id").text() || "none";
|
||||
quizSubmission.currentlyBackingUp = false;
|
||||
$.ajaxJSON(location.protocol + '//' + location.host + "/simple_response.json?user_id=" + current_user_id + "&rnd=" + Math.round(Math.random() * 9999999), 'GET', {}, function() {
|
||||
}, function() {
|
||||
ajaxErrorFlash(I18n.t('errors.connection_lost', "Connection to %{host} was lost. Please make sure you're connected to the Internet before continuing.", {'host': location.host}), request);
|
||||
}, {skipDefaultError: true});
|
||||
|
||||
if(repeat) {
|
||||
setTimeout(function() {quizSubmission.updateSubmission(true) }, 30000);
|
||||
}
|
||||
}, {timeout: 5000 });
|
||||
}, {timeout: 5000 });
|
||||
}
|
||||
},
|
||||
|
||||
updateTime: function() {
|
||||
|
@ -209,7 +228,7 @@ define([
|
|||
|
||||
if($("#preview_mode_link").length == 0) {
|
||||
window.onbeforeunload = function() {
|
||||
quizSubmission.updateSubmission();
|
||||
quizSubmission.updateSubmission(false, true);
|
||||
if(!quizSubmission.submitting && !quizSubmission.alreadyAcceptedNavigatingAway) {
|
||||
return I18n.t('confirms.unfinished_quiz', "You're about to leave the quiz unfinished. Continue anyway?");
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ describe "concluded/unconcluded courses" do
|
|||
|
||||
html = Nokogiri::HTML(response.body)
|
||||
html.css('#fudge_points_entry').length.should == 1
|
||||
html.css('.question_neutral_comment textarea').length.should == 1
|
||||
html.css('.quiz_comment textarea').length.should == 1
|
||||
html.css('.user_points .question_input').length.should == 1
|
||||
end
|
||||
|
||||
|
@ -107,7 +107,7 @@ describe "concluded/unconcluded courses" do
|
|||
|
||||
html = Nokogiri::HTML(response.body)
|
||||
html.css('#fudge_points_entry').length.should == 0
|
||||
html.css('.question_neutral_comment textarea').length.should == 0
|
||||
html.css('.quiz_comment textarea').length.should == 0
|
||||
html.css('.user_points .question_input').length.should == 0
|
||||
end
|
||||
|
||||
|
|
|
@ -70,9 +70,9 @@ describe "quizzes questions" do
|
|||
|
||||
load_simulate_js
|
||||
|
||||
# drag the first question down 100px (next slot)
|
||||
# drag the second question up 100px (next slot)
|
||||
driver.execute_script <<-JS
|
||||
$('.move_icon:eq(0)').show().simulate('drag', {dx: 0, dy: 100});
|
||||
$('.move_icon:eq(1)').show().simulate('drag', {dx: 0, dy: -100});
|
||||
JS
|
||||
|
||||
# verify they were swapped
|
||||
|
|
|
@ -249,7 +249,7 @@ describe "quizzes" do
|
|||
}
|
||||
|
||||
#flag first question
|
||||
hover_and_click("#question_#{@quest1.id} .flag_icon")
|
||||
hover_and_click("#question_#{@quest1.id} .flag_question")
|
||||
|
||||
#click second answer
|
||||
driver.find_element(:css, "#question_#{@quest2.id} .answers .answer:first-child input").click
|
||||
|
|
|
@ -65,7 +65,7 @@ describe "speed grader" do
|
|||
get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
|
||||
wait_for_ajaximations
|
||||
in_frame('speedgrader_iframe') do
|
||||
question_inputs = ff('.question_input')
|
||||
question_inputs = ff('.header .question_input')
|
||||
question_inputs.each { |qi| replace_content(qi, 3) }
|
||||
submit_form('#update_history_form')
|
||||
end
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2011 Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../views_helper')
|
||||
|
||||
describe "/quizzes/_submission_score" do
|
||||
it "should render" do
|
||||
course_with_student
|
||||
view_context
|
||||
assigns[:quiz] = @course.quizzes.create!
|
||||
@submission = assigns[:quiz].generate_submission(@user)
|
||||
@submission.grade_submission
|
||||
render :partial => "quizzes/submission_score", :object => @submission
|
||||
response.should_not be_nil
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue