Skip to content

Commit d32bfbb

Browse files
committed
beefed up survey
1 parent 5c39063 commit d32bfbb

1 file changed

Lines changed: 29 additions & 3 deletions

File tree

v3/js/composingprograms.js

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ var originFrontendJsFile = 'composingprograms.js';
4343

4444

4545
var postSessionSurvey = '\n\
46-
<div id="postSessionSurveyDiv" style="border: 1px solid #C2382F; padding: 5px; margin-top: 5px; line-height: 175%;">\n\
47-
<span style="font-size: 8pt; color: #666;">Support our research by answering these questions before you leave:</span><br/>\n\
46+
<div id="postSessionSurveyDiv" style="border: 1px solid #BE554E; padding: 5px; margin-top: 5px; line-height: 175%;">\n\
47+
<span style="font-size: 8pt; color: #666;">Support our research by giving anonymous feedback.</span><br/>\n\
4848
How useful was this particular session? (click star to rate)\n\
4949
<span class="star-rating togetherjsIgnore">\n\
5050
<input type="radio" class="togetherjsIgnore" name="rating" value="1"/><i></i>\n\
@@ -54,15 +54,41 @@ How useful was this particular session? (click star to rate)\n\
5454
<input type="radio" class="togetherjsIgnore" name="rating" value="5"/><i></i>\n\
5555
</span>\n\
5656
<br/>\
57-
What did you just learn? <input type="text" id="what-learned" class="surveyQ togetherjsIgnore" size=60 maxlength=140/>\n\
57+
What did you just learn? <input type="text" id="sharedSessionWhatLearned" class="surveyQ togetherjsIgnore" size=60 maxlength=140/>\n\
5858
<button id="submitSessionSurveyBtn" type="button" style="font-size: 8pt;">Submit</button>\n\
59+
<span id="sharedSessionWhatLearnedThanks" style="color: #e93f34; font-weight: bold; font-size: 10pt; display: none;">Thanks!</span>\n\
5960
</div>'
6061

6162

6263
function TogetherjsReadyHandler() {
6364
populateTogetherJsShareUrl();
65+
6466
$("#togetherjsStatus").append(postSessionSurvey);
6567

68+
$('.star-rating :radio').change(function() {
69+
if (TogetherJS.running) {
70+
TogetherJS.send({type: "surveyHowUsefulStars",
71+
stars: Number(this.value)});
72+
}
73+
});
74+
75+
$('#submitSessionSurveyBtn').click(function() {
76+
var resp = $('#sharedSessionWhatLearned').val();
77+
if (TogetherJS.running && resp) {
78+
TogetherJS.send({type: "surveyFreetextQuestion",
79+
question: "What did you just learn?",
80+
answer: $('#sharedSessionWhatLearned').val()});
81+
82+
$("#sharedSessionWhatLearned").val('');
83+
$("#sharedSessionWhatLearnedThanks").show();
84+
$.doTimeout('sharedSessionWhatLearnedThanksFadeOut', 1000, function() {
85+
$("#sharedSessionWhatLearnedThanks").fadeOut(2000);
86+
});
87+
88+
89+
}
90+
});
91+
6692
updateChatName();
6793
}
6894

0 commit comments

Comments
 (0)