Improved new user experience and fixed errors on character delete
This commit is contained in:
@@ -299,6 +299,7 @@ Characters.calculate = {
|
||||
var fieldSelector = {};
|
||||
fieldSelector[fieldName] = 1;
|
||||
var char = Characters.findOne(charId, {fields: fieldSelector});
|
||||
if (!char) return;
|
||||
var field = char[fieldName];
|
||||
if (field === undefined){
|
||||
throw new Meteor.Error(
|
||||
@@ -332,6 +333,7 @@ Characters.calculate = {
|
||||
},
|
||||
attributeValue: memoize(function(charId, attributeName){
|
||||
var attribute = Characters.calculate.getField(charId, attributeName);
|
||||
if (!attribute) return;
|
||||
//base value
|
||||
var value = Characters.calculate.attributeBase(charId, attributeName);
|
||||
//plus adjustment
|
||||
@@ -343,6 +345,7 @@ Characters.calculate = {
|
||||
}),
|
||||
skillMod: memoize(preventLoop(function(charId, skillName){
|
||||
var skill = Characters.calculate.getField(charId, skillName);
|
||||
if (!skill) return;
|
||||
//get the final value of the ability score
|
||||
var ability = Characters.calculate.attributeValue(charId, skill.ability);
|
||||
|
||||
@@ -394,7 +397,6 @@ Characters.calculate = {
|
||||
return prof && prof.value || 0;
|
||||
}),
|
||||
passiveSkill: memoize(function(charId, skillName){
|
||||
var skill = Characters.calculate.getField(charId, skillName);
|
||||
var mod = +Characters.calculate.skillMod(charId, skillName);
|
||||
var value = 10 + mod;
|
||||
Effects.find(
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.newUserStepper {
|
||||
height: 210px !important;
|
||||
height: 180px !important;
|
||||
}
|
||||
|
||||
.newUserStepper paper-step .invalid-step-message {
|
||||
|
||||
@@ -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}}
|
||||
|
||||
@@ -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-->
|
||||
|
||||
@@ -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),
|
||||
})
|
||||
|
||||
@@ -34,7 +34,7 @@ Missing Doc
|
||||
}
|
||||
#slideshowViewport {
|
||||
position: absolute;
|
||||
bottom: 42px;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
overflow: hidden;
|
||||
|
||||
@@ -180,14 +180,14 @@ Custom property | Description | Default
|
||||
<!-- Slideshow and buttons area for horizontal layout -->
|
||||
<template is="dom-if" if="[[!vertical]]">
|
||||
<div class="flex"></div>
|
||||
<!--
|
||||
<div id="buttonsWrapper">
|
||||
<paper-button hidden$="[[!hasBackButton]]" disabled=[[!_hasBackStep]] on-tap="back">[[backText]]</paper-button>
|
||||
<span class="flex"></span>
|
||||
<paper-button hidden$="[[!hasSkipButton]]" disabled="[[!_canSkip]]" on-tap="progress">[[skipText]]</paper-button>
|
||||
<!--
|
||||
<paper-button id="continueButton" on-tap="continue">{{_choosePrimaryButtonText(_attrForSelectedStepPrimaryButtonText, finishText, continueText, updateText)}}</paper-button>
|
||||
-->
|
||||
</div>
|
||||
-->
|
||||
</template>
|
||||
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user