RC-96 | Add Boolean inputs for the item forms
This commit is contained in:
parent
5c78523791
commit
fe90172656
4 changed files with 45 additions and 1 deletions
32
module/handlebarHelpers/inputs/booleanInput.mjs
Normal file
32
module/handlebarHelpers/inputs/booleanInput.mjs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { localizer } from "../../utils/Localizer.mjs";
|
||||
|
||||
const { randomID } = foundry.utils;
|
||||
|
||||
export function booleanInput(input, data) {
|
||||
const label = localizer(input.label);
|
||||
const id = `${data.meta.idp}-${randomID(10)}`;
|
||||
|
||||
if (data.meta.limited) {
|
||||
return `<div data-input-type="boolean">
|
||||
<span class="label">${label}</span>
|
||||
<div>
|
||||
<span class="value">???</span>
|
||||
</div>
|
||||
</div>`;
|
||||
};
|
||||
|
||||
return `<div data-input-type="boolean">
|
||||
<label for="${id}">
|
||||
${label}
|
||||
</label>
|
||||
<div class="checkbox-container">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="${id}"
|
||||
${input.value ? `checked` : ``}
|
||||
name="${input.path}"
|
||||
${data.meta.editable ? `` : `disabled`}
|
||||
>
|
||||
</div>
|
||||
</div>`;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue