Added Basic character list view

This commit is contained in:
Thaum
2015-02-27 10:50:28 +00:00
parent 040d5a514b
commit b40094017f
10 changed files with 56 additions and 47 deletions

View File

@@ -1,9 +1,20 @@
<template name="home">
{{>loginButtons}}
<div>
{{# each characters}}
<li><a href="{{ pathFor 'characterSheet' }} ">{{_id}}</a> <button id="deleteChar">delete</button></li>
{{/each}}
<div class="scroll-y" fit>
<div flex horizontal wrap class="padded">
{{# each characters}}
{{#with characterDetails}}
{{#containerCardHelper this}}{{alignment}} {{gender}} {{race}}{{/containerCardHelper}}
{{/with}}
{{/each}}
<div class="fab-buffer"></div>
</div>
<paper-fab id="addCharacter"
class="floatyButton"
icon="add"
title="Add"
role="button"
tabindex="0"
aria-label="Add"
hero-id="main"></paper-fab>
</div>
<input id="addCharacter" type="button" value="Add Character">
</template>

View File

@@ -1,8 +1,23 @@
Template.home.helpers({
characterDetails: function(){
var char = Characters.findOne(this._id, {fields: {name: 1, gender: 1, alignment: 1, race:1}})
char.title = char.name;
char.field = "base"
char.color = "d";
char.class = "characterCard"
return char;
}
});
Template.home.events({
"click #addCharacter": function (event, template) {
Characters.insert({});
"tap .characterCard": function(event, instance){
console.log(this);
Router.go("characterSheet", {_id: this._id});
},
"click #deleteChar": function(event, template){
"tap #addCharacter": function (event, template) {
Characters.insert({owner: Meteor.userId()});
},
"tap #deleteChar": function(event, template){
console.log("deleting", this);
Characters.remove(this._id);
}