Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
Send a new event from interface.js whenever a helpful message is show…
Browse files Browse the repository at this point in the history
…n after user attempts a problem (e.g. 'It looks like you haven't answered the entire problem yet').

Summary: Event will be used by mobile.

Test Plan:
Drop into mobile repo w/ my prototype that listens for this event
Verify that event is fired and sends appropriate message along.

Reviewers: jack

Reviewed By: jack

Differential Revision: http://phabricator.khanacademy.org/D10466
  • Loading branch information
kamens committed Jun 25, 2014
1 parent 8736d78 commit b626f73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 9 additions & 3 deletions interface.js
Expand Up @@ -219,12 +219,18 @@ function handleAttempt(data) {
}

var isAnswerEmpty = score.empty && !skipped;
var attemptMessage = null;

// Is this a message to be shown?
// Is there a message to be shown?
if (score.message != null) {
$("#check-answer-results > p").html(score.message).show().tex();
attemptMessage = score.message;
} else if (isAnswerEmpty) {
$("#check-answer-results > p").html(EMPTY_MESSAGE).show().tex();
attemptMessage = EMPTY_MESSAGE;
}

if (attemptMessage) {
$("#check-answer-results > p").html(attemptMessage).show().tex();
$(Exercises).trigger("attemptMessageShown", attemptMessage);
} else {
$("#check-answer-results > p").hide();
}
Expand Down
3 changes: 3 additions & 0 deletions khan-exercise.js
Expand Up @@ -53,6 +53,9 @@
* showGuess -- when a guess is populated in the answer area in problem
history mode
* attemptMessageShown -- when a user attempts a problem and a message is
shown in response, e.g. "We don't understand your answer."
*/
define(function(require) {

Expand Down

0 comments on commit b626f73

Please sign in to comment.