Begin work on the most basic item sheet version
This commit is contained in:
parent
f91c3d2419
commit
2518c7cf05
6 changed files with 120 additions and 0 deletions
47
module/apps/GenericItemSheet.mjs
Normal file
47
module/apps/GenericItemSheet.mjs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { __ID__, filePath } from "../consts.mjs";
|
||||
|
||||
const { HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
const { ItemSheetV2 } = foundry.applications.sheets;
|
||||
|
||||
export class GenericItemSheet extends HandlebarsApplicationMixin(ItemSheetV2) {
|
||||
// #region Options
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: [
|
||||
__ID__,
|
||||
`GenericItemSheet`,
|
||||
],
|
||||
position: {
|
||||
width: 400,
|
||||
height: 450,
|
||||
},
|
||||
window: {
|
||||
resizable: true,
|
||||
},
|
||||
form: {
|
||||
submitOnChange: true,
|
||||
closeOnSubmit: false,
|
||||
},
|
||||
actions: {},
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
header: { template: filePath(`templates/GenericItemSheet/header.hbs`) },
|
||||
content: { template: filePath(`templates/GenericItemSheet/content.hbs`) },
|
||||
};
|
||||
// #endregion Options
|
||||
|
||||
// #region Instance Data
|
||||
// #endregion Instance Data
|
||||
|
||||
// #region Lifecycle
|
||||
async _prepareContext(partID) {
|
||||
return {
|
||||
item: this.item,
|
||||
system: this.item.system,
|
||||
};
|
||||
};
|
||||
// #endregion Lifecycle
|
||||
|
||||
// #region Actions
|
||||
// #endregion Actions
|
||||
};
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
import { AttributeOnlyPlayerSheet } from "../apps/AttributeOnlyPlayerSheet.mjs";
|
||||
import { PlayerSheet } from "../apps/PlayerSheet.mjs";
|
||||
import { SingleModePlayerSheet } from "../apps/SingleModePlayerSheet.mjs";
|
||||
import { GenericItemSheet } from "../apps/GenericItemSheet.mjs";
|
||||
|
||||
// Data Models
|
||||
import { PlayerData } from "../data/Player.mjs";
|
||||
|
|
@ -25,13 +26,18 @@ import { registerSockets } from "../sockets/_index.mjs";
|
|||
Hooks.on(`init`, () => {
|
||||
Logger.debug(`Initializing`);
|
||||
|
||||
// #region Documents
|
||||
CONFIG.Token.documentClass = TAFTokenDocument;
|
||||
CONFIG.Actor.documentClass = TAFActor;
|
||||
CONFIG.Combatant.documentClass = TAFCombatant;
|
||||
// #endregion Documents
|
||||
|
||||
// #region Data Models
|
||||
CONFIG.Actor.dataModels.player = PlayerData;
|
||||
CONFIG.Item.dataModels.generic = GenericItemData;
|
||||
// #endregion Data Models
|
||||
|
||||
// #region Sheets
|
||||
foundry.documents.collections.Actors.registerSheet(
|
||||
__ID__,
|
||||
PlayerSheet,
|
||||
|
|
@ -51,6 +57,16 @@ Hooks.on(`init`, () => {
|
|||
{ label: `taf.sheet-names.AttributeOnlyPlayerSheet` },
|
||||
);
|
||||
|
||||
foundry.documents.collections.Items.registerSheet(
|
||||
__ID__,
|
||||
GenericItemSheet,
|
||||
{
|
||||
makeDefault: true,
|
||||
label: `taf.sheet-names.GenericItemSheet`,
|
||||
},
|
||||
);
|
||||
// #endregion Sheets
|
||||
|
||||
registerWorldSettings();
|
||||
|
||||
registerSockets();
|
||||
|
|
|
|||
18
styles/Apps/GenericItemSheet.css
Normal file
18
styles/Apps/GenericItemSheet.css
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
.taf.GenericItemSheet {
|
||||
.bordered {
|
||||
border-radius: 8px;
|
||||
border: 1px solid rebeccapurple;
|
||||
}
|
||||
|
||||
.sheet-header {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr min-content 75px;
|
||||
gap: 4px;
|
||||
align-items: center;
|
||||
padding: 4px;
|
||||
|
||||
img {
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -24,6 +24,7 @@
|
|||
@import url("./Apps/common.css") layer(apps);
|
||||
@import url("./Apps/Ask.css") layer(apps);
|
||||
@import url("./Apps/AttributeManager.css") layer(apps);
|
||||
@import url("./Apps/GenericItemSheet.css") layer(apps);
|
||||
@import url("./Apps/PlayerSheet.css") layer(apps);
|
||||
@import url("./Apps/QueryStatus.css") layer(apps);
|
||||
@import url("./Apps/TAFDocumentSheetConfig.css") layer(apps);
|
||||
|
|
|
|||
13
templates/GenericItemSheet/content.hbs
Normal file
13
templates/GenericItemSheet/content.hbs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<div>
|
||||
<label>
|
||||
Equipped
|
||||
<input type="checkbox" name="system.equipped">
|
||||
</label>
|
||||
<label>
|
||||
Weight
|
||||
<input type="number" name="system.weight">
|
||||
</label>
|
||||
<prose-mirror
|
||||
name="system.description"
|
||||
></prose-mirror>
|
||||
</div>
|
||||
25
templates/GenericItemSheet/header.hbs
Normal file
25
templates/GenericItemSheet/header.hbs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<header class="sheet-header bordered">
|
||||
<img
|
||||
src="{{item.img}}"
|
||||
data-action="editImage"
|
||||
data-edit="img"
|
||||
title="{{item.name}}"
|
||||
height="48"
|
||||
width="48"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
name="name"
|
||||
class="large"
|
||||
value="{{item.name}}"
|
||||
placeholder="{{localize "Name"}}"
|
||||
>
|
||||
<span aria-hidden="true">x</span>
|
||||
<input
|
||||
type="number"
|
||||
name="system.quantity"
|
||||
value="{{system.quantity}}"
|
||||
data-tooltip
|
||||
aria-label="Quantity"
|
||||
>
|
||||
</header>
|
||||
Loading…
Add table
Add a link
Reference in a new issue