Prettified all remaining detail boxes to be view -> edit

This commit is contained in:
Thaum
2015-04-20 14:06:35 +00:00
parent 6ec9f09b6a
commit 012aad5ae9
41 changed files with 334 additions and 164 deletions

View File

@@ -1,11 +1,9 @@
<template name="spellDialog">
{{#with spell}}
{{#baseDialog title=name class=colorClass showEdit=true editing=editing}}
{{#if editing}}
{{> spellEdit}}
{{else}}
{{> spellDetails}}
{{/if}}
{{#baseDialog title=name class=colorClass startEditing=../startEditing}}
{{> spellDetails}}
{{else}}
{{> spellEdit}}
{{/baseDialog}}
{{/with}}
</template>

View File

@@ -11,30 +11,16 @@ var spellLevels = [
{ name: "Level 9", level: 9 },
];
Template.spellDialog.onCreated(function(){
this.editing = new ReactiveVar(false);
});
Template.spellDialog.helpers({
spell: function(){
return Spells.findOne(this.spellId);
},
editing: function(){
return Template.instance().editing.get();
},
}
});
Template.spellDialog.events({
"color-change": function(event, instance){
Spells.update(instance.data.spellId, {$set: {color: event.color}});
},
"tap #editButton": function(event, instance){
instance.editing.set(true);
},
"tap #doneEditingButton": function(event, instance){
instance.editing.set(false);
},
"tap #deleteButton": function(event, instance){
Spells.softRemoveNode(instance.data.spellId);
GlobalUI.deletedToast(instance.data.spellId, "Spells", "Spell");