Implemented remaining core features
This commit is contained in:
@@ -11,6 +11,13 @@ Template.features.helpers({
|
||||
},
|
||||
featureOrder: function(){
|
||||
return _.indexOf(_.keys(colorOptions), this.color);
|
||||
},
|
||||
attacks: function(){
|
||||
return Attacks.find({charId: this._id}, {sort: {color: 1, name: 1}});
|
||||
},
|
||||
characterProficiencies: function(){
|
||||
var char = Characters.findOne(this._id);
|
||||
return char && char.proficiencies;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -23,7 +30,21 @@ Template.features.events({
|
||||
heroId: featureId
|
||||
})
|
||||
},
|
||||
"tap .containerTop": function(event){
|
||||
"tap #addAttackButton": function(event){
|
||||
var charId = this._id;
|
||||
Attacks.insert({
|
||||
charId: charId
|
||||
}, function(error, id){
|
||||
if(!error){
|
||||
GlobalUI.setDetail({
|
||||
template: "attackDialog",
|
||||
data: {attackId: id, charId: charId},
|
||||
heroId: id
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
"tap .featureCard .containerTop": function(event){
|
||||
var featureId = this._id;
|
||||
var charId = Template.parentData()._id;
|
||||
GlobalUI.setDetail({
|
||||
@@ -32,6 +53,15 @@ Template.features.events({
|
||||
heroId: featureId
|
||||
});
|
||||
},
|
||||
"tap .attack": function(event){
|
||||
var attackId = this._id;
|
||||
var charId = Template.parentData()._id;
|
||||
GlobalUI.setDetail({
|
||||
template: "attackDialog",
|
||||
data: {attackId: attackId, charId: charId},
|
||||
heroId: attackId
|
||||
});
|
||||
},
|
||||
"tap .useFeature": function(event){
|
||||
var featureId = this._id;
|
||||
Features.update(featureId, {$inc: {used: 1}});
|
||||
@@ -39,6 +69,14 @@ Template.features.events({
|
||||
"tap .resetFeature": function(event){
|
||||
var featureId = this._id;
|
||||
Features.update(featureId, {$set: {used: 0}});
|
||||
},
|
||||
"tap #proficiencies": function(event){
|
||||
var charId = this._id;
|
||||
GlobalUI.setDetail({
|
||||
template: "textDialog",
|
||||
data: {charId: charId, field: "proficiencies", title: "Proficiencies", color: "q"},
|
||||
heroId: this._id + "proficiencies"
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user