Skip to content

Commit

Permalink
Merge branch 'rails4' of https://github.com/expertiza/expertiza into …
Browse files Browse the repository at this point in the history
…rails4

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
  • Loading branch information
yangsong8 committed Aug 14, 2015
2 parents 462089e + 35da562 commit 3336675
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
11 changes: 6 additions & 5 deletions app/models/criterion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ def complete(count, answer=nil, questionnaire_min, questionnaire_max, dropdown_o
html += 'checked="checked"' if !answer.nil? && answer.answer == j
html += '></td>'
end
html += '<script>jQuery("input[name=Radio_' +self.id.to_s+ ']:radio").change(function() {'
html += 'var response_score = jQuery("#responses_' +count.to_s+ '_score");'
html += 'var checked_value = jQuery("input[name=Radio_' +self.id.to_s+ ']:checked").val();'
html += 'response_score.val(checked_value);});</script>'

if !self.max_label.nil?
html += '<td width="10%">' +self.max_label+ '</td>'
else
Expand All @@ -98,11 +103,7 @@ def complete(count, answer=nil, questionnaire_min, questionnaire_max, dropdown_o
html += '<textarea cols=' +cols+ ' rows=' +rows+ ' id="responses_' +count.to_s+ '_comments" name="responses[' +count.to_s+ '][comment]" style="overflow:hidden;">'
html += answer.comments if !answer.nil?
html += '</textarea><br/>'
html += '<script>$("input[name=Radio_' +self.id.to_s+ ']:radio").change(function() {'
html += 'var response_score = jQuery("#responses_' +count.to_s+ '_score");'
html += 'for (i = <%=questionnaire_min%>; i <= <%=questionnaire_max%>; i++) { '
html += 'if (jQuery("#"+i.toString()).attr("checked")) {'
html += 'response_score.val(jQuery("#"+i.toString()).val());}}}</script>'

end
html.html_safe
end
Expand Down
9 changes: 7 additions & 2 deletions app/views/assignments/edit/_rubrics.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@
html += '<td align="center"><input type="checkbox" name="dropdown" id="dropdown" value="true"></td>';
//Scored question display type (Dropdown or Scale)
html += '<td align="center"><select id="scored_question_display_type", name="assignment_form[assignment_questionnaire][][dropdown]">';
html += '<option value=true <%= selected="selected" if ' +assignment_questionnaire.dropdown+ '== true%>>Dropdown</option>';
html += '<option value=false <%= selected="selected" if ' +assignment_questionnaire.dropdown+ '== false%>>Scale</option>';
if (assignment_questionnaire.dropdown == true) {
html += '<option value=true selected="selected">Dropdown</option>';
html += '<option value=false>Scale</option>';
} else {
html += '<option value=true>Dropdown</option>';
html += '<option value=false selected="selected">Scale</option>';
}
html += '</select></td>';
//Weight
html += '<td align="center"><input name="assignment_form[assignment_questionnaire][][questionnaire_weight]" style="width:40px" type="text" value="' + assignment_questionnaire.questionnaire_weight + '">% </td>' +
Expand Down

0 comments on commit 3336675

Please sign in to comment.