Migrated stats tab to Polymer 1.0

This commit is contained in:
Stefan Zermatten
2017-01-17 15:01:11 +02:00
parent b8fdc27df9
commit 420de9b005
19 changed files with 214 additions and 255 deletions

View File

@@ -1,35 +1,31 @@
<template name="hitDice">
{{#if characterCalculate "attributeBase" ../_id name}}
<div>
<paper-material class="card hit-dice" hero-id="main"
{{detailHero name ../_id}}
layout horizontal>
<div class="left green display1 white-text"
hero-id="toolbar" {{detailHero name ../_id}}
layout horizontal>
<div>
<paper-icon-button class="resourceUp"
icon="arrow-drop-up"
disabled={{cantIncrement}}>
</paper-icon-button>
<paper-icon-button class="resourceDown"
icon="arrow-drop-down"
disabled={{cantDecrement}}>
</paper-icon-button>
</div>
<div class="resourceValue" layout vertical center>
<paper-material class="card hit-dice layout horizontal">
<div class="left green paper-font-display1 white-text layout horizontal">
<div>
{{characterCalculate "attributeValue" ../_id name}}
<paper-icon-button class="resourceUp"
icon="arrow-drop-up"
disabled={{cantIncrement}}>
</paper-icon-button>
<paper-icon-button class="resourceDown"
icon="arrow-drop-down"
disabled={{cantDecrement}}>
</paper-icon-button>
</div>
<div class="title white-text">
d{{diceNum}} {{conMod}}
<div class="resourceValue layout vertical center">
<div>
{{characterCalculate "attributeValue" ../_id name}}
</div>
<div class="paper-font-title white-text">
d{{diceNum}} {{conMod}}
</div>
</div>
</div>
</div>
<div class="right clickable" flex relative horizontal layout center>
Hit Dice
</div>
</paper-material>
<div class="right clickable flex relative horizontal layout center">
Hit Dice
</div>
</paper-material>
</div>
{{/if}}
</template>

View File

@@ -16,7 +16,7 @@ Template.hitDice.helpers({
});
Template.hitDice.events({
"tap .resourceUp": function(event){
"click .resourceUp": function(event){
var value = Characters.calculate.attributeValue(this.char._id, this.name);
var base = Characters.calculate.attributeBase(this.char._id, this.name);
if (value < base){
@@ -25,7 +25,7 @@ Template.hitDice.events({
Characters.update(this.char._id, modifier, {validate: false});
}
},
"tap .resourceDown": function(event){
"click .resourceDown": function(event){
var value = Characters.calculate.attributeValue(this.char._id, this.name);
if (value > 0){
var modifier = {$inc: {}};
@@ -33,10 +33,10 @@ Template.hitDice.events({
Characters.update(this.char._id, modifier, {validate: false});
}
},
"tap .right": function() {
"click .right": function(event, template) {
var charId = Template.parentData()._id;
var title = "d" + this.diceNum + " Hit Dice";
GlobalUI.setDetail({
pushDialogStack({
template: "attributeDialog",
data: {
name: title,
@@ -44,7 +44,7 @@ Template.hitDice.events({
charId: charId,
color: "green",
},
heroId: charId + this.name,
element: event.currentTarget.parentElement,
});
},
});