Skip to content

Commit

Permalink
Tutorial: Send grade events.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjdivad authored and cyril-sf committed Dec 13, 2013
1 parent cf3ff16 commit 7f45f5d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions example/cards/tutorial/survey_card.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ var gradingTemplate = '<div><form>{{#each grades}}<input type="radio" name="surv
var gradeResultTemplate = '<div>Your rating: {{grade}} <button id="changeGrade">Change</button></div>';

Conductor.card({
consumers: { survey: Conductor.Oasis.Consumer },

grade: null,
grades: ["A", "B", "C", "D", "F"],
renderMode: 'survey',
Expand Down Expand Up @@ -55,6 +57,13 @@ Conductor.card({
var grade = $('input:radio[name=survey]:checked').val();
if (grade) {
$(this).off('click');
if (card.consumers.survey) {
if (!card.grade) {
card.consumers.survey.send('surveyTaken', grade);
} else {
card.consumers.survey.send('gradeChanged', grade);
}
}
card.grade = grade;
card.renderReport();
}
Expand Down

0 comments on commit 7f45f5d

Please sign in to comment.