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
// Just create a new Meteor app, add the packages below, delete the css, html, and js files and copy this file in. | |
// Packages to add: | |
// meteor add react | |
// meteor add velocityjs:velocityjs | |
// Click on the text and see it fly! | |
ReactTransitionGroup = React.addons.TransitionGroup; | |
Title = React.createClass({ | |
componentWillEnter(done){ | |
console.log('Will Enter'); |
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
// collections/assignments.js | |
Deps.autorun(function(){ | |
Assignments.grouped = {}; | |
var raw_list = Assignments.find().fetch(); | |
for (var i = raw_list.length - 1; i >= 0; i--) { | |
if (Assignments.grouped[raw_list[i].date] == undefined) {Assignments.grouped[raw_list[i].date]={}}; | |
if (Assignments.grouped[raw_list[i].date][raw_list[i].meetingId] == undefined) {Assignments.grouped[raw_list[i].date][raw_list[i].meetingId]=[]}; | |
Assignments.grouped[raw_list[i].date][raw_list[i].meetingId].push(raw_list[i]); | |
}; | |
}); |
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
// collections/assignments.js | |
Assignments.group_assignments = function(){ | |
console.log('Grouping Assignments'); | |
var grouped = {}; | |
var raw_list = Assignments.find().fetch(); | |
for (var i = raw_list.length - 1; i >= 0; i--) { | |
if (grouped[raw_list[i].date] == undefined) {grouped[raw_list[i].date]={}}; | |
if (grouped[raw_list[i].date][raw_list[i].meetingId] == undefined) {grouped[raw_list[i].date][raw_list[i].meetingId]=[]}; | |
grouped[raw_list[i].date][raw_list[i].meetingId].push(raw_list[i]); | |
}; |
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
{{#each meetings}} | |
{{#ifchanged date}} | |
</ul> | |
<div class="date">{{date}}</div> | |
<ul class="list-group"> | |
{{/ifchanged}} | |
<li>{{title}}</li> | |
{{/each}} | |
Given this:[{title:"Foo",date:"Today"}, {title:"Bar",date:"Today"}, {title:"Foo",date:"Tomorrow"}, {title:"Bar",date:"Tomorrow"}] |