show a box if there are no variants

This commit is contained in:
Jacob Overgaard
2024-03-18 11:56:34 +01:00
parent 7e038d4a17
commit 5f63a1d424
2 changed files with 20 additions and 15 deletions

View File

@@ -255,6 +255,7 @@ export default {
'Publish <strong>%0%</strong> and all content items underneath and thereby making their content publicly available.',
publishDescendantsWithVariantsHelp:
'Publish variants and variants of same type underneath and thereby making their content publicly available.',
noVariantsToProcess: 'There are no available variants',
releaseDate: 'Publish at',
unpublishDate: 'Unpublish at',
removeDate: 'Clear Date',

View File

@@ -30,21 +30,25 @@ export class UmbDocumentVariantLanguagePickerElement extends UmbLitElement {
_selection: Array<string> = [];
render() {
return repeat(
this.variantLanguageOptions,
(option) => option.unique,
(option) => html`
<uui-menu-item
selectable
label=${option.variant?.name ?? option.language.name}
@selected=${() => this.selectionManager.select(option.unique)}
@deselected=${() => this.selectionManager.deselect(option.unique)}
?selected=${this._selection.includes(option.unique)}>
<uui-icon slot="icon" name="icon-globe"></uui-icon>
${UmbDocumentVariantLanguagePickerElement.renderLabel(option)}
</uui-menu-item>
`,
);
return this.variantLanguageOptions.length
? repeat(
this.variantLanguageOptions,
(option) => option.unique,
(option) => html`
<uui-menu-item
selectable
label=${option.variant?.name ?? option.language.name}
@selected=${() => this.selectionManager.select(option.unique)}
@deselected=${() => this.selectionManager.deselect(option.unique)}
?selected=${this._selection.includes(option.unique)}>
<uui-icon slot="icon" name="icon-globe"></uui-icon>
${UmbDocumentVariantLanguagePickerElement.renderLabel(option)}
</uui-menu-item>
`,
)
: html`<uui-box>
<umb-localize key="content_noVariantsToProcess">There are no available variants</umb-localize>
</uui-box>`;
}
static renderLabel(option: UmbDocumentVariantOptionModel) {