Skip to content

Commit a4017e6

Browse files
authored
Feature: block 'draft' tag (#17640)
* not-yet-exposed * add tag * implement id for expose button * implement tag for grid * style * use plus icon in rte blocks * empty commit
1 parent 0a56aaa commit a4017e6

File tree

12 files changed

+79
-21
lines changed

12 files changed

+79
-21
lines changed

src/Umbraco.Web.UI.Client/src/assets/lang/da-dk.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,12 +1284,12 @@ export default {
12841284
rollbackTo: 'Tilbagerulning til',
12851285
selectVersion: 'Vælg version',
12861286
view: 'Vis',
1287-
created: 'Created',
1288-
currentVersion: 'Current version',
1287+
created: 'Oprettet',
1288+
currentVersion: 'Nuværende version',
12891289
pagination: 'Showing version %0% to %1% of %2% versions',
1290-
versions: 'Versions',
1291-
currentDraftVersion: 'Current draft version',
1292-
currentPublishedVersion: 'Current published version',
1290+
versions: 'Versioner',
1291+
currentDraftVersion: 'Nuværende kladde version',
1292+
currentPublishedVersion: 'Nuværende udgivet version',
12931293
},
12941294
scripts: {
12951295
editscript: 'Rediger script',
@@ -2368,6 +2368,8 @@ export default {
23682368
variantName ? `Opret ${name} for ${variantName}` : `Create ${name}`,
23692369
insertBlock: 'Indsæt Block',
23702370
labelInlineMode: 'Indsæt på linje med tekst',
2371+
notExposedLabel: 'ikke oprettet',
2372+
notExposedDescription: 'Denne Block er endnu ikke oprettet for denne variant',
23712373
},
23722374
contentTemplatesDashboard: {
23732375
whatHeadline: 'Hvad er Indholdsskabeloner?',

src/Umbraco.Web.UI.Client/src/assets/lang/en-us.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,6 +2533,8 @@ export default {
25332533
variantName ? `Create ${name} for ${variantName}` : `Create ${name}`,
25342534
insertBlock: 'Insert Block',
25352535
labelInlineMode: 'Display inline with text',
2536+
notExposedLabel: 'Draft',
2537+
notExposedDescription: 'This Block is not yet created for this variant',
25362538
},
25372539
contentTemplatesDashboard: {
25382540
whatHeadline: 'What are Document Blueprints?',

src/Umbraco.Web.UI.Client/src/assets/lang/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2579,6 +2579,8 @@ export default {
25792579
variantName ? `Create ${name} for ${variantName}` : `Create ${name}`,
25802580
insertBlock: 'Insert Block',
25812581
labelInlineMode: 'Display inline with text',
2582+
notExposedLabel: 'Draft',
2583+
notExposedDescription: 'This Block is not yet created for this variant',
25822584
},
25832585
contentTemplatesDashboard: {
25842586
whatHeadline: 'What are Document Blueprints?',

src/Umbraco.Web.UI.Client/src/packages/block/block-grid/components/block-grid-block-inline/block-grid-block-inline.element.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { UMB_BLOCK_GRID_ENTRY_CONTEXT } from '../../context/block-grid-entry.con
22
import type { UmbBlockGridWorkspaceOriginData } from '../../workspace/block-grid-workspace.modal-token.js';
33
import { UMB_BLOCK_GRID_ENTRIES_CONTEXT } from '../../context/block-grid-entries.context-token.js';
44
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
5-
import { css, customElement, html, property, state } from '@umbraco-cms/backoffice/external/lit';
5+
import { css, customElement, html, nothing, property, state } from '@umbraco-cms/backoffice/external/lit';
66
import type { UmbPropertyTypeModel } from '@umbraco-cms/backoffice/content-type';
77
import '../block-grid-areas-container/index.js';
88
import '../ref-grid-block/index.js';
@@ -172,6 +172,11 @@ export class UmbBlockGridBlockInlineElement extends UmbLitElement {
172172
<umb-ufm-render id="name" inline .markdown=${this.label} .value=${this.content}></umb-ufm-render>
173173
</div>
174174
</span>
175+
${this.unpublished
176+
? html`<uui-tag slot="name" look="secondary" title=${this.localize.term('blockEditor_notExposedDescription')}
177+
><umb-localize key="blockEditor_notExposedLabel"></umb-localize
178+
></uui-tag>`
179+
: nothing}
175180
`;
176181
}
177182

@@ -205,7 +210,7 @@ export class UmbBlockGridBlockInlineElement extends UmbLitElement {
205210
206211
#exposeButton {
207212
width: 100%;
208-
min-height: var(--uui-size-layout-3);
213+
min-height: var(--uui-size-16);
209214
}
210215
211216
#host {
@@ -239,7 +244,7 @@ export class UmbBlockGridBlockInlineElement extends UmbLitElement {
239244
border-color: var(--uui-color-disabled-standalone);
240245
}
241246
242-
:host([unpublished]) #open-part {
247+
:host([unpublished]) #open-part #content {
243248
opacity: 0.6;
244249
}
245250
@@ -305,6 +310,13 @@ export class UmbBlockGridBlockInlineElement extends UmbLitElement {
305310
font-weight: 700;
306311
}
307312
313+
uui-tag {
314+
margin-left: 0.5em;
315+
margin-bottom: -0.3em;
316+
margin-top: -0.3em;
317+
vertical-align: text-top;
318+
}
319+
308320
:host(:not([disabled])) #open-part:hover #icon {
309321
color: var(--uui-color-interactive-emphasis);
310322
}

src/Umbraco.Web.UI.Client/src/packages/block/block-grid/components/block-grid-block/block-grid-block.element.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
2-
import { css, customElement, html, property } from '@umbraco-cms/backoffice/external/lit';
2+
import { css, customElement, html, nothing, property } from '@umbraco-cms/backoffice/external/lit';
33
import type { UmbBlockDataType } from '@umbraco-cms/backoffice/block';
44
import type { UmbBlockEditorCustomViewConfiguration } from '@umbraco-cms/backoffice/block-custom-view';
55

@@ -31,6 +31,11 @@ export class UmbBlockGridBlockElement extends UmbLitElement {
3131
href=${(this.config?.showContentEdit ? this.config?.editContentPath : undefined) ?? ''}>
3232
<umb-icon slot="icon" .name=${this.icon}></umb-icon>
3333
<umb-ufm-render slot="name" inline .markdown=${this.label} .value=${this.content}></umb-ufm-render>
34+
${this.unpublished
35+
? html`<uui-tag slot="name" look="secondary" title=${this.localize.term('blockEditor_notExposedDescription')}
36+
><umb-localize key="blockEditor_notExposedLabel"></umb-localize
37+
></uui-tag>`
38+
: nothing}
3439
<umb-block-grid-areas-container slot="areas"></umb-block-grid-areas-container>
3540
</umb-ref-grid-block>`;
3641
}
@@ -43,6 +48,13 @@ export class UmbBlockGridBlockElement extends UmbLitElement {
4348
umb-block-grid-areas-container::part(area) {
4449
margin: var(--uui-size-2);
4550
}
51+
52+
uui-tag {
53+
margin-left: 0.5em;
54+
margin-bottom: -0.3em;
55+
margin-top: -0.3em;
56+
vertical-align: text-top;
57+
}
4658
:host([unpublished]) umb-icon,
4759
:host([unpublished]) umb-ufm-render {
4860
opacity: 0.6;

src/Umbraco.Web.UI.Client/src/packages/block/block-grid/components/block-grid-entry/block-grid-entry.element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper
511511
look="secondary"
512512
color=${this._contentInvalid ? 'danger' : ''}
513513
href=${this._workspaceEditContentPath}>
514-
<uui-icon name="icon-edit"></uui-icon>
514+
<uui-icon name=${this._exposed === false ? 'icon-add' : 'icon-edit'}></uui-icon>
515515
${this._contentInvalid
516516
? html`<uui-badge attention color="danger" label="Invalid content">!</uui-badge>`
517517
: nothing}

src/Umbraco.Web.UI.Client/src/packages/block/block-grid/components/ref-grid-block/ref-grid-block.element.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ export class UmbRefGridBlockElement extends UUIRefNodeElement {
3232
3333
#open-part {
3434
display: flex;
35-
min-height: var(
36-
--uui-size-layout-2
37-
); /* TODO: We should not do this, but it is a quick fix for now to ensure that the top part of a block gets a minimum height. */
35+
min-height: var(--uui-size-16);
36+
padding: calc(var(--uui-size-2) + 1px);
3837
}
3938
4039
:host([unpublished]) #open-part {

src/Umbraco.Web.UI.Client/src/packages/block/block-list/components/block-list-entry/block-list-entry.element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ export class UmbBlockListEntryElement extends UmbLitElement implements UmbProper
345345
look="secondary"
346346
color=${this._contentInvalid ? 'danger' : ''}
347347
href=${this._workspaceEditContentPath}>
348-
<uui-icon name="icon-edit"></uui-icon>
348+
<uui-icon name=${this._exposed === false ? 'icon-add' : 'icon-edit'}></uui-icon>
349349
${this._contentInvalid
350350
? html`<uui-badge attention color="danger" label="Invalid content">!</uui-badge>`
351351
: nothing}

src/Umbraco.Web.UI.Client/src/packages/block/block-list/components/inline-list-block/inline-list-block.element.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
type UmbApiConstructorArgumentsMethodType,
1111
} from '@umbraco-cms/backoffice/extension-api';
1212
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
13-
import { css, customElement, html, property, state } from '@umbraco-cms/backoffice/external/lit';
13+
import { css, customElement, html, nothing, property, state } from '@umbraco-cms/backoffice/external/lit';
1414
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
1515
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
1616

@@ -153,7 +153,7 @@ export class UmbInlineListBlockElement extends UmbLitElement {
153153
<slot></slot>
154154
<slot name="tag"></slot>
155155
</button>
156-
${this._isOpen === true ? this.#renderInside() : ''}
156+
${this._isOpen === true ? this.#renderInside() : nothing}
157157
</div>
158158
`;
159159
}
@@ -168,12 +168,17 @@ export class UmbInlineListBlockElement extends UmbLitElement {
168168
<umb-ufm-render id="name" inline .markdown=${this.label} .value=${this.content}></umb-ufm-render>
169169
</div>
170170
</span>
171+
${this.unpublished
172+
? html`<uui-tag slot="name" look="secondary" title=${this.localize.term('blockEditor_notExposedDescription')}
173+
><umb-localize key="blockEditor_notExposedLabel"></umb-localize
174+
></uui-tag>`
175+
: nothing}
171176
`;
172177
}
173178

174179
#renderInside() {
175180
if (this._exposed === false) {
176-
return html`<uui-button style="position:absolute; inset:0;" @click=${this.#expose}
181+
return html`<uui-button id="exposeButton" @click=${this.#expose}
177182
><uui-icon name="icon-add"></uui-icon>
178183
<umb-localize
179184
key="blockEditor_createThisFor"
@@ -201,6 +206,12 @@ export class UmbInlineListBlockElement extends UmbLitElement {
201206
202207
min-width: 250px;
203208
}
209+
210+
#exposeButton {
211+
width: 100%;
212+
min-height: var(--uui-size-16);
213+
}
214+
204215
#open-part + * {
205216
border-top: 1px solid var(--uui-color-border);
206217
}
@@ -218,7 +229,7 @@ export class UmbInlineListBlockElement extends UmbLitElement {
218229
border-color: var(--uui-color-disabled-standalone);
219230
}
220231
221-
:host([unpublished]) #open-part {
232+
:host([unpublished]) #open-part #content {
222233
opacity: 0.6;
223234
}
224235
@@ -284,6 +295,13 @@ export class UmbInlineListBlockElement extends UmbLitElement {
284295
font-weight: 700;
285296
}
286297
298+
uui-tag {
299+
margin-left: 0.5em;
300+
margin-bottom: -0.3em;
301+
margin-top: -0.3em;
302+
vertical-align: text-top;
303+
}
304+
287305
:host(:not([disabled])) #open-part:hover #icon {
288306
color: var(--uui-color-interactive-emphasis);
289307
}

src/Umbraco.Web.UI.Client/src/packages/block/block-list/components/ref-list-block/ref-list-block.element.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { css, customElement, html, property } from '@umbraco-cms/backoffice/external/lit';
1+
import { css, customElement, html, nothing, property } from '@umbraco-cms/backoffice/external/lit';
22
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
33
import type { UmbBlockDataType } from '@umbraco-cms/backoffice/block';
44

@@ -28,6 +28,11 @@ export class UmbRefListBlockElement extends UmbLitElement {
2828
<uui-ref-node standalone href=${(this.config?.showContentEdit ? this.config?.editContentPath : undefined) ?? ''}>
2929
<umb-icon slot="icon" .name=${this.icon}></umb-icon>
3030
<umb-ufm-render slot="name" inline .markdown=${this.label} .value=${this.content}></umb-ufm-render>
31+
${this.unpublished
32+
? html`<uui-tag slot="name" look="secondary" title=${this.localize.term('blockEditor_notExposedDescription')}
33+
><umb-localize key="blockEditor_notExposedLabel"></umb-localize
34+
></uui-tag>`
35+
: nothing}
3136
</uui-ref-node>
3237
`;
3338
}
@@ -37,6 +42,12 @@ export class UmbRefListBlockElement extends UmbLitElement {
3742
uui-ref-node {
3843
min-height: var(--uui-size-16);
3944
}
45+
uui-tag {
46+
margin-left: 0.5em;
47+
margin-bottom: -0.3em;
48+
margin-top: -0.3em;
49+
vertical-align: text-top;
50+
}
4051
:host([unpublished]) umb-icon,
4152
:host([unpublished]) umb-ufm-render {
4253
opacity: 0.6;

0 commit comments

Comments
 (0)