Improved new user experience and fixed errors on character delete

This commit is contained in:
Stefan Zermatten
2017-09-28 13:03:54 +02:00
parent c4e77c7eae
commit 4c31ab601c
11 changed files with 25 additions and 15 deletions

View File

@@ -3,7 +3,8 @@ Template.registerHelper("canEditCharacter", function(charId) {
});
canEditCharacter = function(charId) {
var char = Characters.findOne(charId)
var char = Characters.findOne(charId);
if (!char) return false;
var userId = Meteor.userId();
return char.owner === userId ||
_.contains(char.writers, userId);

View File

@@ -10,7 +10,7 @@ Template.deleteCharacterConfirmation.helpers({
if (Template.instance().canDelete.get()) {
return "background: #d23f31; color: white;";
}
}
},
});
Template.deleteCharacterConfirmation.events({
@@ -20,9 +20,7 @@ Template.deleteCharacterConfirmation.events({
},
"click #deleteButton": function(event, instance) {
if (instance.find("#nameInput").value === this.name) {
popDialogStack();
Router.go("/characterList");
Characters.remove(this._id);
popDialogStack(true);
}
},
"click .cancelButton": function(event, instance){

View File

@@ -1,7 +1,7 @@
<template name="characterSheet">
<div class="fit layout vertical character-sheet">
<app-header fixed effects="waterfall">
<app-toolbar class="medium-tall {{colorClass}}">
<app-toolbar class="medium-tall {{colorClass}}" style="z-index: 2;">
<div top-item class="layout horizontal center">
<paper-icon-button icon="menu" drawer-toggle></paper-icon-button>
<div class="flex character-name">

View File

@@ -199,6 +199,12 @@ Template.characterSheet.events({
data: this,
template: "deleteCharacterConfirmation",
element: event.currentTarget.parentElement.parentElement,
callback: (result) => {
if (result === true){
Router.go("/characterList");
Tracker.afterFlush(() => Characters.remove(this._id));
}
},
});
},
"click #shareCharacter": function(event, instance){

View File

@@ -1,5 +1,5 @@
.newUserStepper {
height: 210px !important;
height: 180px !important;
}
.newUserStepper paper-step .invalid-step-message {

View File

@@ -1,6 +1,6 @@
<template name="statCard">
<div>
<paper-material class="stat-card layout horizontal">
<paper-material class="stat-card layout horizontal {{#if bounce}}bounce{{/if}}">
<div class="numbers paper-font-display1">
{{#if isSkill}}
{{prefix}}{{skillMod}}

View File

@@ -15,7 +15,7 @@
<!--Armor-->
{{> statCard stat="armor" name="Armor Class" color="teal"}}
<!--Speed-->
{{> statCard stat="speed" name="Speed" color="teal"}}
{{> statCard stat="speed" name="Speed" color="teal" bounce=shouldSpeedBounce}}
<!--Initiative-->
{{> statCard stat="initiative" name="Initiative" color="indigo" isSkill="true"}}
<!--Proficiency Bonus-->

View File

@@ -8,6 +8,10 @@ Template.stats.helpers({
};
return Buffs.find(selector);
},
// New user experience
shouldSpeedBounce: function(){
return Session.get("newUserExperienceStep") === 2;
},
})
Template.stats.events({
@@ -84,8 +88,7 @@ Template.stats.events({
callback: (result) => {
if (!result) {
return;
}
else Meteor.call("giveCondition", this._id, result)
} else Meteor.call("giveCondition", this._id, result)
},
//returnElement: () => $(`[data-id='${itemId}']`).get(0),
})