From 9cf248754c0ad13eda74da9e248521f5a6adfacf Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe <gesina.schwalbe@pheerai.de> Date: Mon, 28 Dec 2020 18:49:55 +0100 Subject: [PATCH] added "Effects" and "Details" tab to all items Additions: - partials for effects and details tab with navigation - loading of partials in main ds4.ts - add localization Changes: - empty "Details" tabs replaced by inclusion of partial - "Details" tab now displays default message - Previous "Details" tab of Trinket replaced by "Effects" tab --- src/lang/en.json | 1 + src/module/ds4.ts | 6 ++++- src/templates/item/armor-sheet.hbs | 11 ++++++---- src/templates/item/equipment-sheet.hbs | 11 ++++++---- src/templates/item/partials/details.hbs | 5 +++++ src/templates/item/partials/effects.hbs | 22 +++++++++++++++++++ src/templates/item/shield-sheet.hbs | 11 ++++++---- src/templates/item/trinket-sheet.hbs | 29 ++++++------------------- src/templates/item/weapon-sheet.hbs | 11 ++++++---- 9 files changed, 68 insertions(+), 39 deletions(-) create mode 100644 src/templates/item/partials/details.hbs create mode 100644 src/templates/item/partials/effects.hbs diff --git a/src/lang/en.json b/src/lang/en.json index 9714455c..0973c816 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -1,6 +1,7 @@ { "DS4.Description": "Description", "DS4.Details": "Details", + "DS4.Effects": "Effects", "DS4.AttackType": "Attack Type", "DS4.AttackTypeAbbr": "AT", "DS4.WeaponBonus": "Weapon Bonus", diff --git a/src/module/ds4.ts b/src/module/ds4.ts index bd76905c..c5d0f99b 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -31,7 +31,11 @@ Hooks.once("init", async function () { }); async function registerHandlebarsPartials() { - const templatePaths = ["systems/ds4/templates/item/partials/description.hbs"]; + const templatePaths = [ + "systems/ds4/templates/item/partials/description.hbs", + "systems/ds4/templates/item/partials/details.hbs", + "systems/ds4/templates/item/partials/effects.hbs", + ]; return loadTemplates(templatePaths); } diff --git a/src/templates/item/armor-sheet.hbs b/src/templates/item/armor-sheet.hbs index 64974483..b720df0e 100644 --- a/src/templates/item/armor-sheet.hbs +++ b/src/templates/item/armor-sheet.hbs @@ -37,6 +37,7 @@ {{!-- Sheet Tab Navigation --}} <nav class="sheet-tabs tabs" data-group="primary"> <a class="item" data-tab="description">{{localize "DS4.Description"}}</a> + <a class="item" data-tab="effects">{{localize "DS4.Effects"}}</a> <a class="item" data-tab="details">{{localize "DS4.Details"}}</a> </nav> @@ -46,9 +47,11 @@ {{!-- Description Tab --}} {{> systems/ds4/templates/item/partials/description.hbs}} - {{!-- Attributes Tab --}} - <div class="tab details" data-group="primary" data-tab="details"> - {{!-- As you add new fields, add them in here! --}} - </div> + {{!-- Details Tab --}} + {{> systems/ds4/templates/item/partials/details.hbs}} + + {{!-- Effects Tab --}} + {{> systems/ds4/templates/item/partials/effects.hbs}} + </section> </form> \ No newline at end of file diff --git a/src/templates/item/equipment-sheet.hbs b/src/templates/item/equipment-sheet.hbs index 79d4832a..25434bf5 100644 --- a/src/templates/item/equipment-sheet.hbs +++ b/src/templates/item/equipment-sheet.hbs @@ -10,6 +10,7 @@ {{!-- Sheet Tab Navigation --}} <nav class="sheet-tabs tabs" data-group="primary"> <a class="item" data-tab="description">{{localize "DS4.Description"}}</a> + <a class="item" data-tab="effects">{{localize "DS4.Effects"}}</a> <a class="item" data-tab="details">{{localize "DS4.Details"}}</a> </nav> @@ -19,9 +20,11 @@ {{!-- Description Tab --}} {{> systems/ds4/templates/item/partials/description.hbs}} - {{!-- Attributes Tab --}} - <div class="tab details" data-group="primary" data-tab="details"> - {{!-- As you add new fields, add them in here! --}} - </div> + {{!-- Details Tab --}} + {{> systems/ds4/templates/item/partials/details.hbs}} + + {{!-- Effects Tab --}} + {{> systems/ds4/templates/item/partials/effects.hbs}} + </section> </form> \ No newline at end of file diff --git a/src/templates/item/partials/details.hbs b/src/templates/item/partials/details.hbs new file mode 100644 index 00000000..2d5b3f0c --- /dev/null +++ b/src/templates/item/partials/details.hbs @@ -0,0 +1,5 @@ +{{!-- The item tab for details. --}} +<div class="tab details" data-group="primary" data-tab="details"> + {{!-- As you add new fields, add them in here! --}} + <p>Nothing to see yet.</p> +</div> \ No newline at end of file diff --git a/src/templates/item/partials/effects.hbs b/src/templates/item/partials/effects.hbs new file mode 100644 index 00000000..819290d6 --- /dev/null +++ b/src/templates/item/partials/effects.hbs @@ -0,0 +1,22 @@ +{{!-- Tab for the items view to manage effects --}} +<div class="tab details" data-group="primary" data-tab="effects"> + <ol class="effects-list"> + <li class="effect flexrow effect-header"> + <div class="effect-image"></div> + <div class="effect-name">Name</div> + <div class="effect-controls"> + <a class="effect-control effect-create" title="Create Effect"><i + class="fas fa-plus"></i> Add effect</a> + </div> + </li> + {{#each item.effects as |effect id|}} + <li class="effect flexrow" data-effect-id="{{effect._id}}"> + <h4 class="effect-name">{{effect.label}}</h4> + <div class="effect-controls"> + <a class="effect-control effect-edit" title="Edit Effect"><i class="fas fa-edit"></i></a> + <a class="effect-control effect-delete" title="Delete Effect"><i class="fas fa-trash"></i></a> + </div> + </li> + {{/each}} + </ol> +</div> \ No newline at end of file diff --git a/src/templates/item/shield-sheet.hbs b/src/templates/item/shield-sheet.hbs index ae1166f9..b06ecb45 100644 --- a/src/templates/item/shield-sheet.hbs +++ b/src/templates/item/shield-sheet.hbs @@ -17,6 +17,7 @@ {{!-- Sheet Tab Navigation --}} <nav class="sheet-tabs tabs" data-group="primary"> <a class="item" data-tab="description">{{localize "DS4.Description"}}</a> + <a class="item" data-tab="effects">{{localize "DS4.Effects"}}</a> <a class="item" data-tab="details">{{localize "DS4.Details"}}</a> </nav> @@ -26,9 +27,11 @@ {{!-- Description Tab --}} {{> systems/ds4/templates/item/partials/description.hbs}} - {{!-- Attributes Tab --}} - <div class="tab details" data-group="primary" data-tab="details"> - {{!-- As you add new fields, add them in here! --}} - </div> + {{!-- Details Tab --}} + {{> systems/ds4/templates/item/partials/details.hbs}} + + {{!-- Effects Tab --}} + {{> systems/ds4/templates/item/partials/effects.hbs}} + </section> </form> \ No newline at end of file diff --git a/src/templates/item/trinket-sheet.hbs b/src/templates/item/trinket-sheet.hbs index 364174c8..25434bf5 100644 --- a/src/templates/item/trinket-sheet.hbs +++ b/src/templates/item/trinket-sheet.hbs @@ -10,6 +10,7 @@ {{!-- Sheet Tab Navigation --}} <nav class="sheet-tabs tabs" data-group="primary"> <a class="item" data-tab="description">{{localize "DS4.Description"}}</a> + <a class="item" data-tab="effects">{{localize "DS4.Effects"}}</a> <a class="item" data-tab="details">{{localize "DS4.Details"}}</a> </nav> @@ -19,27 +20,11 @@ {{!-- Description Tab --}} {{> systems/ds4/templates/item/partials/description.hbs}} - {{!-- Attributes Tab --}} - <div class="tab details" data-group="primary" data-tab="details"> - <ol class="effects-list"> - <li class="effect flexrow effect-header"> - <div class="effect-image"></div> - <div class="effect-name">Name</div> - <div class="effect-controls"> - <a class="effect-control effect-create" title="Create Effect"><i - class="fas fa-plus"></i> Add effect</a> - </div> - </li> - {{#each item.effects as |effect id|}} - <li class="effect flexrow" data-effect-id="{{effect._id}}"> - <h4 class="effect-name">{{effect.label}}</h4> - <div class="effect-controls"> - <a class="effect-control effect-edit" title="Edit Effect"><i class="fas fa-edit"></i></a> - <a class="effect-control effect-delete" title="Delete Effect"><i class="fas fa-trash"></i></a> - </div> - </li> - {{/each}} - </ol> - </div> + {{!-- Details Tab --}} + {{> systems/ds4/templates/item/partials/details.hbs}} + + {{!-- Effects Tab --}} + {{> systems/ds4/templates/item/partials/effects.hbs}} + </section> </form> \ No newline at end of file diff --git a/src/templates/item/weapon-sheet.hbs b/src/templates/item/weapon-sheet.hbs index 4c0f89be..09b3facf 100644 --- a/src/templates/item/weapon-sheet.hbs +++ b/src/templates/item/weapon-sheet.hbs @@ -32,6 +32,7 @@ {{!-- Sheet Tab Navigation --}} <nav class="sheet-tabs tabs" data-group="primary"> <a class="item" data-tab="description">{{localize "DS4.Description"}}</a> + <a class="item" data-tab="effects">{{localize "DS4.Effects"}}</a> <a class="item" data-tab="details">{{localize "DS4.Details"}}</a> </nav> @@ -41,9 +42,11 @@ {{!-- Description Tab --}} {{> systems/ds4/templates/item/partials/description.hbs}} - {{!-- Attributes Tab --}} - <div class="tab details" data-group="primary" data-tab="details"> - {{!-- As you add new fields, add them in here! --}} - </div> + {{!-- Details Tab --}} + {{> systems/ds4/templates/item/partials/details.hbs}} + + {{!-- Effects Tab --}} + {{> systems/ds4/templates/item/partials/effects.hbs}} + </section> </form> \ No newline at end of file