Added Basic character list view
This commit is contained in:
@@ -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>
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user