Added color options for containers, added spell lists

This commit is contained in:
Thaum
2015-02-12 13:08:20 +00:00
parent 5e98154e8d
commit 7441f09f37
32 changed files with 226 additions and 84 deletions

View File

@@ -2,19 +2,24 @@
<div fit>
<div id="spells" class="scroll-y" fit>
<div class="containers">
{{#each spellLevels}}
{{#each spellLists}}
<paper-shadow class="card container" hero-id="main" {{detailHero}}>
<div class="containerTop green white-text" hero-id="toolbar" layout horizontal center {{detailHero}}>
<div class="containerName title" hero-id="title" flex {{detailHero}}>{{name}}</div>
{{#if attribute}}<div class="subhead">{{../attributeValue attribute}} / {{../attributeBase attribute}}</div>{{/if}}
<div class="containerName subhead" hero-id="title" flex {{detailHero}}>{{name}}</div>
{{#if maxPrepared}}<div class="subhead">{{numPrepared}} / {{maxPrepared}}</div>{{/if}}
</div>
<div flex class="containerMain">
{{#each spellsAtLevel}}
<div class="itemSlot">
<paper-item class="inventoryItem" hero-id="main" {{detailHero}}>
{{name}}
</paper-item>
</div>
{{#each levels}}
{{#if spellCount ../_id ../../_id}}
<div class="list-subhead" layout horizontal center>{{name}}</div>
{{/if}}
{{#each spells ../_id ../../_id}}
<div class="itemSlot">
<paper-item class="inventoryItem" hero-id="main" {{detailHero}} layout horizontal center>
<!--school icon here--><div flex>{{name}}</div><!--prepared checkbox here-->
</paper-item>
</div>
{{/each}}
{{/each}}
</div>
</paper-shadow>

View File

@@ -1,21 +1,31 @@
var spellLevels = [
{ name: "Cantrips", level: 0 },
{ name: "Level 1", level: 1, attribute: "level1SpellSlots" },
{ name: "Level 2", level: 2, attribute: "level2SpellSlots" },
{ name: "Level 3", level: 3, attribute: "level3SpellSlots" },
{ name: "Level 4", level: 4, attribute: "level4SpellSlots" },
{ name: "Level 5", level: 5, attribute: "level5SpellSlots" },
{ name: "Level 6", level: 6, attribute: "level6SpellSlots" },
{ name: "Level 7", level: 7, attribute: "level7SpellSlots" },
{ name: "Level 8", level: 8, attribute: "level8SpellSlots" },
{ name: "Level 9", level: 9, attribute: "level9SpellSlots" },
{ name: "Level 1", level: 1 },
{ name: "Level 2", level: 2 },
{ name: "Level 3", level: 3 },
{ name: "Level 4", level: 4 },
{ name: "Level 5", level: 5 },
{ name: "Level 6", level: 6 },
{ name: "Level 7", level: 7 },
{ name: "Level 8", level: 8 },
{ name: "Level 9", level: 9 },
];
Template.spells.helpers({
spellLevels: function(){
return spellLevels;
spellLists: function(){
return SpellLists.find({charId: this._id});
},
spellsAtLevel: function(){
return Spells.find( {charId: Template.parentData()._id, level: this.level} )
}
spellCount: function(listId, charId){
console.log(listId, charId);
return Spells.find( {charId: charId, listId: listId, level: this.level}, {fields: {_id: 1, level: 1}} ).count() > 0;
},
spells: function(listId, charId){
return Spells.find( {charId: charId, listId: listId, level: this.level} );
},
levels: function(){
return spellLevels;
},
numPrepared: function(){
return Spells.find({charId: Template.parentData()._id, listId: this._id, prepared: "prepared"}).count();
}
})