Skip to content

Commit

Permalink
LSNBLDR-841 - Lessons - "Add Question" - Poll results truncated in Sh…
Browse files Browse the repository at this point in the history
…ow Poll (sakaiproject#4734)
  • Loading branch information
jonespm authored and ern committed Aug 29, 2017
1 parent e446f5e commit d8aa22e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3046,7 +3046,7 @@ public int compare(SimpleStudentPage o1, SimpleStudentPage o2) {
UISelectChoice multipleChoiceInput = UISelectChoice.make(answerContainer, "multipleChoiceAnswerRadio", multipleChoiceSelect.getFullID(), j);

multipleChoiceInput.decorate(new UIFreeAttributeDecorator("id", multipleChoiceInput.getFullID()));
UIOutput.make(answerContainer, "multipleChoiceAnswerText", answers.get(j).getText())
UIOutput.make(answerContainer, "multipleChoiceAnswerText", Integer.toString(j+1) + " : " + answers.get(j).getText())
.decorate(new UIFreeAttributeDecorator("for", multipleChoiceInput.getFullID()));

if(!isAvailable || response != null) {
Expand Down Expand Up @@ -3124,7 +3124,8 @@ else if(questionStatus == Status.FAILED)

for(int j = 0; j < answers.size(); j++) {
UIBranchContainer pollContainer = UIBranchContainer.make(tableRow, "questionPollData:", String.valueOf(j));
UIOutput.make(pollContainer, "questionPollText", answers.get(j).getText());
UIOutput.make(pollContainer, "questionPollText", Integer.toString(j+1));
UIOutput.make(pollContainer, "questionPollLegend", Integer.toString(j+1) + ":" + answers.get(j).getText());
UIOutput.make(pollContainer, "questionPollNumber", String.valueOf(responseCounts.get(answers.get(j).getId())));
}
}
Expand Down
14 changes: 10 additions & 4 deletions lessonbuilder/tool/src/webapp/js/jqBarGraph.1.1.customized.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
// Customized to fix a small bug in a for..in loop over an array, where it would also loop over other structures
// in the array, such as "contains"

// Customized to add legends to data array and legendsAtTitle to display legends as title in the div

(function($) {
var opts = new Array;
var level = new Array;
Expand Down Expand Up @@ -126,8 +128,12 @@

lbl = data[val][1];
color = data[val][2];
unique = val+el.id; //unique identifier

legendLbl = data[val][3];
unique = val+el.id; //unique identifier

if (legendLbl == undefined && arr.legends !== undefined) {
legendLbl = legends[val];
}
if (color == undefined && arr.colors == false)
color = arr.color;

Expand All @@ -149,7 +155,7 @@

// if there is no legend or exist legends display lbl at the bottom
if(!arr.legend || arr.legends)
out += "<div class='graphLabel"+el.id+"' id='graphLabel"+unique+"' style='white-space:nowrap;overflow:hidden;text-overflow:clip'>"+lbl+"</div>";
out += "<div class='graphLabel"+el.id+"' id='graphLabel"+unique+"' style='white-space:nowrap;overflow:hidden;text-overflow:clip' title='"+legendLbl+"'>"+lbl+"</div>";
out += "</div>";

$(el).append(out);
Expand Down Expand Up @@ -195,7 +201,7 @@

//creating legend array from lbl if there is no legends param
if(!arr.legends)
leg.push([ color, lbl, el.id, unique ]);
leg.push([ color, legendLbl, el.id, unique ]);

// animated apearing
if(arr.animate){
Expand Down
3 changes: 2 additions & 1 deletion lessonbuilder/tool/src/webapp/js/show-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -2344,8 +2344,9 @@ $(document).ready(function() {
pollGraph.parent().find(".questionPollData").each(function(index) {
var text = $(this).find(".questionPollText").text();
var count = $(this).find(".questionPollNumber").text();
var legend = $(this).find(".questionPollLegend").text();

pollData[index] = [parseInt(count), text];
pollData[index] = [parseInt(count), text, '#000000', legend];
});

pollGraph.show();
Expand Down
1 change: 1 addition & 0 deletions lessonbuilder/tool/src/webapp/templates/ShowPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,7 @@ <h3 class="questionText" rsf:id="questionText"></h3>

<div style="display:none" rsf:id="questionPollData:" class="questionPollData">
<span rsf:id="questionPollText" class="questionPollText"></span>
<span rsf:id="questionPollLegend" class="questionPollLegend"></span>
<span rsf:id="questionPollNumber" class="questionPollNumber"></span>
</div>
<div rsf:id="questionPollGraph" class="questionPollGraph"></div>
Expand Down

0 comments on commit d8aa22e

Please sign in to comment.