Added character list. Fixed TempHP

This commit is contained in:
Thaum
2015-03-13 12:49:00 +00:00
parent 059ebf7db2
commit 9722a19c89
11 changed files with 141 additions and 7 deletions

View File

@@ -0,0 +1,8 @@
.characterCards {
padding: 4px;
}
.characterCard{
width: 272px;
margin: 4px;
}

View File

@@ -0,0 +1,27 @@
<template name="characterList">
<core-toolbar class="blue-grey white-text">
<core-icon-button icon="menu" core-drawer-toggle></core-icon-button>
<div flex>
Characters
</div>
</core-toolbar>
<div class="scroll-y" fit>
<div layout horizontal class="characterCards">
{{# each characters}}
{{#with characterDetails}}
{{#containerCardHelper this}}{{alignment}} {{gender}} {{race}}{{/containerCardHelper}}
{{/with}}
{{/each}}
</div>
{{> gridPadding class="characterCard" num=12}}
<div class="fab-buffer"></div>
<paper-fab id="addCharacter"
class="floatyButton"
icon="add"
title="Add"
role="button"
tabindex="0"
aria-label="Add"
hero-id="main"></paper-fab>
</div>
</template>

View File

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