From 7986e91ab7f5eeb989f35955c95216626e1efca4 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Mon, 28 Dec 2020 17:54:33 +0100 Subject: [PATCH 1/6] added storageLocation property to items Additions: - added storageLocation property to classes - added storageLocation field to template - added localization Changes: - changed default values for item string properties to "-" Fixes: - fixed CSS side-property flex properties such that new text field is properly shown - fixed for="..." setting for item's data.price label --- src/lang/en.json | 1 + src/scss/components/_description.scss | 8 ++++---- src/template.json | 3 ++- src/templates/item/partials/description.hbs | 7 +++++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/lang/en.json b/src/lang/en.json index b2244a44..9714455c 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -12,6 +12,7 @@ "DS4.AttackTypeMeleeRanged": "Melee / Ranged", "DS4.Quantity": "Quantity", "DS4.PriceGold": "Price (Gold)", + "DS4.StorageLocation": "Stored at", "DS4.ItemAvailability": "Availability", "DS4.ItemAvailabilityHamlet": "Hamlet", "DS4.ItemAvailabilityVilage": "Village", diff --git a/src/scss/components/_description.scss b/src/scss/components/_description.scss index 61ce282f..5f507f7f 100644 --- a/src/scss/components/_description.scss +++ b/src/scss/components/_description.scss @@ -1,5 +1,5 @@ .side-properties { - flex: 0 0 150px; + flex: 0 0 50%; margin: 5px 5px 5px 0; padding-right: 5px; border-right: 2px groove $c-border-groove; @@ -10,15 +10,15 @@ flex-direction: row; label { - flex: 2; + flex: 1; line-height: 26px; font-weight: bold; } input, select { - text-align: right; - flex: 1; + text-align: left; + flex: 1.5 1.5 0px; width: calc(100% - 2px); } } diff --git a/src/template.json b/src/template.json index 196d74a8..240235fc 100644 --- a/src/template.json +++ b/src/template.json @@ -46,7 +46,8 @@ "physical": { "quantity": 1, "price": 0, - "availability": "none" + "availability": "-", + "storageLocation": "-" }, "equipable": { "equipped": false diff --git a/src/templates/item/partials/description.hbs b/src/templates/item/partials/description.hbs index 5d46f9b5..56c8fdd2 100644 --- a/src/templates/item/partials/description.hbs +++ b/src/templates/item/partials/description.hbs @@ -4,12 +4,16 @@ +
+ + +
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} \ No newline at end of file From 9cf248754c0ad13eda74da9e248521f5a6adfacf Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Mon, 28 Dec 2020 18:49:55 +0100 Subject: [PATCH 2/6] 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 --}} @@ -46,9 +47,11 @@ {{!-- Description Tab --}} {{> systems/ds4/templates/item/partials/description.hbs}} - {{!-- Attributes Tab --}} -
- {{!-- As you add new fields, add them in here! --}} -
+ {{!-- Details Tab --}} + {{> systems/ds4/templates/item/partials/details.hbs}} + + {{!-- Effects Tab --}} + {{> systems/ds4/templates/item/partials/effects.hbs}} + \ 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 --}} @@ -19,9 +20,11 @@ {{!-- Description Tab --}} {{> systems/ds4/templates/item/partials/description.hbs}} - {{!-- Attributes Tab --}} -
- {{!-- As you add new fields, add them in here! --}} -
+ {{!-- Details Tab --}} + {{> systems/ds4/templates/item/partials/details.hbs}} + + {{!-- Effects Tab --}} + {{> systems/ds4/templates/item/partials/effects.hbs}} + \ 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. --}} +
+ {{!-- As you add new fields, add them in here! --}} +

Nothing to see yet.

+
\ 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 --}} +
+
    +
  1. +
    +
    Name
    + +
  2. + {{#each item.effects as |effect id|}} +
  3. +

    {{effect.label}}

    +
    + + +
    +
  4. + {{/each}} +
+
\ 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 --}} @@ -26,9 +27,11 @@ {{!-- Description Tab --}} {{> systems/ds4/templates/item/partials/description.hbs}} - {{!-- Attributes Tab --}} -
- {{!-- As you add new fields, add them in here! --}} -
+ {{!-- Details Tab --}} + {{> systems/ds4/templates/item/partials/details.hbs}} + + {{!-- Effects Tab --}} + {{> systems/ds4/templates/item/partials/effects.hbs}} + \ 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 --}} @@ -19,27 +20,11 @@ {{!-- Description Tab --}} {{> systems/ds4/templates/item/partials/description.hbs}} - {{!-- Attributes Tab --}} -
-
    -
  1. -
    -
    Name
    - -
  2. - {{#each item.effects as |effect id|}} -
  3. -

    {{effect.label}}

    -
    - - -
    -
  4. - {{/each}} -
-
+ {{!-- Details Tab --}} + {{> systems/ds4/templates/item/partials/details.hbs}} + + {{!-- Effects Tab --}} + {{> systems/ds4/templates/item/partials/effects.hbs}} + \ 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 --}} @@ -41,9 +42,11 @@ {{!-- Description Tab --}} {{> systems/ds4/templates/item/partials/description.hbs}} - {{!-- Attributes Tab --}} -
- {{!-- As you add new fields, add them in here! --}} -
+ {{!-- Details Tab --}} + {{> systems/ds4/templates/item/partials/details.hbs}} + + {{!-- Effects Tab --}} + {{> systems/ds4/templates/item/partials/effects.hbs}} + \ No newline at end of file From e7df21426b2387ecb57f9af5910a112c6e9c5afa Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Mon, 28 Dec 2020 18:58:01 +0100 Subject: [PATCH 3/6] removed code duplication in item templates Item templates now all use a common body. --- src/module/ds4.ts | 1 + src/templates/item/armor-sheet.hbs | 22 ++-------------------- src/templates/item/equipment-sheet.hbs | 22 ++-------------------- src/templates/item/partials/body.hbs | 22 ++++++++++++++++++++++ src/templates/item/shield-sheet.hbs | 22 ++-------------------- src/templates/item/trinket-sheet.hbs | 22 ++-------------------- src/templates/item/weapon-sheet.hbs | 22 ++-------------------- 7 files changed, 33 insertions(+), 100 deletions(-) create mode 100644 src/templates/item/partials/body.hbs diff --git a/src/module/ds4.ts b/src/module/ds4.ts index c5d0f99b..8b67b9f7 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -35,6 +35,7 @@ async function registerHandlebarsPartials() { "systems/ds4/templates/item/partials/description.hbs", "systems/ds4/templates/item/partials/details.hbs", "systems/ds4/templates/item/partials/effects.hbs", + "systems/ds4/templates/item/partials/body.hbs", ]; return loadTemplates(templatePaths); } diff --git a/src/templates/item/armor-sheet.hbs b/src/templates/item/armor-sheet.hbs index b720df0e..a0a671dc 100644 --- a/src/templates/item/armor-sheet.hbs +++ b/src/templates/item/armor-sheet.hbs @@ -34,24 +34,6 @@ - {{!-- Sheet Tab Navigation --}} - - - {{!-- Sheet Body --}} -
- - {{!-- Description Tab --}} - {{> systems/ds4/templates/item/partials/description.hbs}} - - {{!-- Details Tab --}} - {{> systems/ds4/templates/item/partials/details.hbs}} - - {{!-- Effects Tab --}} - {{> systems/ds4/templates/item/partials/effects.hbs}} - -
+ {{!-- Common Item body --}} + {{> systems/ds4/templates/item/partials/body.hbs}} \ No newline at end of file diff --git a/src/templates/item/equipment-sheet.hbs b/src/templates/item/equipment-sheet.hbs index 25434bf5..5c2c3d4e 100644 --- a/src/templates/item/equipment-sheet.hbs +++ b/src/templates/item/equipment-sheet.hbs @@ -7,24 +7,6 @@ - {{!-- Sheet Tab Navigation --}} - - - {{!-- Sheet Body --}} -
- - {{!-- Description Tab --}} - {{> systems/ds4/templates/item/partials/description.hbs}} - - {{!-- Details Tab --}} - {{> systems/ds4/templates/item/partials/details.hbs}} - - {{!-- Effects Tab --}} - {{> systems/ds4/templates/item/partials/effects.hbs}} - -
+ {{!-- Common Item body --}} + {{> systems/ds4/templates/item/partials/body.hbs}} \ No newline at end of file diff --git a/src/templates/item/partials/body.hbs b/src/templates/item/partials/body.hbs new file mode 100644 index 00000000..9b5cde20 --- /dev/null +++ b/src/templates/item/partials/body.hbs @@ -0,0 +1,22 @@ +{{!-- Template for the common body (navigation & body sections) of all items. --}} + +{{!-- Sheet Tab Navigation --}} + + +{{!-- Sheet Body --}} +
+ + {{!-- Description Tab --}} + {{> systems/ds4/templates/item/partials/description.hbs}} + + {{!-- Details Tab --}} + {{> systems/ds4/templates/item/partials/details.hbs}} + + {{!-- Effects Tab --}} + {{> systems/ds4/templates/item/partials/effects.hbs}} + +
\ No newline at end of file diff --git a/src/templates/item/shield-sheet.hbs b/src/templates/item/shield-sheet.hbs index b06ecb45..1e893d2a 100644 --- a/src/templates/item/shield-sheet.hbs +++ b/src/templates/item/shield-sheet.hbs @@ -14,24 +14,6 @@ - {{!-- Sheet Tab Navigation --}} - - - {{!-- Sheet Body --}} -
- - {{!-- Description Tab --}} - {{> systems/ds4/templates/item/partials/description.hbs}} - - {{!-- Details Tab --}} - {{> systems/ds4/templates/item/partials/details.hbs}} - - {{!-- Effects Tab --}} - {{> systems/ds4/templates/item/partials/effects.hbs}} - -
+ {{!-- Common Item body --}} + {{> systems/ds4/templates/item/partials/body.hbs}} \ No newline at end of file diff --git a/src/templates/item/trinket-sheet.hbs b/src/templates/item/trinket-sheet.hbs index 25434bf5..5c2c3d4e 100644 --- a/src/templates/item/trinket-sheet.hbs +++ b/src/templates/item/trinket-sheet.hbs @@ -7,24 +7,6 @@ - {{!-- Sheet Tab Navigation --}} - - - {{!-- Sheet Body --}} -
- - {{!-- Description Tab --}} - {{> systems/ds4/templates/item/partials/description.hbs}} - - {{!-- Details Tab --}} - {{> systems/ds4/templates/item/partials/details.hbs}} - - {{!-- Effects Tab --}} - {{> systems/ds4/templates/item/partials/effects.hbs}} - -
+ {{!-- Common Item body --}} + {{> systems/ds4/templates/item/partials/body.hbs}} \ No newline at end of file diff --git a/src/templates/item/weapon-sheet.hbs b/src/templates/item/weapon-sheet.hbs index 09b3facf..37c0aa2c 100644 --- a/src/templates/item/weapon-sheet.hbs +++ b/src/templates/item/weapon-sheet.hbs @@ -29,24 +29,6 @@ - {{!-- Sheet Tab Navigation --}} - - - {{!-- Sheet Body --}} -
- - {{!-- Description Tab --}} - {{> systems/ds4/templates/item/partials/description.hbs}} - - {{!-- Details Tab --}} - {{> systems/ds4/templates/item/partials/details.hbs}} - - {{!-- Effects Tab --}} - {{> systems/ds4/templates/item/partials/effects.hbs}} - -
+ {{!-- Common Item body --}} + {{> systems/ds4/templates/item/partials/body.hbs}} \ No newline at end of file From 123c56a572a0d39dd2d30fedc58724a29ca31b09 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Mon, 28 Dec 2020 20:01:58 +0100 Subject: [PATCH 4/6] added storageLocation to item type definition --- src/module/item/item-data.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/module/item/item-data.ts b/src/module/item/item-data.ts index fed78643..82d59d26 100644 --- a/src/module/item/item-data.ts +++ b/src/module/item/item-data.ts @@ -27,6 +27,7 @@ interface DS4ItemPhysical { quantity: number; price: number; availability: "hamlet" | "village" | "city" | "elves" | "dwarves" | "none"; + storageLocation: string; } interface DS4ItemEquipable { From e0d8e42812e3d2ac196e860e6b0a982192cf9911 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Mon, 28 Dec 2020 21:44:47 +0100 Subject: [PATCH 5/6] changed availability options to include "unset" Additions: - item availability "unset" (with localization) Changes: - item availability "none" -> "nowhere" Fixes: - fixed wrong default item availability in template.json --- src/lang/en.json | 3 ++- src/module/config.ts | 3 ++- src/module/item/item-data.ts | 2 +- src/template.json | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lang/en.json b/src/lang/en.json index 0973c816..81898fbd 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -20,7 +20,8 @@ "DS4.ItemAvailabilityCity": "City", "DS4.ItemAvailabilityElves": "Elves", "DS4.ItemAvailabilityDwarves": "Dwarves", - "DS4.ItemAvailabilityNone": "None", + "DS4.ItemAvailabilityUnset": "Unset", + "DS4.ItemAvailabilityNoWhere": "NoWhere", "DS4.ItemTypeWeapon": "Weapon", "DS4.ItemTypeArmor": "Armor", "DS4.ItemTypeShield": "Shield", diff --git a/src/module/config.ts b/src/module/config.ts index 09bcfe5a..9a6e1744 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -23,12 +23,13 @@ export const DS4 = { * @type {Object} */ itemAvailabilities: { + unset: "DS4.ItemAvailabilityUnset", hamlet: "DS4.ItemAvailabilityHamlet", village: "DS4.ItemAvailabilityVilage", city: "DS4.ItemAvailabilityCity", elves: "DS4.ItemAvailabilityElves", dwarves: "DS4.ItemAvailabilityDwarves", - none: "DS4.ItemAvailabilityNone", + nowhere: "DS4.ItemAvailabilityNoWhere", }, /** diff --git a/src/module/item/item-data.ts b/src/module/item/item-data.ts index 82d59d26..58f4dc90 100644 --- a/src/module/item/item-data.ts +++ b/src/module/item/item-data.ts @@ -26,7 +26,7 @@ interface DS4ItemBase { interface DS4ItemPhysical { quantity: number; price: number; - availability: "hamlet" | "village" | "city" | "elves" | "dwarves" | "none"; + availability: "hamlet" | "village" | "city" | "elves" | "dwarves" | "nowhere" | "unset"; storageLocation: string; } diff --git a/src/template.json b/src/template.json index daa1dc9c..f25fe366 100644 --- a/src/template.json +++ b/src/template.json @@ -46,7 +46,7 @@ "physical": { "quantity": 1, "price": 0, - "availability": "-", + "availability": "unset", "storageLocation": "-" }, "equipable": { From 10869a96488bc347f1e32d9cfc900f11113078cf Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Mon, 28 Dec 2020 21:50:45 +0100 Subject: [PATCH 6/6] fixed typo --- src/lang/en.json | 2 +- src/module/config.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lang/en.json b/src/lang/en.json index 81898fbd..6f8526d1 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -21,7 +21,7 @@ "DS4.ItemAvailabilityElves": "Elves", "DS4.ItemAvailabilityDwarves": "Dwarves", "DS4.ItemAvailabilityUnset": "Unset", - "DS4.ItemAvailabilityNoWhere": "NoWhere", + "DS4.ItemAvailabilityNowhere": "Nowhere", "DS4.ItemTypeWeapon": "Weapon", "DS4.ItemTypeArmor": "Armor", "DS4.ItemTypeShield": "Shield", diff --git a/src/module/config.ts b/src/module/config.ts index 9a6e1744..07c97ca1 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -29,7 +29,7 @@ export const DS4 = { city: "DS4.ItemAvailabilityCity", elves: "DS4.ItemAvailabilityElves", dwarves: "DS4.ItemAvailabilityDwarves", - nowhere: "DS4.ItemAvailabilityNoWhere", + nowhere: "DS4.ItemAvailabilityNowhere", }, /**