Implemented Feature editing UI
This commit is contained in:
@@ -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
|
||||
})
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user