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;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -19,19 +19,13 @@
|
|||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="divider">Apps</h4>
|
||||
<button
|
||||
type="button"
|
||||
data-action="openStats"
|
||||
>
|
||||
View Statistics
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
data-action="createTable"
|
||||
>
|
||||
Create New Table
|
||||
</button>
|
||||
<button type="button">Manage Tables</button>
|
||||
<button type="button">Manage Rows</button>
|
||||
<h4 class="divider">Controls</h4>
|
||||
{{#each controls as | btn |}}
|
||||
<button
|
||||
type="button"
|
||||
data-action="{{ btn.action }}"
|
||||
>
|
||||
{{ btn.label }}
|
||||
</button>
|
||||
{{/each}}
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue