Fixed stuff, enabled character deletion
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
<template name="characterSettings">
|
||||
|
||||
</template>
|
||||
@@ -0,0 +1,3 @@
|
||||
Template.characterSettings.events({
|
||||
|
||||
});
|
||||
@@ -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>
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user