Implemented basic inventory
This commit is contained in:
@@ -4,13 +4,14 @@
|
||||
</div>
|
||||
<div class="flexContainer">
|
||||
<div class="flexItem">
|
||||
<div>
|
||||
Proficiency Bonus {{proficiencyBonus}}
|
||||
</div>
|
||||
<div id="savesAndSkills" class="floatBox">
|
||||
{{> skills}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flexItem floatBox">
|
||||
<h2>Inventory</h2>
|
||||
{{> inventoryTables}}
|
||||
</div>
|
||||
<div class="flexItem floatBox">
|
||||
<h2>Description</h2>
|
||||
{{> textField character=this field="description"}}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<template name="containerTable">
|
||||
<div>
|
||||
<h3>{{name}}</h3>
|
||||
<table>
|
||||
{{#each items}}
|
||||
{{> itemRow}}
|
||||
{{/each}}
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,5 @@
|
||||
Template.containerTable.helpers({
|
||||
items: function(){
|
||||
return Items.find({container: this._id});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
<template name="inventoryTables">
|
||||
{{#each containers}}
|
||||
{{> containerTable}}
|
||||
{{/each}}
|
||||
</template>
|
||||
@@ -0,0 +1,5 @@
|
||||
Template.inventoryTables.helpers({
|
||||
containers: function(){
|
||||
return Containers.find({owner: this._id});
|
||||
}
|
||||
});
|
||||
3
rpg-docs/client/views/inventory/itemRow/itemRow.css
Normal file
3
rpg-docs/client/views/inventory/itemRow/itemRow.css
Normal file
@@ -0,0 +1,3 @@
|
||||
tr.selected{
|
||||
background-color: #4182BC;
|
||||
}
|
||||
6
rpg-docs/client/views/inventory/itemRow/itemRow.html
Normal file
6
rpg-docs/client/views/inventory/itemRow/itemRow.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<template name="itemRow">
|
||||
<tr class={{#if isSelected}}selected{{/if}}>
|
||||
<td>{{#if stackable}}{{quantity}}{{/if}}</td>
|
||||
<td>{{pluralName}}</td>
|
||||
</tr>
|
||||
</template>
|
||||
15
rpg-docs/client/views/inventory/itemRow/itemRow.js
Normal file
15
rpg-docs/client/views/inventory/itemRow/itemRow.js
Normal file
@@ -0,0 +1,15 @@
|
||||
Template.itemRow.helpers({
|
||||
isSelected: function(){
|
||||
return Session.get('selectedItemRow')=== this._id;
|
||||
}
|
||||
});
|
||||
|
||||
Template.itemRow.events({
|
||||
"click": function(e){
|
||||
if(Session.get('selectedItemRow')=== this._id){
|
||||
Session.set('selectedItemRow', null);
|
||||
} else{
|
||||
Session.set('selectedItemRow', this._id);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user