Reputation: 1706
Okay so I'm new to meteor and have a somewhat complex data structure setup. Assuming I'm forced to keep the structure what do my templates need to look like in order to display this? Am I doing something wrong? I can't seem to get my current code to work. Any help or advice is greatly appreciated! -Thanks
Here's my data structure:
Tournament: {
round1:{
match1:[
{ToqeLokbLAs9mALd3: {win: true, gamertag: 'gbachik'}},
{scH8Zb3XMa5ALZNsL: {win: false, gamertag: 'test'}}
],
match2:[
{c4LQoXGEo6dA8ZtNT: {win: false, gamertag: 'test2'}},
{TDrZa3QY3AinxXw5D: {win: true, gamertag: 'test3'}}
]
},
round2:{
match3: [
{ToqeLokbLAs9mALd3: {win: true, gamertag: 'gbachik'}},
{TDrZa3QY3AinxXw5D: {win: false, gamertag: 'test3'}}
]
},
consolation:{
match1: [
{scH8Zb3XMa5ALZNsL: {win: null, gamertag: 'test'}},
{c4LQoXGEo6dA8ZtNT: {win: null, gamertag: 'test2'}}
]
}
}
My Helper:
Template.index.helpers({
round: function(){
return Tournaments.findOne({});
}
});
my Route:
Router.route('/', function() {
this.subscribe('tournaments').wait();
this.render('index');
});
my static view(jade):
.tournament
ul.round1.of3
li
.participant.winner
a(href='#')
span.participant-title= this
span.participant-number 2
.participant
a(href='#')
span.participant-title asdasd loser
span.participant-number 3
Upvotes: 0
Views: 1189
Reputation: 11
Look into the {{#each}} {{/each}}
spacebars. It should get you at least outputting a list. http://meteorcapture.com/spacebars/.
Just a suggestion for how to format your object, make it much more general. Rather than naming it round1
and round2
make a general object that is round
and then have a name
or number
parameter inside the object. If you care about order, consider using a list as the container.
Upvotes: 0