Created
May 29, 2013 19:10
-
-
Save BenjaminRH/5672925 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Template.movie.events({ | |
'click .seen': function (e, t) { | |
// User has set status to "seen", but not exited poster | |
Session.set('seen-movie', true); | |
}, | |
'click .not-seen': function (e, t) { | |
// User has set status to "not seen", but not exited poster | |
Session.set('seen-movie', false); | |
} | |
'mouseout .poster': function (e, t) { | |
// They've moused out of the poster | |
if (! Session.equals('seen-movie', null)) { | |
// They've selected a status | |
Movies.update({ _id: movieIdHere }, {$set: { seen: Session.get('seen-movie') } }); | |
Session.set('seen-movie', null); // Reset this | |
} | |
} | |
}); | |
Template.movie.seen = function () { return Session.get('seen-movie'); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="movie"> | |
{{#if seen}} | |
<p class="status">Yeah, you've seen it</p> | |
{{else}} | |
<p class="status">Nope, got to see this</p> | |
{{/if}} | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment