Fixed stuff, enabled character deletion

This commit is contained in:
Thaum
2015-03-30 12:13:27 +00:00
parent 35ce49ded8
commit 8d183a708f
19 changed files with 127 additions and 28 deletions

View File

@@ -0,0 +1,3 @@
<template name="characterSettings">
</template>

View File

@@ -0,0 +1,3 @@
Template.characterSettings.events({
});

View File

@@ -0,0 +1,9 @@
<template name="deleteCharacterConfirmation">
<div>
Deleting a character cannot be undone.<br>
To continue type "{{name}}" into the box below.<br>
<paper-input id="nameInput" label="type the characters's name here" style="width: 100%;"></paper-input><br>
<paper-button id="deleteButton" style={{getStyle}} disabled={{cantDelete}}>Delete Character</paper-button>
</div>
<paper-button id="cancelButton" affirmative> Cancel </paper-button>
</template>

View File

@@ -0,0 +1,26 @@
Template.deleteCharacterConfirmation.onCreated(function(){
this.canDelete = new ReactiveVar(false);
});
Template.deleteCharacterConfirmation.helpers({
cantDelete: function(){
return !Template.instance().canDelete.get();
},
getStyle: function(){
if(Template.instance().canDelete.get()) return "background: #d23f31; color: white;";
}
});
Template.deleteCharacterConfirmation.events({
"change #nameInput, input #nameInput": function(event, instance){
var canDel = instance.find("#nameInput").value === this.name;
instance.canDelete.set(canDel);
},
"tap #deleteButton": function(event, instance){
if(instance.find("#nameInput").value === this.name){
GlobalUI.closeDialog();
Router.go("/");
Characters.remove(this._id);
}
}
});