Skip to content

Commit 2073199

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/trashed-context
2 parents c0416c9 + 9513c92 commit 2073199

File tree

16 files changed

+236
-252
lines changed

16 files changed

+236
-252
lines changed

.github/localization_overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ Then we need your help! With Bellissima we added new localization keys, and we s
201201
- documentationHeader
202202
- documentationDescription
203203
- communityHeader
204+
- communityDescription
204205
- trainingHeader
205206
- trainingDescription
206207
- supportHeader

src/apps/app/app.element.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class UmbAppElement extends UmbLitElement {
7474
this.#authContext?.completeAuthorizationRequest().finally(() => {
7575
// If we don't have an opener, redirect to the root
7676
if (!window.opener) {
77-
//history.replaceState(null, '', '');
77+
history.replaceState(null, '', '');
7878
}
7979
});
8080
},
@@ -195,6 +195,15 @@ export class UmbAppElement extends UmbLitElement {
195195
}
196196

197197
#redirect() {
198+
const pathname = pathWithoutBasePath({ start: true, end: false });
199+
200+
// If we are on the oauth_complete or error page, we should not redirect
201+
if (pathname === '/oauth_complete' || pathname === '/error') {
202+
// Initialize the router
203+
history.replaceState(null, '', location.href);
204+
return;
205+
}
206+
198207
switch (this.#serverConnection?.getStatus()) {
199208
case RuntimeLevelModel.INSTALL:
200209
history.replaceState(null, '', 'install');
@@ -209,8 +218,6 @@ export class UmbAppElement extends UmbLitElement {
209218
break;
210219

211220
case RuntimeLevelModel.RUN: {
212-
const pathname = pathWithoutBasePath({ start: true, end: false });
213-
214221
// If we are on installer or upgrade page, redirect to the root since we are in the RUN state
215222
if (pathname === '/install' || pathname === '/upgrade') {
216223
history.replaceState(null, '', '/');

src/assets/lang/da-dk.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2466,10 +2466,11 @@ export default {
24662466
},
24672467
settingsDashboard: {
24682468
communityHeader: 'Community',
2469+
communityDescription: 'Stil et spørgsmål i community forummet eller i vores Discord community',
24692470
trainingHeader: 'Træning',
24702471
trainingDescription: 'Se mulighederne for real-life træning og certificering',
24712472
supportHeader: 'Support',
2472-
supportDescription: 'Stil et spørgsmål i community forummet eller i vores Discord community',
2473+
supportDescription: 'Udvid dit team med en højt kvalificeret og passioneret flok Umbraco-vidende mennesker.',
24732474
videosHeader: 'Videoer',
24742475
videosDescription:
24752476
'Se vores gratis tutortial videoer på Umbraco Learning Base YouTube-kanel, for hurtigt at komme i gang med Umbraco.',

src/assets/lang/en-us.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2307,10 +2307,12 @@ export default {
23072307
documentationHeader: 'Documentation',
23082308
documentationDescription: 'Read more about working with the items in Settings in our Documentation.',
23092309
communityHeader: 'Community',
2310+
communitytDescription: 'Ask a question in the community forum or our Discord community.',
2311+
23102312
trainingHeader: 'Training',
23112313
trainingDescription: 'Find out about real-life training and certification opportunities',
23122314
supportHeader: 'Support',
2313-
supportDescription: 'Ask a question in the community forum or our Discord community.',
2315+
supportDescription: 'Extend your team with a highly skilled and passionate bunch of Umbraco know-it-alls.',
23142316
videosHeader: 'Videos',
23152317
videosDescription:
23162318
'Watch our free tutorial videos on the Umbraco Learning Base YouTube channel, to get up to speed quickly with Umbraco.',

src/assets/lang/en.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2381,10 +2381,11 @@ export default {
23812381
documentationHeader: 'Documentation',
23822382
documentationDescription: 'Read more about working with the items in Settings in our Documentation.',
23832383
communityHeader: 'Community',
2384+
communityDescription: 'Ask a question in the community forum or our Discord community.',
23842385
trainingHeader: 'Training',
23852386
trainingDescription: 'Find out about real-life training and certification opportunities',
23862387
supportHeader: 'Support',
2387-
supportDescription: 'Ask a question in the community forum or our Discord community.',
2388+
supportDescription: 'Extend your team with a highly skilled and passionate bunch of Umbraco know-it-alls',
23882389
videosHeader: 'Videos',
23892390
videosDescription:
23902391
'Watch our free tutorial videos on the Umbraco Learning Base YouTube channel, to get up to speed quickly with Umbraco.',

src/packages/core/auth/auth.context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ export class UmbAuthContext extends UmbContextBase<UmbAuthContext> {
258258
}
259259

260260
getRedirectUrl() {
261-
return `${window.location.origin}${this.#backofficePath}oauth_complete`;
261+
return `${window.location.origin}${this.#backofficePath}${this.#backofficePath.endsWith('/') ? '' : '/'}oauth_complete`;
262262
}
263263

264264
getPostLogoutRedirectUrl() {
265-
return `${window.location.origin}${this.#backofficePath.endsWith('/') ? this.#backofficePath : this.#backofficePath + '/'}logout`;
265+
return `${window.location.origin}${this.#backofficePath}${this.#backofficePath.endsWith('/') ? '' : '/'}logout`;
266266
}
267267
}

src/packages/core/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export * from './input-radio-button-list/index.js';
2525
export * from './input-slider/index.js';
2626
export * from './input-toggle/index.js';
2727
export * from './input-upload-field/index.js';
28+
export * from './input-with-alias/input-with-alias.element.js';
2829
export * from './multiple-color-picker-input/index.js';
2930
export * from './multiple-text-string-input/index.js';
3031
export * from './popover-layout/index.js';

src/packages/core/components/input-slider/input-slider.element.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { html, customElement, property } from '@umbraco-cms/backoffice/external/
22
import { UUIFormControlMixin } from '@umbraco-cms/backoffice/external/uui';
33
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
44
import type { UUISliderEvent } from '@umbraco-cms/backoffice/external/uui';
5+
import { UmbChangeEvent } from '@umbraco-cms/backoffice/event';
56

67
@customElement('umb-input-slider')
78
export class UmbInputSliderElement extends UUIFormControlMixin(UmbLitElement, '') {
@@ -30,7 +31,7 @@ export class UmbInputSliderElement extends UUIFormControlMixin(UmbLitElement, ''
3031
#onChange(e: UUISliderEvent) {
3132
e.stopPropagation();
3233
this.value = e.target.value as string;
33-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
34+
this.dispatchEvent(new UmbChangeEvent());
3435
}
3536

3637
render() {
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
import { css, customElement, html, nothing, property, state } from '@umbraco-cms/backoffice/external/lit';
2+
import { UmbChangeEvent } from '@umbraco-cms/backoffice/event';
3+
import { UmbFormControlMixin } from '@umbraco-cms/backoffice/validation';
4+
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
5+
import { type UUIInputElement, UUIInputEvent } from '@umbraco-cms/backoffice/external/uui';
6+
import { generateAlias } from '@umbraco-cms/backoffice/utils';
7+
8+
@customElement('umb-input-with-alias')
9+
export class UmbInputWithAliasElement extends UmbFormControlMixin<string>(UmbLitElement) {
10+
@property({ type: String })
11+
label: string = '';
12+
13+
@property({ type: String, reflect: false })
14+
alias?: string;
15+
16+
@property({ type: Boolean, reflect: true, attribute: 'alias-readonly' })
17+
aliasReadonly = false;
18+
19+
@property({ type: Boolean, attribute: 'auto-generate-alias' })
20+
autoGenerateAlias?: boolean;
21+
22+
@state()
23+
private _aliasLocked = true;
24+
25+
firstUpdated() {
26+
this.shadowRoot?.querySelectorAll<UUIInputElement>('uui-input').forEach((x) => this.addFormControlElement(x));
27+
}
28+
29+
focus() {
30+
return this.shadowRoot?.querySelector<UUIInputElement>('uui-input')?.focus();
31+
}
32+
33+
#onNameChange(event: UUIInputEvent) {
34+
if (event instanceof UUIInputEvent) {
35+
const target = event.composedPath()[0] as UUIInputElement;
36+
37+
if (typeof target?.value === 'string') {
38+
const oldName = this.value;
39+
const oldAlias = this.alias ?? '';
40+
this.value = event.target.value.toString();
41+
if (this.autoGenerateAlias && this._aliasLocked) {
42+
// If locked we will update the alias, but only if it matches the generated alias of the old name [NL]
43+
const expectedOldAlias = generateAlias(oldName ?? '');
44+
// Only update the alias if the alias matches a generated alias of the old name (otherwise the alias is considered one written by the user.) [NL]
45+
if (expectedOldAlias === oldAlias) {
46+
this.alias = generateAlias(this.value);
47+
}
48+
}
49+
this.dispatchEvent(new UmbChangeEvent());
50+
}
51+
}
52+
}
53+
54+
#onAliasChange(e: UUIInputEvent) {
55+
if (event instanceof UUIInputEvent) {
56+
const target = event.composedPath()[0] as UUIInputElement;
57+
if (typeof target?.value === 'string') {
58+
this.alias = target.value;
59+
this.dispatchEvent(new UmbChangeEvent());
60+
}
61+
}
62+
e.stopPropagation();
63+
}
64+
65+
#onToggleAliasLock() {
66+
this._aliasLocked = !this._aliasLocked;
67+
}
68+
69+
render() {
70+
// Localizations: [NL]
71+
return html`
72+
<uui-input id="name" label=${this.label} .value=${this.value} @input="${this.#onNameChange}">
73+
<!-- TODO: should use UUI-LOCK-INPUT, but that does not fire an event when its locked/unlocked -->
74+
<uui-input
75+
name="alias"
76+
slot="append"
77+
label="alias"
78+
@input=${this.#onAliasChange}
79+
.value=${this.alias}
80+
placeholder="Enter alias..."
81+
?disabled=${this._aliasLocked && !this.aliasReadonly}
82+
?readonly=${this.aliasReadonly}>
83+
<!-- TODO: validation for bad characters -->
84+
${this.aliasReadonly
85+
? nothing
86+
: html`<div @click=${this.#onToggleAliasLock} @keydown=${() => ''} id="alias-lock" slot="prepend">
87+
<uui-icon name=${this._aliasLocked ? 'icon-lock' : 'icon-unlocked'}></uui-icon>
88+
</div>`}
89+
</uui-input>
90+
</uui-input>
91+
`;
92+
}
93+
94+
static styles = css`
95+
#name {
96+
width: 100%;
97+
flex: 1 1 auto;
98+
align-items: center;
99+
}
100+
101+
:host(:invalid:not([pristine])) {
102+
color: var(--uui-color-danger);
103+
}
104+
:host(:invalid:not([pristine])) > uui-input {
105+
border-color: var(--uui-color-danger);
106+
}
107+
108+
#alias-lock {
109+
display: flex;
110+
align-items: center;
111+
justify-content: center;
112+
cursor: pointer;
113+
}
114+
115+
#alias-lock uui-icon {
116+
margin-bottom: 2px;
117+
}
118+
`;
119+
}
120+
121+
export default UmbInputWithAliasElement;
122+
123+
declare global {
124+
interface HTMLElementTagNameMap {
125+
'umb-input-with-alias': UmbInputWithAliasElement;
126+
}
127+
}

src/packages/core/settings/welcome-dashboard/settings-welcome-dashboard.element.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class UmbSettingsWelcomeDashboardElement extends UmbLitElement {
2525
<uui-box>
2626
<h1 class="uui-h3"><umb-localize key="settingsDashboard_communityHeader">Community</umb-localize></h1>
2727
<p>
28-
<umb-localize key="settingsDashboard_supportDescription">
28+
<umb-localize key="settingsDashboard_communityDescription">
2929
Ask a question in the community forum or our Discord community
3030
</umb-localize>
3131
</p>
@@ -64,7 +64,7 @@ export class UmbSettingsWelcomeDashboardElement extends UmbLitElement {
6464
6565
<p>
6666
<umb-localize key="settingsDashboard_supportDescription">
67-
Ask a question in the community forum or our Discord community.
67+
Extend your team with a highly skilled and passionate bunch of Umbraco know-it-alls
6868
</umb-localize>
6969
</p>
7070
<uui-button

0 commit comments

Comments
 (0)