Skip to content

Commit d8aa22e

Browse files
jonespmern
authored andcommitted
LSNBLDR-841 - Lessons - "Add Question" - Poll results truncated in Show Poll (sakaiproject#4734)
1 parent e446f5e commit d8aa22e

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ShowPageProducer.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -3046,7 +3046,7 @@ public int compare(SimpleStudentPage o1, SimpleStudentPage o2) {
30463046
UISelectChoice multipleChoiceInput = UISelectChoice.make(answerContainer, "multipleChoiceAnswerRadio", multipleChoiceSelect.getFullID(), j);
30473047

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

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

31253125
for(int j = 0; j < answers.size(); j++) {
31263126
UIBranchContainer pollContainer = UIBranchContainer.make(tableRow, "questionPollData:", String.valueOf(j));
3127-
UIOutput.make(pollContainer, "questionPollText", answers.get(j).getText());
3127+
UIOutput.make(pollContainer, "questionPollText", Integer.toString(j+1));
3128+
UIOutput.make(pollContainer, "questionPollLegend", Integer.toString(j+1) + ":" + answers.get(j).getText());
31283129
UIOutput.make(pollContainer, "questionPollNumber", String.valueOf(responseCounts.get(answers.get(j).getId())));
31293130
}
31303131
}

lessonbuilder/tool/src/webapp/js/jqBarGraph.1.1.customized.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
// Customized to fix a small bug in a for..in loop over an array, where it would also loop over other structures
3737
// in the array, such as "contains"
3838

39+
// Customized to add legends to data array and legendsAtTitle to display legends as title in the div
40+
3941
(function($) {
4042
var opts = new Array;
4143
var level = new Array;
@@ -126,8 +128,12 @@
126128

127129
lbl = data[val][1];
128130
color = data[val][2];
129-
unique = val+el.id; //unique identifier
130-
131+
legendLbl = data[val][3];
132+
unique = val+el.id; //unique identifier
133+
134+
if (legendLbl == undefined && arr.legends !== undefined) {
135+
legendLbl = legends[val];
136+
}
131137
if (color == undefined && arr.colors == false)
132138
color = arr.color;
133139

@@ -149,7 +155,7 @@
149155

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

155161
$(el).append(out);
@@ -195,7 +201,7 @@
195201

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

200206
// animated apearing
201207
if(arr.animate){

lessonbuilder/tool/src/webapp/js/show-page.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2344,8 +2344,9 @@ $(document).ready(function() {
23442344
pollGraph.parent().find(".questionPollData").each(function(index) {
23452345
var text = $(this).find(".questionPollText").text();
23462346
var count = $(this).find(".questionPollNumber").text();
2347+
var legend = $(this).find(".questionPollLegend").text();
23472348

2348-
pollData[index] = [parseInt(count), text];
2349+
pollData[index] = [parseInt(count), text, '#000000', legend];
23492350
});
23502351

23512352
pollGraph.show();

lessonbuilder/tool/src/webapp/templates/ShowPage.html

+1
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,7 @@ <h3 class="questionText" rsf:id="questionText"></h3>
891891

892892
<div style="display:none" rsf:id="questionPollData:" class="questionPollData">
893893
<span rsf:id="questionPollText" class="questionPollText"></span>
894+
<span rsf:id="questionPollLegend" class="questionPollLegend"></span>
894895
<span rsf:id="questionPollNumber" class="questionPollNumber"></span>
895896
</div>
896897
<div rsf:id="questionPollGraph" class="questionPollGraph"></div>

0 commit comments

Comments
 (0)