Hide the Create/Upload buttons when the user doesn't have that permission (closes #16)
This commit is contained in:
parent
177a7bb637
commit
4a2c40397f
5 changed files with 31 additions and 16 deletions
|
|
@ -187,7 +187,7 @@ export class ArtBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
single: this.selectMode === `single`,
|
||||
},
|
||||
can: {
|
||||
upload: true,
|
||||
upload: game.user.can(`FILES_UPLOAD`),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,6 +32,17 @@ export class ArtSidebar extends HandlebarsApplicationMixin(AbstractSidebarTab) {
|
|||
// #endregion Options
|
||||
|
||||
// #region Data Prep
|
||||
_prepareContext() {
|
||||
return {
|
||||
meta: {
|
||||
idp: this.id,
|
||||
},
|
||||
can: {
|
||||
upload: game.user.can(`FILES_UPLOAD`),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
async _preparePartContext(partID, ctx) {
|
||||
ctx = deepClone(ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ export class ArtistBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
idp: this.id,
|
||||
},
|
||||
can: {
|
||||
upload: true,
|
||||
upload: game.user.can(`FILES_UPLOAD`),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,11 +12,13 @@
|
|||
>
|
||||
{{ localize "IT.apps.ArtSidebar.view" }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
data-action="openApp"
|
||||
data-app="ArtistApp"
|
||||
>
|
||||
{{ localize "IT.apps.ArtSidebar.add-new" }}
|
||||
</button>
|
||||
{{#if can.upload}}
|
||||
<button
|
||||
type="button"
|
||||
data-action="openApp"
|
||||
data-app="ArtistApp"
|
||||
>
|
||||
{{ localize "IT.apps.ArtSidebar.add-new" }}
|
||||
</button>
|
||||
{{/if}}
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -12,11 +12,13 @@
|
|||
>
|
||||
{{ localize "IT.apps.ArtSidebar.view" }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
data-action="openApp"
|
||||
data-app="ImageApp"
|
||||
>
|
||||
{{ localize "IT.apps.ArtSidebar.add-new" }}
|
||||
</button>
|
||||
{{#if can.upload}}
|
||||
<button
|
||||
type="button"
|
||||
data-action="openApp"
|
||||
data-app="ImageApp"
|
||||
>
|
||||
{{ localize "IT.apps.ArtSidebar.add-new" }}
|
||||
</button>
|
||||
{{/if}}
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue