diff --git a/src/scss/global/_flex.scss b/src/scss/global/_flex.scss index ca8ae406..271c64b3 100644 --- a/src/scss/global/_flex.scss +++ b/src/scss/global/_flex.scss @@ -32,6 +32,10 @@ } } +.flexnowrap { + flex-wrap: nowrap; +} + .flexcol { display: flex; flex-direction: column; diff --git a/src/templates/actor/partials/items.hbs b/src/templates/actor/partials/items.hbs index 28f8be43..792891f4 100644 --- a/src/templates/actor/partials/items.hbs +++ b/src/templates/actor/partials/items.hbs @@ -1,130 +1,154 @@ {{!-- TODO: For items list: only show header, if list is not empty --}} -{{!-- TODO: Reduce code duplications --}} -{{!-- TODO: Change from flex layout to grid layout --}} -{{!-- Tab with overview and quick-actions on owned items --}} + + +{{!-- ======================================================================== --}} +{{!-- INLINE PARTIAL DEFINITIONS --}} +{{!-- ======================================================================== --}} + +{{!-- +!-- Render an "add" button for a given data type. +!-- +!-- @param datType: hand over the dataType to the partial as hash parameter +--}} +{{#*inline "addButton"}} +
+ + + {{localize 'DS4.UserInteractionAddItem'}} +
+{{/inline}} +{{!-- +!-- Render a group of an "edit" and a "delete" button for the current item. +!-- The current item is defined by the data-item-id HTML property of the parent li element. +--}} +{{#*inline "itemControlButtons"}} +
+ + +
+{{/inline}} + + +{{!-- +!-- Render a header row for a given data type. +!-- It is a flexbox with a child for each column head. +!-- An "equipped" heading is rendered except for the case dataType==='equipment'. +!-- The partial assumes a variable dataType to be given in the context. +!-- If the partial is called with a partial block, the partial block +!-- content is inserted before the description heading. + +!-- @param datType: hand over the dataType to the partial as hash parameter +!-- @param partial-block: hand over custom children of the flexbox in the partial block. +--}} +{{#*inline "listHeader" }} +
  • + {{!-- equipped --}} + {{#if (ne dataType 'equipment')}} +
    E
    + {{/if}} + {{!-- image --}} +
    + {{!-- amount --}} +
    #
    + {{!-- name --}} +
    {{localize 'DS4.ItemName'}}
    + {{!-- item type specifics --}} + {{> @partial-block }} + {{!-- description --}} +
    {{localize 'DS4.Description'}}
    + {{!-- add button --}} + {{> addButton dataType=dataType }} +
  • +{{/inline}} + +{{!-- +!-- Render a list row from a given item. +!-- It is a flexbox with a child for each item value of interest. +!-- An equipped checkbox is rendered if item.data.data.equipped is defined. +!-- The partial assumes a variable item to be given in the context. +!-- If the partial is called with a partial block, the partial block +!-- content is inserted before the description. + +!-- @param item: hand over the item to the partial as hash parameter +!-- @param partial-block: hand over custom children of the flexbox in the partial block. +--}} +{{#*inline "listEntry"}} +
  • + {{!-- equipped --}} + {{#if (ne item.data.data.equipped undefined)}} + {{#if item.data.data.equipped}} + {{else}} + {{/if}} + {{/if}} +
    + {{!-- image --}} +
    + +
    + {{!-- amount --}} +
    {{item.data.data.quantity}}
    +
    + {{!-- name --}} +

    {{item.name}}

    + {{!-- item type specifics --}} + {{> @partial-block}} + {{!-- description --}} +
    {{{item.data.data.description}}}
    + {{!-- control buttons --}} + {{> itemControlButtons}} +
  • +{{/inline}} + + +{{!-- ======================================================================== --}} + +
    {{!-- WEAPONS --}} -

    {{localize 'DS4.ItemTypeWeapon'}}

    {{!-- SPECIFIC --}} +

    {{localize 'DS4.ItemTypeWeapon'}}

      -
    1. -
      -
      E
      {{!-- equipped --}} {{!-- SPECIFIC --}} -
      -
      #
      {{!-- amount --}} + {{#> listHeader dataType='weapon'}} +
      {{localize 'DS4.AttackTypeAbbr'}}
      +
      + {{localize 'DS4.WeaponBonusAbbr'}}
      -
      {{localize 'DS4.ItemName'}}
      -
      {{localize 'DS4.AttackTypeAbbr'}}
      {{!-- SPECIFIC --}} -
      -
      {{localize 'DS4.WeaponBonusAbbr'}} -
      {{!-- SPECIFIC --}} -
      {{localize - 'DS4.OpponentDefenseAbbr'}}
      {{!-- SPECIFIC --}} +
      + {{localize 'DS4.OpponentDefenseAbbr'}}
      -
      {{localize 'DS4.Description'}}
      - {{!-- add button --}} - -
    2. - {{#each itemsByType.weapon as |item id|}} {{!-- SPECIFIC --}} - {{#with item.data.data as |itemData|}} -
    3. -
      - {{!-- equipped? --}} - {{#if itemData.equipped}} - {{else}} - {{/if}} {{!--SPECIFIC --}} - {{!-- image --}} -
      - + {{/listHeader}} + {{#each itemsByType.weapon as |item id|}} + {{#> listEntry item=item}} +
      +
      - {{!-- amount --}} -
      {{itemData.quantity}}
      -
      - {{!-- name --}} -

      {{item.name}}

      - {{!-- item specifics --}} -
      - -
      {{!-- SPECIFIC --}} -
      -
      {{itemData.weaponBonus}}
      {{!-- SPECIFIC --}} -
      {{itemData.opponentDefense}}
      {{!-- SPECIFIC --}} -
      - {{!-- description --}} -
      {{{itemData.description}}}
      - {{!-- edit & delete buttons --}} -
      - - -
      -
    4. - {{/with}} +
      {{ item.data.data.weaponBonus}}
      +
      {{ item.data.data.opponentDefense}}
      + {{/listEntry}} {{/each}}
    {{!-- ARMOR --}} -

    {{localize 'DS4.ItemTypeArmor'}}

    {{!-- SPECIFIC --}} +

    {{localize 'DS4.ItemTypeArmor'}}

      -
    1. -
      -
      E
      {{!-- equipped --}} {{!-- SPECIFIC --}} -
      -
      #
      {{!-- amount --}} -
      -
      {{localize 'DS4.ItemName'}}
      -
      {{localize 'DS4.ArmorMaterialTypeAbbr'}}
      {{!-- - SPECIFIC --}} -
      {{localize 'DS4.ArmorTypeAbbr'}}
      {{!-- SPECIFIC --}} + {{#> listHeader dataType='armor'}} +
      {{localize 'DS4.ArmorMaterialTypeAbbr'}}
      +
      {{localize 'DS4.ArmorTypeAbbr'}}
      {{localize 'DS4.ArmorValueAbbr'}} -
      {{!-- SPECIFIC --}} -
      {{localize 'DS4.Description'}}
      - {{!-- add button --}} - -
    2. - {{#each itemsByType.armor as |item id|}} {{!-- SPECIFIC --}} - {{#with item.data.data as |itemData|}} -
    3. -
      - {{!-- equipped? --}} - {{#if itemData.equipped}} - {{else}} - {{/if}} {{!--SPECIFIC --}} - {{!-- image --}} -
      - + {{/listHeader}} + {{#each itemsByType.armor as |item id|}} + {{#> listEntry item=item }} +
      + {{lookup ../../config.armorMaterialTypesAbbr item.data.data.armorMaterialType}}
      - {{!-- amount --}} -
      {{itemData.quantity}}
      -
      - {{!-- name --}} -

      {{item.name}}

      - {{!-- item specifics --}} -
      - {{lookup ../../config.armorMaterialTypesAbbr itemData.armorMaterialType}} -
      {{!-- SPECIFIC --}} -
      - {{lookup ../../config.armorTypesAbbr itemData.armorType}} -
      {{!-- SPECIFIC --}} -
      {{itemData.armorValue}}
      {{!-- SPECIFIC --}} - {{!-- description --}} -
      {{{itemData.description}}}
      - {{!-- edit & delete buttons --}} -
      - - -
      -
    4. - {{/with}} +
      + {{lookup ../../config.armorTypesAbbr item.data.data.armorType}} +
      +
      {{ item.data.data.armorValue}}
      + {{/listEntry}} {{/each}}
    @@ -132,146 +156,41 @@ {{!-- SHIELD --}}

    {{localize 'DS4.ItemTypeShield'}}

    {{!-- SPECIFIC --}}
      -
    1. -
      -
      E
      {{!-- equipped --}} {{!-- SPECIFIC --}} -
      -
      #
      {{!-- amount --}} + {{#> listHeader dataType='shield' }} +
      + {{localize 'DS4.ArmorValueAbbr'}}
      -
      {{localize 'DS4.ItemName'}}
      -
      {{localize 'DS4.ArmorValueAbbr'}} -
      {{!-- SPECIFIC --}} -
      {{localize 'DS4.Description'}}
      - {{!-- add button --}} - -
    2. - {{#each itemsByType.shield as |item id|}} {{!-- SPECIFIC --}} - {{#with item.data.data as |itemData|}} -
    3. -
      - {{!-- equipped? --}} - {{#if itemData.equipped}} - {{else}} - {{/if}} {{!--SPECIFIC --}} - {{!-- image --}} -
      - -
      - {{!-- amount --}} -
      {{itemData.quantity}}
      -
      - {{!-- name --}} -

      {{item.name}}

      - {{!-- item specifics --}} -
      {{itemData.armorValue}}
      {{!-- SPECIFIC --}} - {{!-- description --}} -
      {{{itemData.description}}}
      - {{!-- edit & delete buttons --}} -
      - - -
      -
    4. - {{/with}} + {{/listHeader}} + {{#each itemsByType.shield as |item id|}} + {{#> listEntry item=item }} +
      {{item.data.data.armorValue}}
      {{!-- SPECIFIC --}} + {{/listEntry}} {{/each}}
    {{!-- TRINKET --}} -

    {{localize 'DS4.ItemTypeTrinket'}}

    {{!-- SPECIFIC --}} +

    {{localize 'DS4.ItemTypeTrinket'}}

      -
    1. -
      -
      E
      {{!-- equipped --}} {{!-- SPECIFIC --}} -
      -
      #
      {{!-- amount --}} -
      -
      {{localize 'DS4.ItemName'}}
      -
      {{localize 'DS4.StorageLocation'}}
      {{!-- SPECIFIC --}} -
      {{localize 'DS4.Description'}}
      - {{!-- add button --}} - -
    2. - {{#each itemsByType.trinket as |item id|}} {{!-- SPECIFIC --}} - {{#with item.data.data as |itemData|}} -
    3. -
      - {{!-- equipped? --}} - {{#if itemData.equipped}} - {{else}} - {{/if}} {{!--SPECIFIC --}} - {{!-- image --}} -
      - -
      - {{!-- amount --}} -
      {{itemData.quantity}}
      -
      - {{!-- name --}} -

      {{item.name}}

      - {{!-- storage location --}} -
      {{{itemData.storageLocation}}}
      {{!-- SPECIFIC --}} - {{!-- description --}} -
      {{{itemData.description}}}
      - {{!-- edit & delete buttons --}} -
      - - -
      -
    4. - {{/with}} + {{#> listHeader dataType='trinket'}} +
      {{localize 'DS4.StorageLocation'}}
      + {{/listHeader}} + {{#each itemsByType.trinket as |item id|}} + {{#> listEntry item=item }} +
      {{{item.data.data.storageLocation}}}
      + {{/listEntry}} {{/each}}
    {{!-- EQUIPMENT --}} -

    {{localize 'DS4.ItemTypeEquipment'}}

    {{!-- SPECIFIC --}} +

    {{localize 'DS4.ItemTypeEquipment'}}

      -
    1. -
      -
      -
      #
      {{!-- amount --}} -
      -
      {{localize 'DS4.ItemName'}}
      -
      {{localize 'DS4.StorageLocation'}}
      {{!-- SPECIFIC --}} -
      {{localize 'DS4.Description'}}
      - {{!-- add button --}} - -
    2. - {{#each itemsByType.equipment as |item id|}} {{!-- SPECIFIC --}} - {{#with item.data.data as |itemData|}} -
    3. -
      - {{!-- image --}} -
      - -
      - {{!-- amount --}} -
      {{itemData.quantity}}
      -
      - {{!-- name --}} -

      {{item.name}}

      - {{!-- storage location --}} -
      {{{itemData.storageLocation}}}
      {{!-- SPECIFIC --}} - {{!-- description --}} -
      {{{itemData.description}}}
      - {{!-- edit & delete buttons --}} -
      - - -
      -
    4. - {{/with}} + {{#> listHeader dataType='equipment'}} +
      {{localize 'DS4.StorageLocation'}}
      + {{/listHeader}} + {{#each itemsByType.equipment as |item id|}} + {{#> listEntry item=item }} +
      {{{item.data.data.storageLocation}}}
      + {{/listEntry}} {{/each}}
    \ No newline at end of file