Skip to content

Simplify descriptions, labels and notification messages for publishing #19267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/Umbraco.Web.UI.Client/src/assets/lang/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export default {
saveAndPublish: 'Save and publish',
saveToPublish: 'Save and send for approval',
saveListView: 'Save list view',
schedulePublish: 'Schedule',
schedulePublish: 'Schedule publish',
saveAndPreview: 'Save and preview',
showPageDisabled: "Preview is disabled because there's no template assigned",
styleChoose: 'Choose style',
Expand Down Expand Up @@ -271,7 +271,7 @@ export default {
publishedPendingChanges: 'Published (pending changes)',
publishStatus: 'Publication Status',
publishDescendantsHelp:
'Publish <strong>%0%</strong> and all content items underneath and thereby making their content publicly available.',
'Publish <strong>%0%</strong> and all 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',
Expand Down Expand Up @@ -319,7 +319,7 @@ export default {
addTextBox: 'Add another text box',
removeTextBox: 'Remove this text box',
contentRoot: 'Content root',
includeUnpublished: 'Include unpublished content items.',
includeUnpublished: 'Include unpublished items.',
isSensitiveValue:
'This value is hidden. If you need access to view this value please contact your website administrator.',
isSensitiveValue_short: 'This value is hidden.',
Expand Down Expand Up @@ -348,6 +348,8 @@ export default {
variantUnpublishNotAllowed: 'Unpublish is not allowed',
selectAllVariants: 'Select all variants',
saveModalTitle: 'Save',
saveAndPublishModalTitle: 'Save and publish',
publishModalTitle: 'Publish',
},
blueprints: {
createBlueprintFrom: "Create a new Document Blueprint from '%0%'",
Expand Down Expand Up @@ -475,10 +477,11 @@ export default {
discardChanges: 'Discard changes',
unsavedChanges: 'Discard unsaved changes',
unsavedChangesWarning: 'Are you sure you want to navigate away from this page? You have unsaved changes',
confirmListViewPublish: 'Publishing will make the selected items visible on the site.',
confirmListViewUnpublish: 'Unpublishing will remove the selected items and all their descendants from the site.',
confirmPublish: 'Publishing will make this page and all its published descendants visible on the site.',
confirmUnpublish: 'Unpublishing will remove this page and all its descendants from the site.',
confirmListViewPublish: 'Publishing will make the selected items publicly available.',
confirmListViewUnpublish:
'Unpublishing will make the selected items and all their descendants publicly unavailable.',
confirmPublish: 'Publishing will make this content and all its published descendants publicly available.',
confirmUnpublish: 'Unpublishing will make this content publicly unavailable.',
doctypeChangeWarning: 'You have unsaved changes. Making changes to the Document Type will discard the changes.',
},
bulk: {
Expand Down Expand Up @@ -911,7 +914,7 @@ export default {
retrieve: 'Retrieve',
retry: 'Retry',
rights: 'Permissions',
scheduledPublishing: 'Scheduled Publishing',
scheduledPublishing: 'Schedule publish',
umbracoInfo: 'Umbraco info',
search: 'Search',
searchNoResult: 'Sorry, we can not find what you are looking for.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ export class UmbDocumentSaveModalElement extends UmbModalBaseElement<

override render() {
return html`<uui-dialog-layout headline=${this.localize.term('content_saveModalTitle')}>
<p id="subtitle">
<umb-localize key="content_variantsToSave">Choose which variants to be saved.</umb-localize>
</p>

<umb-document-variant-language-picker
.selectionManager=${this.#selectionManager}
.variantLanguageOptions=${this._options}
Expand All @@ -69,7 +65,7 @@ export class UmbDocumentSaveModalElement extends UmbModalBaseElement<
<div slot="actions">
<uui-button label=${this.localize.term('general_close')} @click=${this.#close}></uui-button>
<uui-button
label="${this.localize.term('buttons_saveAndClose')}"
label="${this.localize.term('buttons_save')}"
look="primary"
color="positive"
@click=${this.#submit}></uui-button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,26 +101,23 @@ export class UmbDocumentPublishModalElement extends UmbModalBaseElement<
}

override render() {
return html`<uui-dialog-layout headline=${this.localize.term('content_readyToPublish')}>
const headline = this.data?.headline ?? this.localize.term('content_publishModalTitle');

return html`<uui-dialog-layout headline=${headline}>
<p>
<umb-localize key="prompt_confirmPublish"></umb-localize>
</p>

${when(
!this._isInvariant,
() =>
html` <p id="subtitle">
<umb-localize key="content_variantsToPublish">Which variants would you like to publish?</umb-localize>
</p>
<umb-document-variant-language-picker
.selectionManager=${this.#selectionManager}
.variantLanguageOptions=${this._options}
.requiredFilter=${isNotPublishedMandatory}
.pickableFilter=${this.#pickableFilter}></umb-document-variant-language-picker>`,
html` <umb-document-variant-language-picker
.selectionManager=${this.#selectionManager}
.variantLanguageOptions=${this._options}
.requiredFilter=${isNotPublishedMandatory}
.pickableFilter=${this.#pickableFilter}></umb-document-variant-language-picker>`,
)}

<p>
<umb-localize key="prompt_confirmPublish">
Publishing will make this page and all its published descendants visible on the site.
</umb-localize>
</p>

<div slot="actions">
<uui-button label=${this.localize.term('general_close')} @click=${this.#close}></uui-button>
<uui-button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const UMB_DOCUMENT_PUBLISH_MODAL_ALIAS = 'Umb.Modal.DocumentPublish';

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface UmbDocumentPublishModalData extends UmbDocumentVariantPickerData {
headline?: string;
confirmLabel?: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,6 @@ export class UmbDocumentScheduleModalElement extends UmbModalBaseElement<

override render() {
return html`<uui-dialog-layout headline=${this.localize.term('general_scheduledPublishing')}>
<p id="subtitle">
${when(
this._options.length > 1,
() => html`
<umb-localize key="content_languagesToSchedule">Which languages would you like to schedule?</umb-localize>
`,
() => html`
<umb-localize key="content_schedulePublishHelp">
Select the date and time to publish and/or unpublish the content item.
</umb-localize>
`,
)}
</p>

${this.#renderOptions()}

<div slot="actions">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,28 +105,11 @@
}

if (!error) {
// If the content is invariant, we need to show a different notification
const isInvariant = options.length === 1 && options[0].culture === null;

if (isInvariant) {
notificationContext?.peek('positive', {
data: {
headline: localize.term('speechBubbles_editContentUnpublishedHeader'),
message: localize.term('speechBubbles_editContentUnpublishedText'),
},
});
} else {
const documentVariants = documentData.variants.filter((variant) => result.selection.includes(variant.culture!));
notificationContext?.peek('positive', {
data: {
headline: localize.term('speechBubbles_editContentUnpublishedHeader'),
message: localize.term(
'speechBubbles_editVariantUnpublishedText',
localize.list(documentVariants.map((v) => v.culture ?? v.name)),
),
},
});
}
notificationContext?.peek('positive', {
data: {
message: localize.term('speechBubbles_editContentUnpublishedHeader'),
},
});

Check notice on line 112 in src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/unpublish/entity-action/unpublish.action.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (release/16.0)

✅ Getting better: Complex Method

UmbUnpublishDocumentEntityAction.execute decreases in cyclomatic complexity from 31 to 28, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
const event = new UmbRequestReloadStructureForEntityEvent({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,28 +150,19 @@ export class UmbDocumentUnpublishModalElement extends UmbModalBaseElement<

override render() {
return html`<uui-dialog-layout headline=${this.localize.term('content_unpublish')}>
<p>
<umb-localize key="prompt_confirmUnpublish"></umb-localize>
</p>
${when(
!this._isInvariant,
() => html`
<p id="subtitle">
<umb-localize key="content_languagesToUnpublish">
Select the languages to unpublish. Unpublishing a mandatory language will unpublish all languages.
</umb-localize>
</p>
<umb-document-variant-language-picker
.selectionManager=${this._selectionManager}
.variantLanguageOptions=${this._options}
.requiredFilter=${this._hasInvalidSelection ? this._requiredFilter : undefined}
.pickableFilter=${this.#pickableFilter}></umb-document-variant-language-picker>
`,
)}

<p>
<umb-localize key="prompt_confirmUnpublish">
Unpublishing will remove this page and all its descendants from the site.
</umb-localize>
</p>

${this._referencesConfig
? html`<umb-confirm-action-modal-entity-references
.config=${this._referencesConfig}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ export class UmbDocumentPublishingWorkspaceContext extends UmbContextBase {
if (!error) {
notificationContext?.peek('positive', {
data: {
headline: localize.term('publish_publishAll', primaryVariantName),
message: localize.term('publish_nodePublishAll', primaryVariantName),
},
});
Expand Down Expand Up @@ -308,6 +307,7 @@ export class UmbDocumentPublishingWorkspaceContext extends UmbContextBase {
// If there are multiple variants, we will open the modal to let the user pick which variants to publish.
const result = await umbOpenModal(this, UMB_DOCUMENT_PUBLISH_MODAL, {
data: {
headline: this.#localize.term('content_saveAndPublishModalTitle'),
options,
pickableFilter: this.#publishableVariantsFilter,
},
Expand Down Expand Up @@ -364,15 +364,9 @@ export class UmbDocumentPublishingWorkspaceContext extends UmbContextBase {
);

if (!error) {
const variants = saveData.variants.filter((v) => variantIds.some((id) => id.culture === v.culture));
this.#notificationContext?.peek('positive', {
data: {
headline: this.#localize.term('speechBubbles_editContentPublishedHeader'),
message: this.#localize.term(
'speechBubbles_editVariantPublishedText',
// TODO: use correct variant names instead of variant strings [MR]
this.#localize.list(variants.map((v) => UmbVariantId.Create(v).toString() ?? v.name)),
),
message: this.#localize.term('speechBubbles_editContentPublishedHeader'),
},
});

Expand Down
Loading