Made Attacks come from items

This commit is contained in:
Thaum
2015-03-09 14:03:11 +00:00
parent 40a050d88f
commit 55784d0e3b
17 changed files with 185 additions and 67 deletions

View File

@@ -0,0 +1,13 @@
<!--needs to be given charId, sourceId and type-->
<template name="attackEditList">
{{#if attacks.count}}
<hr style="margin: 16px 0 16px 0;">
<div id="attacks">
<h2>Attacks</h2>
{{#each attacks}}
{{>attackEdit}}
{{/each}}
</div>
{{/if}}
<paper-button id="addAttackButton" class="red-button" raised>Add Attack</paper-button>
</template>

View File

@@ -0,0 +1,21 @@
Template.attackEditList.helpers({
attacks: function(){
var cursor = Attacks.find({sourceId: this.sourceId, type: this.type});
return cursor;
}
});
Template.attackEditList.events({
"tap #addAttackButton": function(){
if ( !_.isBoolean(this.enabled) ) {
this.enabled = true;
}
Attacks.insert({
name: this.name,
charId: this.charId,
sourceId: this.sourceId,
type: this.type,
enabled: this.enabled
});
},
});