Merge branch 'master' into feature-print

This commit is contained in:
Stefan Zermatten
2017-12-06 09:22:57 +02:00
71 changed files with 3905 additions and 177 deletions

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

@@ -4,7 +4,7 @@
{{/if}}
<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">
@@ -47,17 +47,18 @@
</div>
<div bottom-item>
<paper-tabs id="characterSheetTabs" selected={{selectedTab}} class="{{colorClass}}">
<paper-tab name="stats">Stats</paper-tab>
<paper-tab name="features">Features</paper-tab>
<paper-tab name="stats" class="{{#if shouldBounce 0}}bounce{{/if}}">Stats</paper-tab>
<paper-tab name="features" class="{{#if shouldBounce 1}}bounce{{/if}}">Features</paper-tab>
<paper-tab name="inventory">Inventory</paper-tab>
{{#unless hideSpellcasting}}
<paper-tab name="spells">Spells</paper-tab>
{{/unless}}
<paper-tab name="persona">Persona</paper-tab>
<paper-tab name="journal">Journal</paper-tab>
<paper-tab name="journal" class="{{#if shouldBounce 5}}bounce{{/if}}">Journal</paper-tab>
</paper-tabs>
</div>
</app-toolbar>
{{#if newUserExperience}}{{> newUserStepper}}{{/if}}
</app-header>
<div class="flex" style="position: relative;">
<iron-pages id="tabPages" class="fit" selected={{selectedTab}}>

View File

@@ -29,7 +29,7 @@ Template.characterSheet.onRendered(function() {
tabFabMenus = _.times(6, (n) =>
tabPages[n].find(".mini-holder")
);
})
});
//watch this character and make sure their encumbrance is updated
//trackEncumbranceConditions(this.data._id, this);
@@ -175,6 +175,18 @@ Template.characterSheet.helpers({
var char = Characters.findOne(this._id);
return char && char.settings.hideSpellcasting;
},
newUserExperience: function(){
var char = Characters.findOne(this._id);
return char && char.settings.newUserExperience;
},
shouldBounce: function(tab){
const selected = Session.get(this._id + ".selectedTab")
const step = Session.get("newUserExperienceStep");
if (selected == tab) return false;
return (tab === 1 && step === 0) ||
(tab === 5 && step === 1) ||
(tab === 0 && step === 2);
},
});
Template.characterSheet.events({
@@ -190,6 +202,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

@@ -42,9 +42,20 @@
</template>
<template name="featureEdit">
{{#if showNewUserExperience}}
{{# infoBox}}
<p>
Features represent all the permanent things your character can do.
</p><p>
A feature can change a character's stats with effects,
or give the character proficiencies, attacks, and buffs.
</p><p>
Give the feature a name, and close it to continue.
</p>
{{/infoBox}}
{{/if}}
<!--name-->
<paper-input id="featureNameInput" class="fullwidth" label="Name" value={{name}}></paper-input>
<div class="layout horizontal center wrap justified">
<paper-dropdown-menu class=flex label="Enable Feature" style="flex-basis: 150px; max-width: 200px;">
<dicecloud-selector selected={{enabledSelection}} class="dropdown-content enabled-dropdown">

View File

@@ -47,6 +47,10 @@ Template.featureDetails.events({
});
Template.featureEdit.helpers({
showNewUserExperience: function(){
return Session.get("newUserExperienceStep") === 0 ||
Session.get("newUserExperienceStep") === 1;
},
usesSet: function(){
return _.isString(this.uses);
},

View File

@@ -74,7 +74,7 @@
checked={{enabled}}
disabled={{#unless canEditCharacter charId}}true{{/unless}}>
</paper-checkbox>
<paper-tooltip position="left">Feature enabled</paper-tooltip>
{{#simpleTooltip}}Feature enabled{{/simpleTooltip}}
</div>
{{/if}}
</div>
@@ -101,11 +101,13 @@
{{/each}}
</div>
{{#if canEditCharacter _id}}
<paper-fab id="addFeature"
class="floatyButton"
icon="add">
<paper-tooltip position="left">Add Feature</paper-tooltip>
</paper-fab>
<div class="floatyButton">
<paper-fab id="addFeature"
class="{{#if shouldFloatyButtonBounce}}bounce{{/if}}"
icon="add">
</paper-fab>
{{#simpleTooltip}}Add Feature{{/simpleTooltip}}
</div>
{{/if}}
</div>
</template>

View File

@@ -59,6 +59,10 @@ Template.features.helpers({
hasCharacters: function(string){
return string && string.match(/\S/);
},
shouldFloatyButtonBounce: function(){
const step = Session.get("newUserExperienceStep");
return step === 0 && Features.find({charId: this._id}).count() <= 1;
},
});
Template.features.events({

View File

@@ -110,12 +110,12 @@
<div class="paper-font-caption" style="margin-right: 8px">
{{round totalWeight}} lbs
</div>
<div>
<div style="position: relative;">
<paper-checkbox class="carriedCheckbox"
disabled={{#unless canEditCharacter charId}}true{{/unless}}
checked={{isCarried}}>
</paper-checkbox>
<paper-tooltip position="left"> Container carried</paper-tooltip>
{{#simpleTooltip}} Container carried{{/simpleTooltip}}
</div>
</div>
<div class="bottom list">
@@ -136,21 +136,21 @@
class="addContainer"
mini>
</paper-fab>
<paper-tooltip position="left"> New container </paper-tooltip>
{{#simpleTooltip class="always"}} Container {{/simpleTooltip}}
</div>
<div>
<paper-fab icon="av:library-books"
class="libraryItem"
mini>
</paper-fab>
<paper-tooltip position="left"> Library item </paper-tooltip>
{{#simpleTooltip class="always"}} Item from library {{/simpleTooltip}}
</div>
<div>
<paper-fab icon="note-add"
class="addItem"
mini>
</paper-fab>
<paper-tooltip position="left"> New item </paper-tooltip>
{{#simpleTooltip class="always"}} Item {{/simpleTooltip}}
</div>
{{/fabMenu}}
{{/if}}

View File

@@ -53,7 +53,7 @@
</div>
<div class="bottom list">
<div class="item-slot">
<div class="item race layout horizontal center">
<div class="item race layout horizontal center {{#if shouldRaceBounce}}bounce{{/if}}">
{{race}}
</div>
</div>
@@ -83,9 +83,12 @@
</div>
<div class="fab-buffer"></div>
{{#if canEditCharacter _id}}
<paper-fab id="addNote"
class="floatyButton"
icon="add"
title="Add"></paper-fab>
<div class="floatyButton">
<paper-fab id="addNote"
icon="add"
title="Add">
</paper-fab>
{{#simpleTooltip}}Add Note{{/simpleTooltip}}
</div>
{{/if}}
</template>

View File

@@ -50,6 +50,9 @@ Template.journal.helpers({
var char = Characters.findOne(this._id, {fields: {race: 1}});
return char && char.race;
},
shouldRaceBounce: function(){
return Session.get("newUserExperienceStep") === 1;
},
});
Template.journal.events({

View File

@@ -1,11 +1,34 @@
<template name="raceDialog">
{{#baseDialog title="Race" class=color hideColor="true" hideDelete="true" startEditing=startEditing}}
{{#if showNewUserExperience}}
{{#infoBox}}
{{#if stepComplete}}
<p>You can add all the effects you need to represent how your race affects your character's attributes.</p>
{{else}}
<p>Click the edit button to edit your race and add a racial effect</p>
{{/if}}
{{/infoBox}}
{{/if}}
<div class="horizontal layout center-justified paper-font-display2">
{{race}}
</div>
{{> effectsViewList charId=charId parentId=charId parentGroup="racial"}}
{{> proficiencyViewList charId=charId parentId=charId parentGroup="racial"}}
{{else}}
{{#if showNewUserExperience}}
{{#infoBox}}
{{#if stepComplete}}
<p>You can add all the effects you need to represent how your race affects your character's attributes.</p>
{{else}}
<p>
Add an effect with the following options: <br>
Attribute: <b>stats > speed</b> <br>
Operation: <b>Base Value</b> <br>
Value: <b>30</b> (might be different for some races)
</p>
{{/if}}
{{/infoBox}}
{{/if}}
<paper-input id="raceInput" label="Race" value={{race}}></paper-input>
{{> effectsEditList parentId=charId parentCollection="Characters" charId=charId parentGroup="racial"}}
{{> proficiencyEditList parentId=charId parentCollection="Characters" charId=charId parentGroup="racial"}}

View File

@@ -19,4 +19,10 @@ Template.raceDialog.helpers({
var char = Characters.findOne(this.charId, {fields: {color: 1}});
if (char) return getColorClass(char.color);
},
stepComplete: function(){
return Session.get("newUserExperienceStep") > 1;
},
showNewUserExperience: function(){
return Session.get("newUserExperienceStep") >= 1;
},
});

View File

@@ -0,0 +1,12 @@
.newUserStepper {
height: 180px !important;
}
.newUserStepper paper-step .invalid-step-message {
color: #d13b2e;
visibility: hidden;
}
.newUserStepper paper-step[invalid] .invalid-step-message {
visibility: visible;
}

View File

@@ -0,0 +1,29 @@
<template name="newUserStepper">
<paper-stepper linear selected="0" class="newUserStepper">
<paper-step id="step0" label="Add a feature">
<p>
To get started, add a feature
</p>
</paper-step>
<paper-step id="step1" label="Add an effect">
<p>
Add a racial effect to set your speed
</p>
</paper-step>
<paper-step id="step2" label="See the effect in action">
<p>
View your speed stat
</p>
</paper-step>
<paper-step id="step3" label="Finish">
Done! If you get stuck, be sure to check out the <a href="/guide">guide</a>, or ask for help using the feedback form
<div class="layout vertical end">
<paper-button class="done-button" style="color: #d13b2e">Finish</paper-button>
</div>
</paper-step>
</paper-stepper>
</template>
<template name="newUserStepperPlaceholder">
<div style="height: 300px"></div>
</template>

View File

@@ -0,0 +1,58 @@
Template.newUserStepper.onRendered(function(){
Session.set("newUserExperienceStep", 0);
let stepper = this.find("paper-stepper");
_.defer(() => {
this.autorun((c) => {
var step = Session.get("newUserExperienceStep");
var hasFeatures = Features.find({charId: this.data._id}).count() > 1;
if (step === 0 && hasFeatures){
stepper.continue();
}
});
this.autorun((c) => {
var step = Session.get("newUserExperienceStep");
var hasEffect = !!Effects.find({
charId: this.data._id,
stat: "speed",
"parent.group": "racial",
operation: "base",
value: {$gt: 0},
}).count();
if (step === 1 && hasEffect){
stepper.continue();
}
});
this.autorun((c) => {
var step = Session.get("newUserExperienceStep");
if (step === 2 && Session.get("viewedSpeed")){
Session.set("viewedSpeed", undefined);
stepper.continue();
}
});
});
});
Template.newUserStepper.events({
"paper-stepper-progressed paper-stepper": function(event, template){
const step = template.find("paper-stepper").selected;
Session.set("newUserExperienceStep", step);
},
"paper-stepper-completed paper-stepper": function(event, template){
Session.set("newUserExperienceStep", undefined);
Session.set("showNewUserExperience", undefined);
Characters.update(this._id, {$unset: {"settings.newUserExperience": 1}});
},
"click .done-button": function(event, instance){
const stepper = instance.find("paper-stepper");
stepper.continue();
},
});
Template.stats.events({
"click .stat-card": function(event, instance){
var step = Session.get("newUserExperienceStep");
if (this.stat === "speed" && step === 2){
Session.set("viewedSpeed", true);
}
}
});

View File

@@ -53,22 +53,22 @@
{{numPrepared}} / {{evaluate charId maxPrepared}}
</div>
{{/if}}
<div>
<paper-tooltip position="left">
Done
</paper-tooltip>
<div style="position: relative;">
<paper-icon-button class="finishPrep" icon="done">
</paper-icon-button>
{{#simpleTooltip}}
Done
{{/simpleTooltip}}
</div>
{{else}}
<div>
<paper-tooltip position="left">
Change prepared spells
</paper-tooltip>
<div style="position: relative;">
<paper-icon-button class="prepSpells"
disabled={{#unless canEditCharacter charId}}true{{/unless}}
icon="book">
</paper-icon-button>
{{#simpleTooltip}}
Change prepared spells
{{/simpleTooltip}}
</div>
{{/if}}
</div>
@@ -124,32 +124,31 @@
{{#if canEditCharacter _id}}
{{#fabMenu}}
<div>
<paper-tooltip position="left">
New spell list
</paper-tooltip>
<paper-fab icon="work"
class="addSpellList"
mini>
</paper-fab>
{{#simpleTooltip class="always"}}
Spell list
{{/simpleTooltip}}
</div>
<div>
<paper-tooltip position="left">
Spell library
</paper-tooltip>
<paper-fab icon="av:library-books"
class="librarySpell"
mini>
</paper-fab>
{{#simpleTooltip class="always"}}
Spell from library
{{/simpleTooltip}}
</div>
<div>
<paper-tooltip position="left">
New spell
</paper-tooltip>
<paper-fab icon="note-add"
class="addSpell"
mini>
</paper-fab>
{{#simpleTooltip class="always"}}
Spell
{{/simpleTooltip}}
</div>
{{/fabMenu}}
{{/if}}

View File

@@ -267,9 +267,11 @@ Template.spells.events({
//loop through all returned spells
_.each(resultArray, (rawSpell, index) =>{
// Make the library spell into a regular spell
let spell = _.omit(rawSpell, "library", "attacks", "effects");
let spell = _.omit(rawSpell, "_id", "library", "attacks", "effects");
// Use the ID generated earlier for the first spell so we
// can animate to it
if (index == 0) {
spell._id = spellId; //only do this for the first spell added
spell._id = spellId;
}
spell.charId = charId;
spell.parent = {
@@ -277,23 +279,23 @@ Template.spells.events({
collection: "SpellLists",
};
spell.prepared = "prepared";
Spells.insert(spell);
let insertedSpellId = Spells.insert(spell);
// Copy over attacks and effects
_.each(rawSpell.attacks, (attack) => {
if (!("attackBonus" in attack)) {attack.attackBonus = "attackBonus"} //if no attack bonus provided, use spell list's
attack.charId = charId;
attack.parent = {id: spellId, collection: "Spells"};
attack.parent = {id: insertedSpellId, collection: "Spells"};
Attacks.insert(attack);
});
_.each(rawSpell.effects, (effect) => {
effect.charId = charId;
effect.parent = {id: spellId, collection: "Spells"};
effect.parent = {id: insertedSpellId, collection: "Spells"};
Effects.insert(effect);
});
_.each(rawSpell.buffs, (buff) => {
buff.charId = charId;
buff.parent = {id: spellId, collection: "Spells"};
buff.parent = {id: insertedSpellId, collection: "Spells"};
buffId = Buffs.insert(buff);
_.each(buff.attacks, (attack) => {

View File

@@ -6,6 +6,16 @@
</template>
<template name="attributeDialogView">
{{#if showNewUserExperience}}
{{#infoBox}}
<p>
This dialog shows how your speed is set by the effect you added to your character's race.
</p>
<p>
In DiceCloud you don't change stats directly, rather you add effects which impact your stats in different ways. This way, you can always tell where your stats came from, and how they got to their current value.
</p>
{{/infoBox}}
{{/if}}
<div class="layout horizontal center-justified end">
<div class="paper-font-display2">
{{attributeValue}}

View File

@@ -157,4 +157,9 @@ Template.attributeDialogView.helpers({
statValue: function(){
return evaluateEffect(this.charId, this);
},
showNewUserExperience: function(){
if (this.statName === "speed"){
return Session.get("newUserExperienceStep") >= 2;
}
},
});

View File

@@ -16,7 +16,8 @@ Template.healthCard.onRendered(function(){
const id = Template.currentData()._id;
if (oldId !== id){
this.find("#hitPointSlider").resetOldValue();
this.find("#temporaryHitPointSlider").resetOldValue();
var thpSlider = this.find("#temporaryHitPointSlider");
thpSlider && thpSlider.resetOldValue();
oldId = id;
}
});

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),
})

View File

@@ -49,14 +49,14 @@
class="addParty"
mini>
</paper-fab>
<paper-tooltip position="left"> New Party </paper-tooltip>
{{#simpleTooltip class="always"}} New Party {{/simpleTooltip}}
</div>
<div>
<paper-fab icon="face"
class="addCharacter"
mini>
</paper-fab>
<paper-tooltip position="left"> New Character </paper-tooltip>
{{#simpleTooltip class="always"}} New Character {{/simpleTooltip}}
</div>
{{/fabMenu}}
</div>

View File

@@ -85,7 +85,7 @@
<div>
On the official subreddit
</div>
<a href="http://www.reddit.com/r/dicecloud/">
<a href="http://www.reddit.com/r/dicecloud/" target="_blank">
<paper-button class="redditButton">
/r/dicecloud
</paper-button>
@@ -93,14 +93,14 @@
</div>
<div class="layout vertical center">
<div class="paper-font-headline">
Get involved
Open Source
</div>
<div>
Shape upcoming features and track bugs on the DiceCloud Trello board
Shape upcoming features, track bugs, and contribute to the DiceCloud codebase
</div>
<a href="https://trello.com/b/94M0SCnq/dicecloud-roadmap">
<paper-button class="trelloButton">
Trello Roadmap
<a href="https://github.com/ThaumRystra/DiceCloud1/" target="_blank">
<paper-button class="githubButton">
GitHub Repo
</paper-button>
</a>
</div>

View File

@@ -0,0 +1,15 @@
.infoBox iron-icon {
color: #747474;
color: rgba(0,0,0,0.54);
height: 32px;
width: 32px;
margin-right: 12px;
}
.infoBox > div > p {
margin: 0;
}
.infoBox > div > p + p {
margin-top: 10px;
}

View File

@@ -0,0 +1,10 @@
<template name="infoBox">
<div class="layout horizontal center infoBox">
<div>
<iron-icon icon="info-outline"></iron-icon>
</div>
<div class="flex">
{{> Template.contentBlock}}
</div>
</div>
</template>

View File

@@ -25,7 +25,6 @@
{{/ simpleTooltip}}
</div>
<div class="brackets" style="position: relative">
<!--<paper-tooltip position="left" animation-delay="0">This field accepts formulae in {curly brackets}</paper-tooltip>-->
<iron-icon icon="dicecloud:code-braces"></iron-icon>
{{# simpleTooltip}}
This field accepts formulae in {curly brackets}

View File

@@ -1,4 +1,18 @@
.simple-tooltip:hover .tooltip {
.simple-tooltip {
pointer-events: none;
}
.simple-tooltip:active {
pointer-events: none;
}
/* Show the tooltip if a older sibling is hovered */
*:hover ~ .simple-tooltip > .tooltip {
opacity: 0.9;
}
/* Show the tooltip if parent is hovered */
*:hover > .simple-tooltip > .tooltip {
opacity: 0.9;
}
@@ -16,3 +30,7 @@
pointer-events: none;
white-space: nowrap;
}
.tooltip.always {
opacity: 0.9;
}

View File

@@ -1,6 +1,6 @@
<template name="simpleTooltip">
<div class="simple-tooltip fit">
<div class="tooltip">
<div class="simple-tooltip fit layout vertical center-justified">
<div class="tooltip {{class}}">
{{> Template.contentBlock}}
</div>
</div>

View File

@@ -1,4 +1,3 @@
.profile #at-nav-button {
color: #212121;
color: rgba(0,0,0,0.87);
.profile paper-button, .profile a, .profile #at-nav-button {
color: #d13b2e;
}

View File

@@ -27,7 +27,7 @@
{{#if verified}}
<span>
<iron-icon icon="check"></iron-icon>
<paper-tooltip>Verified</paper-tooltip>
{{#simpleTooltip}}Verified{{/simpleTooltip}}
</span>
{{/if}}
</div>
@@ -35,9 +35,36 @@
</td>
<td></td>
</tr>
<tr>
<td colspan="2">
<a href="/change-password">
<paper-button>Change password</paper-button>
</a>
</td>
</tr>
<tr>
<td>
API Key
</td>
<td class="apiKey">
{{#if apiKey}}
{{#unless showApiKey}}
<paper-button class="showApiKey">
Show
</paper-button>
{{else}}
{{apiKey}}
{{/unless}}
{{else}}
<paper-button class="generateMyApiKey">
Generate
</paper-button>
{{/if}}
</td>
</tr>
</table>
<div style="max-width: 250px">
{{> atForm}}
{{> atForm state="signIn"}}
</div>
{{> atNavButton }}
</paper-material>

View File

@@ -1,10 +1,17 @@
Template.profile.onCreated(function(){
this.showApiKey = new ReactiveVar(false);
});
Template.profile.helpers({
profileName: function() {
var user = Meteor.user();
return user.profile && user.profile.username ||
user.username ||
"Tap to set username";
}
},
showApiKey: function(){
return Template.instance().showApiKey.get();
},
});
Template.profile.events({
@@ -25,4 +32,11 @@ Template.profile.events({
data: {},
});
},
"click .showApiKey": function(event, instance){
instance.showApiKey.set(!instance.showApiKey.get());
},
"click .generateMyApiKey": function(event, instance){
Meteor.call("generateMyApiKey");
instance.showApiKey.set(true);
},
});

View File

@@ -3,7 +3,7 @@
<app-header-layout has-scrolling-region class="feedback flex">
<app-header fixed effects="waterfall">
<app-toolbar>
<div main-title>Feedback</div>
<div main-title>Change Username</div>
</app-toolbar>
</app-header>
<div class="form flex">