Skip to content

Commit

Permalink
fix: Funky item page stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
UltraKev authored and xdy committed Aug 21, 2020
1 parent 2d0f1e8 commit fcf3004
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 85 deletions.
2 changes: 1 addition & 1 deletion src/module/sheets/TwodsixActorSheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class TwodsixActorSheet extends ActorSheet {
for (const i of sheetData.items) {
i.img = i.img || CONST.DEFAULT_TOKEN;
// Append to gear.
if (i.type === 'equipment' || i.type === 'weapon') {
if (i.type === 'equipment' || i.type === 'weapon' || i.type === 'armor' || i.type === 'augment') {
gear.push(i);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/module/sheets/TwodsixItemSheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class TwodsixItemSheet extends ItemSheet {
return mergeObject(super.defaultOptions, {
classes: ["twodsix", "sheet", "item"],
width: 520,
height: 480,
height: 321,
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description"}]
});
}
Expand Down
30 changes: 29 additions & 1 deletion static/styles/twodsix.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

95 changes: 74 additions & 21 deletions static/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"traveller"
],
"traveller": {
"name": "",
"name": "name",
"homeworld": "",
"species": "",
"description": "",
"description": "description",
"age": {
"value": 18,
"min": 0
Expand Down Expand Up @@ -913,45 +913,98 @@
"types": [
"equipment",
"weapon",
"armor"
"armor",
"augment"
],
"templates": {
"carried": {
"name": "",
"description": "",
"equipmentTemplate": {
"name": "Equipment",
"techlevel": 0,
"description": "description",
"quantity": 1,
"weight": 0,
"techlevel": 0,
"cost": 0,
"traits": [],
"type": "equipment",
"equiped": {
"weight": 0
}
},
"weaponTemplate": {
"name": "Weapon",
"techlevel": 0,
"description": "description",
"quantity": 1,
"range": 0,
"damage": 0,
"damagebonus": 0,
"magazinesize": 0,
"magazinecost": 0,
"traits": []
"traits": [],
"type": "weapon",
"equiped": {
"weight": 0
}
},
"armorTemplate": {
"name": "Armor",
"techlevel": 0,
"description": "description",
"quantity": 1,
"armour": 0,
"traits": [],
"type": "armor",
"equiped": {
"weight": 0
}
},
"augmentTemplate": {
"name": "augment",
"techlevel": 0,
"description": "description",
"quantity": 1,
"location": "",
"traits": [],
"type": "augment",
"equiped": {
"weight": 0
}
}
},
"equipment": {
"templates": [
"carried"
]
"templates": ["equipmentTemplate"],
"name": "Item Name",
"techlevel": 0,
"quantity": 1,
"weight": 0,
"type": "equipment",
"description": "Item Description"
},
"weapon": {
"templates": [
"carried",
"weapon"
]
"templates": ["weaponTemplate"],
"name": "Item Name",
"techlevel": 0,
"quantity": 1,
"weight": 0,
"type": "equipment",
"description": "Item Description"
},
"armor": {
"templates": [
"carried",
"armor"
]
"templates": ["armorTemplate"],
"name": "Item Name",
"techlevel": 0,
"quantity": 1,
"weight": 0,
"type": "equipment",
"description": "Item Description"
},
"augment": {
"templates": ["augmentTemplate"],
"name": "Item Name",
"techlevel": 0,
"quantity": 1,
"weight": 0,
"type": "equipment",
"description": "Item Description"
}
}
}
}
6 changes: 6 additions & 0 deletions static/templates/actors/actor-sheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,19 @@
</div>

{{!-- Skills Tab --}}
<div class="tab skills" data-group="primary" data-tab="skills">
{{> "systems/twodsix/templates/actors/parts/actor-skills.html"}}
</div>

{{!-- Owned Items Tab --}}
<div class="tab items" data-group="primary" data-tab="items">
{{> "systems/twodsix/templates/actors/parts/actor-items.html"}}
</div>

{{!-- Biography Tab --}}
<div class="tab skills" data-group="primary" data-tab="info">
{{> "systems/twodsix/templates/actors/parts/actor-info.html"}}
</div>

</div>
</div>
Expand Down
2 changes: 0 additions & 2 deletions static/templates/actors/parts/actor-info.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<div class="tab info" data-group="primary" data-tab="info">
<div class="grid-container">
<div class="contacts">
contacts:
Expand All @@ -20,4 +19,3 @@
{{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}}
</div>
</div>
</div>
47 changes: 27 additions & 20 deletions static/templates/actors/parts/actor-items.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
<div class="tab items" data-group="primary" data-tab="items">
<div class="general-items">
<ol class="items-list">
<!-- <li class="item flexrow item-header">-->
<!-- <div class="item-image"></div>-->
<!-- <div class="item-name">Name</div>-->
<!-- <div class="item-controls">-->
<!-- <a class="item-control item-create" title="Create item" data-type="item"><i class="fas fa-plus"></i> Add-->
<!-- item</a>-->
<!-- </div>-->
<!-- </li>-->
{{#each actor.gear as |item id|}}
<li class="item flexrow" data-item-id="{{item._id}}">
<div class="item-image"><img src="{{item.img}}" title="{{item.name}}" width="24" height="24" /></div>
<h4 class="item-name">{{item.name}}</h4>
<div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
<li class="item flexrow item-header">
<div class="item-image"></div>
<div class="item-name">Name</div>
<div class="item-controls">
<a class="item-control item-create" title="Create item" data-type="equipment"><i class="fas fa-plus"></i> Add item</a>
</div>
</li>

{{#each actor.gear as |item id|}}
<li class="item flexrow" data-item-id="{{item._id}}">
<div class="item-grid">
<h4 class="item-name">{{item.name}}</h4>
<h4 class="item-name">{{item.techlevel}}</h4>
<h4 class="item-name">{{item.quantity}}</h4>
<h4 class="item-name">{{item.weight}}</h4>
<h4 class="item-type">{{item.type}}</h4>
<div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</div>
</li>
{{/each}}


</ol>
</div>
</div>
4 changes: 2 additions & 2 deletions static/templates/actors/parts/actor-skills.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="tab skills" data-group="primary" data-tab="skills">

{{!-- The grid classes are defined in scss/global/_grid.scss. To use,
use both the "grid" and "grid-Ncol" class where "N" can be any number
from 1 to 12 and will create that number of columns. --}}
Expand Down Expand Up @@ -63,4 +63,4 @@
{{/if}}
{{/each}}
</div>
</div>

62 changes: 25 additions & 37 deletions static/templates/items/item-sheet.html
Original file line number Diff line number Diff line change
@@ -1,41 +1,29 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}" alt="item image"/>
<div class="header-fields">
<h1 class="charname">
<label for="item.name" class="resource-label">Quantity</label>
<input id="item.name" name="name" type="text" value="{{item.name}}" placeholder="Name"/></h1>
<div class="grid grid-2col">
<div class="resource">
<label for="data.quantity" class="resource-label">Quantity</label>
<input id="data.quantity" type="text" name="data.quantity" value="{{data.quantity}}"
data-dtype="Number"/>
</div>
<div class="resource">
<label for="data.weight" class="resource-label">Weight</label>
<input id="data.weight" type="text" name="data.weight" value="{{data.weight}}" data-dtype="Number"/>
</div>
</div>
</div>
</header>
<div class="item-page">

<label for="item.name" class="resource-label">Item Name</label>
<input id="data.name" name="name" type="text" value="{{item.name}}" placeholder="Item Name"/>

<label for="data.techlevel" class="resource-label">TL</label>
<input id="data.techlevel" name="techlevel" type="text" value="{{item.techlevel}}" data-dtype="Number"/>

<label for="data.quantity" class="resource-label">Quantity</label>
<input id="data.quantity" name="quantity" type="text" value="{{item.quantity}}" data-dtype="Number"/>

<label for="data.weight" class="resource-label">Weight</label>
<input id="data.weight" name="weight" type="text" value="{{item.weight}}" data-dtype="Number"/>

{{!-- Sheet Tab Navigation --}}
<nav class="sheet-tabs tabs" data-group="primary">
<a class="item" data-tab="description">Description</a>
<a class="item" data-tab="attributes">Attributes</a>
</nav>
<label for="item.type" class="resource-label">Item Type</label>
<select name="type" value={{item.type}} >
{{#select item.type}}
<option value="equipment">Equipment</option>
<option value="weapon">Weapon</option>
<option value="armor">Armor</option>
<option value="augment">Augment</option>
{{/select}}
</select>

{{!-- Sheet Body --}}
<section class="sheet-body">

{{!-- Description Tab --}}
<div class="tab" data-group="primary" data-tab="description">
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>

{{!-- Attributes Tab --}}
<div class="tab attributes" data-group="primary" data-tab="attributes">
{{!-- As you add new fields, add them in here! --}}
</div>
</section>
<label for="data.description" class="resource-label">Item description</label>
<textarea id="item.description" type="text" name="description" for="item.description" value="{{item.description}}"></textarea>
</div>
</form>

0 comments on commit fcf3004

Please sign in to comment.