mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 06:26:13 +01:00
[Feature] RollTable Improvements (#1552)
* Initial - Branch Test * reorganized path for better usage * something to mess with * registration things * . * root-template error * pushing in for the day * hook? * help? * . * implementation initial * updated comment * overcomplicated it * . * Added Formula select to view mode * . * Prettied up roll-results template * Removed SRD table descriptions * Improved draw result description css * Fallback for default dark dice * . --------- Co-authored-by: Nikhil Nagarajan <potter.nikhil@gmail.com>
This commit is contained in:
parent
fdb6412c8c
commit
a78ef1f70c
20 changed files with 660 additions and 10 deletions
20
templates/sheets/rollTable/header.hbs
Normal file
20
templates/sheets/rollTable/header.hbs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<header class="sheet-header img-name">
|
||||
<img src="{{source.img}}" data-action="editImage" data-edit="img" alt="{{localize "DOCUMENT.FIELDS.img.label"}}">
|
||||
|
||||
<input type="text" name="name" value="{{source.name}}" placeholder="{{localize "DOCUMENT.FIELDS.name.label"}}" aria-label="{{localize "DOCUMENT.FIELDS.name.label"}}">
|
||||
{{#if usesAltFormula}}
|
||||
<div class="form-group">
|
||||
<label>{{localize "Formula"}}</label>
|
||||
<div class="form-fields">
|
||||
<select class="system-update-field" data-path="activeAltFormula">
|
||||
{{selectOptions this.altFormulaOptions selected=this.activeAltFormula labelAttr="name"}}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<button data-action="changeMode">
|
||||
<i class="fa-solid fa-eye" inert></i>
|
||||
<span>{{localize "TABLE.ACTIONS.ChangeMode.View"}}</span>
|
||||
</button>
|
||||
</header>
|
||||
55
templates/sheets/rollTable/results.hbs
Normal file
55
templates/sheets/rollTable/results.hbs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<section class="tab{{#if tab.active}} active{{/if}}" data-group="{{tab.group}}" data-tab="{{tab.id}}">
|
||||
<table class="flexcol" data-results>
|
||||
<thead>
|
||||
<tr class="flexrow">
|
||||
<th class="image flexrow">
|
||||
<button class="inline-control icon fa-solid fa-plus" data-action="createResult"
|
||||
data-tooltip aria-label="{{localize "TABLE.ACTIONS.CreateResult"}}"></button>
|
||||
</th>
|
||||
<th class="details flexrow">{{localize "TABLE_RESULT.Details"}}</th>
|
||||
<th class="weight flexrow">{{localize "TABLE_RESULT.FIELDS.weight.label"}}</th>
|
||||
<th class="range flexrow">{{localize "TABLE_RESULT.FIELDS.range.label"}}</th>
|
||||
<th class="controls flexrow">
|
||||
<button class="inline-control icon fa-solid fa-scale-balanced" data-action="normalizeResults"
|
||||
data-tooltip aria-label="{{localize "TABLE.ACTIONS.NormalizeResults"}}"></button>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="scrollable">
|
||||
{{#each results as |result i|}}
|
||||
<tr class="flexrow{{#if result.drawn}} drawn{{/if}}" data-result-id="{{result.id}}">
|
||||
<td class="image flexrow">
|
||||
<img src="{{result.displayImg}}" data-action="editImage" data-edit="results.{{i}}.img"
|
||||
alt="{{localize "TABLE_RESULT.FIELDS.img.label"}}" loading="lazy">
|
||||
</td>
|
||||
|
||||
<td class="details">
|
||||
{{> "templates/sheets/roll-table/result-details.hbs" result=result}}
|
||||
</td>
|
||||
|
||||
<td class="weight flexrow">
|
||||
<input type="number" name="results.{{i}}.weight" value="{{result.weight}}" placeholder="1">
|
||||
</td>
|
||||
|
||||
<td class="range flexrow">
|
||||
<input type="number" name="results.{{i}}.range.0" value="{{result.range.[0]}}" placeholder="L">
|
||||
<span class="dash">–</span>
|
||||
<input type="number" name="results.{{i}}.range.1" value="{{result.range.[1]}}" placeholder="H">
|
||||
</td>
|
||||
|
||||
<td class="controls flexrow">
|
||||
<button class="inline-control icon fa-solid fa-file-pen" data-action="openResultSheet"
|
||||
data-tooltip aria-label="{{localize "TABLE.ACTIONS.OpenResultConfig"}}"></button>
|
||||
<button class="inline-control icon fa-solid fa-lock{{#unless result.drawn}}-open{{/unless}}"
|
||||
data-action="lockResult"
|
||||
data-tooltip aria-label="{{localize "TABLE.ACTIONS.ToggleDrawn"}}"></button>
|
||||
<button class="inline-control icon fa-solid fa-trash" data-action="deleteResult"
|
||||
data-tooltip aria-label="{{localize "TABLE.ACTIONS.DeleteResult"}}"></button>
|
||||
</td>
|
||||
|
||||
<input type="hidden" name="results.{{i}}._id" value="{{result.id}}">
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
49
templates/sheets/rollTable/sheet.hbs
Normal file
49
templates/sheets/rollTable/sheet.hbs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<header class="sheet-header flexrow">
|
||||
<img src="{{document.img}}" alt="{{localize "DOCUMENT.FIELDS.img.label"}}">
|
||||
<h1>{{document.name}}</h1>
|
||||
<div class="roll-table-view-formula-container">
|
||||
{{#if usesAltFormula}}
|
||||
<select class="system-update-field" data-path="activeAltFormula">
|
||||
{{selectOptions this.altFormulaOptions selected=this.activeAltFormula labelAttr="name"}}
|
||||
</select>
|
||||
{{/if}}
|
||||
<h4>{{selectedFormula}}</h4>
|
||||
</div>
|
||||
<button data-action="changeMode">
|
||||
<i class="fa-solid fa-pen" inert></i>
|
||||
<span>{{localize "TABLE.ACTIONS.ChangeMode.Edit"}}</span>
|
||||
</button>
|
||||
</header>
|
||||
|
||||
{{{descriptionHTML}}}
|
||||
|
||||
<table class="flexcol" data-results>
|
||||
<thead>
|
||||
<tr class="flexrow">
|
||||
<th class="image flexrow"></th>
|
||||
<th class="range flexrow">{{localize "TABLE_RESULT.FIELDS.range.label"}}</th>
|
||||
<th class="details flexrow">{{localize "TABLE_RESULT.Details"}}</th>
|
||||
<th class="controls flexrow"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="scrollable">
|
||||
{{#each results as |result i|}}
|
||||
<tr class="flexrow{{#if result.drawn}} drawn{{/if}}" data-result-id="{{result.id}}">
|
||||
<td class="image">
|
||||
<img src="{{result.displayImg}}" alt="{{localize "TABLE_RESULT.FIELDS.img.label"}}" loading="lazy">
|
||||
</td>
|
||||
<td class="range">{{result.range}}</td>
|
||||
<td class="details">
|
||||
{{> "templates/sheets/roll-table/result-details.hbs" result=result}}
|
||||
</td>
|
||||
<td class="controls flexrow">
|
||||
<button class="inline-control icon fa-solid fa-lock{{#unless result.drawn}}-open{{/unless}}"
|
||||
data-action="lockResult"
|
||||
data-tooltip aria-label="{{localize "TABLE.ACTIONS.ToggleDrawn"}}"></button>
|
||||
<button class="inline-control icon fa-solid fa-up-from-bracket" data-action="drawSpecificResult"
|
||||
data-tooltip aria-label="{{localize "TABLE.ACTIONS.DrawSpecificResult"}}"></button>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
22
templates/sheets/rollTable/summary.hbs
Normal file
22
templates/sheets/rollTable/summary.hbs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<section class="tab{{#if tab.active}} active{{/if}}" data-group="{{tab.group}}" data-tab="{{tab.id}}">
|
||||
{{formGroup fields.description value=source.description rootId=rootId}}
|
||||
<fieldset class="formulas-section">
|
||||
<legend>{{localize "DAGGERHEART.ROLLTABLES.formula"}}</legend>
|
||||
|
||||
<div class="formulas-container">
|
||||
<span>{{localize "DAGGERHEART.ROLLTABLES.FIELDS.formulaName.label"}}</span>
|
||||
<span>{{localize "Formula Roll"}}</span>
|
||||
<span></span>
|
||||
<input type="text" value="{{@root.formulaName}}" class="system-update-field" data-path="formulaName" />
|
||||
{{formInput fields.formula value=source.formula placeholder=formulaPlaceholder rootId=rootId}}
|
||||
<button class="formula-button" data-action="addFormula"><i class="fa-solid fa-plus"></i></button>
|
||||
{{#each @root.altFormula as | formula key |}}
|
||||
<input type="text" value="{{formula.name}}" class="system-update-field" data-path="{{concat "altFormula." key ".name"}}" />
|
||||
<input type="text" value="{{formula.formula}}" class="system-update-field" data-path="{{concat "altFormula." key ".formula"}}" />
|
||||
<a class="formula-button" data-action="removeFormula" data-key="{{key}}"><i class="fa-solid fa-trash"></i></a>
|
||||
{{/each}}
|
||||
</div>
|
||||
</fieldset>
|
||||
{{formGroup fields.replacement value=source.replacement rootId=rootId}}
|
||||
{{formGroup fields.displayRoll value=source.displayRoll rootId=rootId}}
|
||||
</section>
|
||||
17
templates/ui/chat/table-result.hbs
Normal file
17
templates/ui/chat/table-result.hbs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<div class="table-draw" data-table-id="{{table.id}}">
|
||||
{{#if flavor}}<div class="table-flavor">{{flavor}}</div>{{/if}}
|
||||
|
||||
{{#if description}}
|
||||
<div class="table-description {{#if flavor}}flavor-spaced{{/if}}">{{{description}}}</div>
|
||||
{{/if}}
|
||||
{{{rollHTML}}}
|
||||
|
||||
<ul class="table-results">
|
||||
{{#each results as |result|}}
|
||||
<li class="flexrow" data-result-id="{{result.id}}">
|
||||
<img src="{{result.icon}}">
|
||||
{{{result.details}}}
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue