Call a hook to get all of the sidebar controls
This commit is contained in:
parent
eac23400a8
commit
8c9fd1930a
2 changed files with 29 additions and 15 deletions
|
|
@ -38,6 +38,26 @@ export class StatSidebar extends HandlebarsApplicationMixin(AbstractSidebarTab)
|
||||||
|
|
||||||
ctx.tableCount = db.getTables().length;
|
ctx.tableCount = db.getTables().length;
|
||||||
|
|
||||||
|
const controls = {
|
||||||
|
openStats: { label: `View Stats`, action: `openStats` },
|
||||||
|
createTable: { label: `Create New Table`, action: `createTable` },
|
||||||
|
manageTables: { label: `Manage Tables`, action: `` },
|
||||||
|
manageData: { label: `Manage Data`, action: `` },
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!game.user.isGM) {
|
||||||
|
delete controls.createTable;
|
||||||
|
delete controls.manageTables;
|
||||||
|
};
|
||||||
|
|
||||||
|
const canManageTheirOwnData = false;
|
||||||
|
if (!game.user.isGM && !canManageTheirOwnData) {
|
||||||
|
delete controls.manageData;
|
||||||
|
};
|
||||||
|
|
||||||
|
Hooks.callAll(`${__ID__}.getStatsSidebarControls`, controls);
|
||||||
|
ctx.controls = Object.values(controls);
|
||||||
|
|
||||||
return ctx;
|
return ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,19 +19,13 @@
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h4 class="divider">Apps</h4>
|
<h4 class="divider">Controls</h4>
|
||||||
|
{{#each controls as | btn |}}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
data-action="openStats"
|
data-action="{{ btn.action }}"
|
||||||
>
|
>
|
||||||
View Statistics
|
{{ btn.label }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
{{/each}}
|
||||||
type="button"
|
|
||||||
data-action="createTable"
|
|
||||||
>
|
|
||||||
Create New Table
|
|
||||||
</button>
|
|
||||||
<button type="button">Manage Tables</button>
|
|
||||||
<button type="button">Manage Rows</button>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue