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);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -8,6 +8,15 @@
|
||||
<div>
|
||||
{{> colorDropdown}}
|
||||
</div>
|
||||
<paper-menu-button>
|
||||
<paper-icon-button icon="menu" noink></paper-icon-button>
|
||||
<paper-dropdown class="dropdown" halign="right">
|
||||
<core-menu class="menu" style="color: black; color: rgba(0,0,0,0.87);">
|
||||
<paper-item id="deleteCharacter"><core-icon icon="delete"></core-icon>Delete</paper-item>
|
||||
<paper-item id="shareCharacter"><core-icon icon="social:share"></core-icon>Share</paper-item>
|
||||
</core-menu>
|
||||
</paper-dropdown>
|
||||
</paper-menu-button>
|
||||
<div class="bottom fit" horizontal layout>
|
||||
<paper-tabs flex horizontal center layout id="characterSheetTabs" selected={{selectedTab}} class="{{colorClass}}">
|
||||
<paper-tab name="stats">Stats</paper-tab>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Template.characterSheet.created = function(){
|
||||
Session.setDefault(this.data._id + ".selectedTab", "stats");
|
||||
}
|
||||
};
|
||||
|
||||
var setTab = function(charId, tab){
|
||||
return Session.set(charId + ".selectedTab", tab);
|
||||
@@ -26,4 +26,11 @@ Template.characterSheet.events({
|
||||
"color-change": function(event, instance){
|
||||
Characters.update(this._id, {$set: {color: event.color}});
|
||||
},
|
||||
"tap #deleteCharacter": function(event, instance){
|
||||
GlobalUI.showDialog({
|
||||
heading: "Delete " + this.name,
|
||||
data: this,
|
||||
template: "deleteCharacterConfirmation",
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
{{#each attuned}}
|
||||
{{>inventoryItem}}
|
||||
{{/each}}
|
||||
<div class="list-subhead" layout horizontal center>{{name}}</div>
|
||||
{{#if attuned.count}}<div class="list-subhead" layout horizontal center>Equipment</div>{{/if}}
|
||||
{{#each equipment}}
|
||||
{{>inventoryItem}}
|
||||
{{/each}}
|
||||
|
||||
Reference in New Issue
Block a user