Added labels to temporary hitpoints

This commit is contained in:
Thaum
2015-03-30 09:45:48 +00:00
parent ba247ff90d
commit 91fd56f828
4 changed files with 10 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ TemporaryHitPoints = new Mongo.Collection("temporaryHitPoints");
Schemas.TemporaryHitPoints = new SimpleSchema({
charId: {type: String, regEx: SimpleSchema.RegEx.Id},
name: {type: String, optional: true},
maximum: {type: Number, defaultValue: 0},
used: {type: Number, defaultValue: 0},
deleteOnZero:{type: Boolean, defaultValue: true},
@@ -9,9 +10,9 @@ Schemas.TemporaryHitPoints = new SimpleSchema({
type: Date,
autoValue: function() {
if (this.isInsert) {
return new Date;
return new Date();
} else if (this.isUpsert) {
return {$setOnInsert: new Date};
return {$setOnInsert: new Date()};
} else {
this.unset();
}

View File

@@ -1,6 +1,7 @@
<!-- data just needs charId -->
<template name="addTHPDialog">
<div style="width: 200px; height: 100px;">
<div style="width: 200px; height: 150px;">
<paper-input id="nameInput" label="Label"></paper-input>
<paper-input-decorator label="Quantity" floatinglabel>
<input autoFocus id="quantityInput" type="number" value="10">
</paper-input-decorator>

View File

@@ -1,12 +1,8 @@
Template.addTHPDialog.events({
'tap #addButton': function(event, instance){
console.log({
charId: this.charId,
maximum: +instance.find('#quantityInput').value,
deleteOnZero: !!instance.find('#deleteWhenZeroCheckbox').checked
});
TemporaryHitPoints.insert({
charId: this.charId,
name: instance.find('#nameInput').value,
maximum: +instance.find('#quantityInput').value,
deleteOnZero: !!instance.find('#deleteWhenZeroCheckbox').checked
});

View File

@@ -12,7 +12,9 @@
role="slider"
></paper-slider>
{{#each tempHitPoints}}
<div layout horizontal>
<div>
{{name}}
<div layout horizontal>
<paper-slider class="tempHitPointSlider"
value={{left}}
max={{maximum}}
@@ -24,6 +26,7 @@
<paper-icon-button class="deleteTHP" icon="delete"></paper-icon-button>
{{/unless}}{{/unless}}
</div>
</div>
{{/each}}
<div class="caption">
{{#if multipliers.immunities.length}} <div>Immune: {{#each multipliers.immunities}} {{name}} {{/each}}</div>{{/if}}