Merge branch '005_item_editing' into 'master'

005 item editing

See merge request dungeonslayers/ds4!4
This commit is contained in:
Johannes Loher 2020-12-28 21:52:18 +01:00
commit aa0c4741d2
15 changed files with 84 additions and 114 deletions

View file

@ -1,6 +1,7 @@
{
"DS4.Description": "Description",
"DS4.Details": "Details",
"DS4.Effects": "Effects",
"DS4.AttackType": "Attack Type",
"DS4.AttackTypeAbbr": "AT",
"DS4.WeaponBonus": "Weapon Bonus",
@ -12,13 +13,15 @@
"DS4.AttackTypeMeleeRanged": "Melee / Ranged",
"DS4.Quantity": "Quantity",
"DS4.PriceGold": "Price (Gold)",
"DS4.StorageLocation": "Stored at",
"DS4.ItemAvailability": "Availability",
"DS4.ItemAvailabilityHamlet": "Hamlet",
"DS4.ItemAvailabilityVilage": "Village",
"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",

View file

@ -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",
},
/**

View file

@ -31,7 +31,12 @@ 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",
"systems/ds4/templates/item/partials/body.hbs",
];
return loadTemplates(templatePaths);
}

View file

@ -26,7 +26,8 @@ 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;
}
interface DS4ItemEquipable {

View file

@ -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);
}
}

View file

@ -46,7 +46,8 @@
"physical": {
"quantity": 1,
"price": 0,
"availability": "none"
"availability": "unset",
"storageLocation": "-"
},
"equipable": {
"equipped": false

View file

@ -34,21 +34,6 @@
</div>
</header>
{{!-- 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="details">{{localize "DS4.Details"}}</a>
</nav>
{{!-- Sheet Body --}}
<section class="sheet-body">
{{!-- 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>
</section>
{{!-- Common Item body --}}
{{> systems/ds4/templates/item/partials/body.hbs}}
</form>

View file

@ -7,21 +7,6 @@
</div>
</header>
{{!-- 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="details">{{localize "DS4.Details"}}</a>
</nav>
{{!-- Sheet Body --}}
<section class="sheet-body">
{{!-- 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>
</section>
{{!-- Common Item body --}}
{{> systems/ds4/templates/item/partials/body.hbs}}
</form>

View file

@ -0,0 +1,22 @@
{{!-- Template for the common body (navigation & body sections) of all items. --}}
{{!-- 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>
{{!-- Sheet Body --}}
<section class="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}}
</section>

View file

@ -4,12 +4,16 @@
<label for="data.quantity">{{localize "DS4.Quantity"}}</label>
<input type="number" data-dtype="Number" name="data.quantity" value="{{data.quantity}}" />
</div>
<div class="side-property">
<label for="data.storageLocation">{{localize "DS4.StorageLocation"}}</label>
<input type="text" data-dtype="String" name="data.storageLocation" value="{{data.storageLocation}}" />
</div>
<div class="side-property">
<label for="data.price">{{localize "DS4.PriceGold"}}</label>
<input type="number" data-dtype="Number" name="data.price" value="{{data.price}}" />
</div>
<div class="side-property">
<label for="data.price">{{localize "DS4.ItemAvailability"}}</label>
<label for="data.availability">{{localize "DS4.ItemAvailability"}}</label>
<select name="data.availability" data-type="String">
{{#select data.availability}}
{{#each config.itemAvailabilities as |value key|}}
@ -18,7 +22,6 @@
{{/select}}
</select>
</div>
</div>
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>

View file

@ -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>

View file

@ -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>

View file

@ -14,21 +14,6 @@
</div>
</header>
{{!-- 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="details">{{localize "DS4.Details"}}</a>
</nav>
{{!-- Sheet Body --}}
<section class="sheet-body">
{{!-- 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>
</section>
{{!-- Common Item body --}}
{{> systems/ds4/templates/item/partials/body.hbs}}
</form>

View file

@ -7,39 +7,6 @@
</div>
</header>
{{!-- 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="details">{{localize "DS4.Details"}}</a>
</nav>
{{!-- Sheet Body --}}
<section class="sheet-body">
{{!-- 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>
</section>
{{!-- Common Item body --}}
{{> systems/ds4/templates/item/partials/body.hbs}}
</form>

View file

@ -29,21 +29,6 @@
</div>
</header>
{{!-- 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="details">{{localize "DS4.Details"}}</a>
</nav>
{{!-- Sheet Body --}}
<section class="sheet-body">
{{!-- 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>
</section>
{{!-- Common Item body --}}
{{> systems/ds4/templates/item/partials/body.hbs}}
</form>