Added character list. Fixed TempHP
This commit is contained in:
@@ -106,3 +106,9 @@ html /deep/ .white-text{
|
||||
color: #444;
|
||||
color: rgba(0,0,0,0.54);
|
||||
}
|
||||
|
||||
.white54 {
|
||||
color: #eee;
|
||||
color: rgba(255,255,255,0.54)
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<template name="healthCard">
|
||||
<paper-shadow class="card container healthCard" hero-id="main" {{detailHero}} layout horizontal wrap>
|
||||
<div class="green white-text subhead padded leftRound" layout horizontal center>
|
||||
<div class="green white-text subhead padded leftRound" layout vertical center-justified>
|
||||
Hit Points
|
||||
<paper-icon-button class="white54" id="addTempHP" icon="add"></paper-icon-button>
|
||||
</div>
|
||||
<div class="padded" flex layout vertical center-justified style="min-width: 180px;">
|
||||
<paper-slider id="hitPointSlider"
|
||||
@@ -10,7 +11,14 @@
|
||||
editable pin
|
||||
role="slider"
|
||||
></paper-slider>
|
||||
<!--Temp hitpoints go here-->
|
||||
{{#each tempHitPoints}}
|
||||
<paper-slider class="tempHitPointSlider"
|
||||
value={{left}}
|
||||
max={{maximum}}
|
||||
editable pin
|
||||
role="slider"
|
||||
></paper-slider>
|
||||
{{/each}}
|
||||
<div class="caption">
|
||||
{{#if multipliers.immunities.length}} <div>Immune: {{#each multipliers.immunities}} {{name}} {{/each}}</div>{{/if}}
|
||||
{{#if multipliers.resistances.length}}<div>Resistance: {{#each multipliers.resistances}} {{name}} {{/each}}</div>{{/if}}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
Template.healthCard.helpers({
|
||||
tempHitPoints: function(){
|
||||
return TemporaryHitPoints.find({charId: this._id});
|
||||
},
|
||||
showDeathSave: function(){
|
||||
return this.attributeValue("hitPoints") <= 0;
|
||||
},
|
||||
@@ -55,6 +58,15 @@ Template.healthCard.events({
|
||||
var adjustment = value - this.attributeBase("hitPoints");
|
||||
Characters.update(this._id, {$set: {"hitPoints.adjustment": adjustment}});
|
||||
},
|
||||
"change .tempHitPointSlider": function(event){
|
||||
var value = event.currentTarget.value;
|
||||
var used = this.maximum - value;
|
||||
TemporaryHitPoints.update(this._id, {$set: {"used": used}});
|
||||
},
|
||||
"tap #addTempHP": function(event){
|
||||
var max = prompt("Add temporary hitpoints", "10");
|
||||
TemporaryHitPoints.insert({charId: this._id, maximum: max, used: 0});
|
||||
},
|
||||
"tap .failBubble": function(event){
|
||||
if(event.currentTarget.disabled) return;
|
||||
var char = Template.parentData();
|
||||
|
||||
8
rpg-docs/client/views/characterList/characterList.css
Normal file
8
rpg-docs/client/views/characterList/characterList.css
Normal file
@@ -0,0 +1,8 @@
|
||||
.characterCards {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.characterCard{
|
||||
width: 272px;
|
||||
margin: 4px;
|
||||
}
|
||||
27
rpg-docs/client/views/characterList/characterList.html
Normal file
27
rpg-docs/client/views/characterList/characterList.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<template name="characterList">
|
||||
<core-toolbar class="blue-grey white-text">
|
||||
<core-icon-button icon="menu" core-drawer-toggle></core-icon-button>
|
||||
<div flex>
|
||||
Characters
|
||||
</div>
|
||||
</core-toolbar>
|
||||
<div class="scroll-y" fit>
|
||||
<div layout horizontal class="characterCards">
|
||||
{{# each characters}}
|
||||
{{#with characterDetails}}
|
||||
{{#containerCardHelper this}}{{alignment}} {{gender}} {{race}}{{/containerCardHelper}}
|
||||
{{/with}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{> gridPadding class="characterCard" num=12}}
|
||||
<div class="fab-buffer"></div>
|
||||
<paper-fab id="addCharacter"
|
||||
class="floatyButton"
|
||||
icon="add"
|
||||
title="Add"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
aria-label="Add"
|
||||
hero-id="main"></paper-fab>
|
||||
</div>
|
||||
</template>
|
||||
23
rpg-docs/client/views/characterList/characterList.js
Normal file
23
rpg-docs/client/views/characterList/characterList.js
Normal file
@@ -0,0 +1,23 @@
|
||||
Template.characterList.helpers({
|
||||
characterDetails: function(){
|
||||
var char = Characters.findOne(this._id, {fields: {name: 1, gender: 1, alignment: 1, race:1, color: 1}})
|
||||
char.title = char.name;
|
||||
char.field = "base"
|
||||
char.class = "characterCard"
|
||||
return char;
|
||||
}
|
||||
});
|
||||
|
||||
Template.characterList.events({
|
||||
"tap .characterCard": function(event, instance){
|
||||
console.log(this);
|
||||
Router.go("characterSheet", {_id: this._id});
|
||||
},
|
||||
"tap #addCharacter": function (event, template) {
|
||||
Characters.insert({owner: Meteor.userId()});
|
||||
},
|
||||
"tap #deleteChar": function(event, template){
|
||||
console.log("deleting", this);
|
||||
Characters.remove(this._id);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user