Implemented Feature editing UI

This commit is contained in:
Thaum
2015-01-21 11:16:00 +00:00
parent 078f873219
commit 84512beb72
32 changed files with 1072 additions and 161 deletions

View File

@@ -1,19 +1,27 @@
Template.features.helpers({
features: function(){
var features = Features.find({character: this._id});
var features = Features.find({charId: this._id});
return features;
}
});
Template.features.events({
// Fires when any element is clicked
'change .enabled': function (event) {
var enable = event.target.checked
Features.update(this._id, {$set: {enabled: enable}});
if(enable){
Template.parentData(1).pushEffects(this.name, this.effects);
} else {
Template.parentData(1).pullEffects(this.effects);
}
"tap #addFeature": function(event){
var featureId = Features.insert({name: "New Feature", charId: this._id});
GlobalUI.showDialog({
heading: "New Feature",
template: "featureDialog",
data: {featureId: featureId},
fullOnMobile: true
})
},
"tap .featureCard": function(event){
var featureId = this._id;
GlobalUI.showDialog({
heading: this.name,
template: "featureDialog",
data: {featureId: featureId},
fullOnMobile: true
})
}
});