Made proficiencies their own objects, added migration functionality

This commit is contained in:
Thaum
2015-04-17 13:56:52 +00:00
parent 245867dae6
commit b76ac23713
20 changed files with 331 additions and 17 deletions

View File

@@ -0,0 +1,18 @@
<!--needs to be given charId, parentId and parentCollection-->
<template name="proficiencyEditList">
{{#if proficiencies.count}}
<hr class="vertMargin">
<div id="proficiencies">
<h2>Proficiencies</h2>
{{#each proficiencies}}
{{>proficiencyEdit}}
{{/each}}
</div>
{{/if}}
<paper-button id="addProficiencyButton"
class="red-button"
raised>
Add Proficiency
</paper-button>
</template>

View File

@@ -0,0 +1,24 @@
Template.proficiencyEditList.helpers({
proficiencies: function(){
var cursor = Proficiencies.find({"parent.id": this.parentId, "parent.collection": this.parentCollection});
return cursor;
}
});
Template.proficiencyEditList.events({
"tap #addProficiencyButton": function(){
if ( !_.isBoolean(this.enabled) ) {
this.enabled = true;
}
Proficiencies.insert({
charId: this.charId,
parent: {
id: this.parentId,
collection: this.parentCollection
},
enabled: this.enabled,
value: 1,
type: "skill",
});
},
});