diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.spec.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.spec.ts index a8cff716f04b..615483553973 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.spec.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.spec.ts @@ -1272,11 +1272,11 @@ describe('DotEditContentComponent', () => { }); spyOn(dotContentletEditorService, 'getActionUrl').and.returnValue( - of('/url/') + of('/url/test?_content_lang=23&test=random') ); spyOn(dotContentletEditorService, 'create').and.callFake((param) => { expect(param.data).toEqual({ - url: '/url/' + url: '/url/test?_content_lang=1&test=random' }); const event: any = { diff --git a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.ts b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.ts index 1aff42899a90..c48c41ac46d8 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.ts +++ b/core-web/apps/dotcms-ui/src/app/portlets/dot-edit-page/content/dot-edit-content.component.ts @@ -411,6 +411,7 @@ browse from the page internal links .getActionUrl($event.data.contentType.variable) .pipe(take(1)) .subscribe((url) => { + url = this.setCurrentContentLang(url); this.dotContentletEditorService.create({ data: { url }, events: { @@ -675,4 +676,18 @@ browse from the page internal links this.pageLanguageId = params['language_id']; }); } + + /** + * Sets the language parameter in the given URL and returns the concatenated pathname and search. + * the input URL doesn't include the host, origin is used as the base URL. + * + * @param {string} url - The input URL ( include pathname and search parameters). + * @returns {string} - The concatenated pathname and search parameters with the language parameter set. + */ + private setCurrentContentLang(url: string): string { + const newUrl = new URL(url, window.location.origin); + newUrl.searchParams.set('_content_lang', this.pageLanguageId); + + return newUrl.pathname + newUrl.search; + } } diff --git a/dotCMS/hotfix_tracking.md b/dotCMS/hotfix_tracking.md index 49b49f902409..f49635443f24 100644 --- a/dotCMS/hotfix_tracking.md +++ b/dotCMS/hotfix_tracking.md @@ -132,4 +132,5 @@ This maintenance release includes the following code fixes: 125. https://github.com/dotCMS/core/issues/28509 : Remove three dots at the end of the Bundle ID #28509 126. https://github.com/dotCMS/core/issues/28201 : AI Content Block inserts rich content as a single paragraph #28201 127. https://github.com/dotCMS/core/issues/26987 : Set Response Headers Rule Action does not allow double quotes in the value #26987 -128. https://github.com/dotCMS/core/issues/26477 : Search filter can't find/filter images #26477 \ No newline at end of file +128. https://github.com/dotCMS/core/issues/26477 : Search filter can't find/filter images #26477 +129. https://github.com/dotCMS/core/issues/27297 : Edit Page: Edit Contentlet Dialog Language Support #27297 \ No newline at end of file diff --git a/dotCMS/src/main/webapp/html/js/dotcms/dijit/form/ContentSelector.js b/dotCMS/src/main/webapp/html/js/dotcms/dijit/form/ContentSelector.js index 9b500fa34f4b..4a68413320ce 100644 --- a/dotCMS/src/main/webapp/html/js/dotcms/dijit/form/ContentSelector.js +++ b/dotCMS/src/main/webapp/html/js/dotcms/dijit/form/ContentSelector.js @@ -260,14 +260,26 @@ dojo.declare( if (dijit.byId('langcombo+' + this.dialogCounter)) { dijit.byId('langcombo+' + this.dialogCounter).destroy(); } + let selectedLang = null; + let options = '' this.availableLanguages = data; + + for (var i = 0; i < data.length; i++) { + options += "'; + } this.search_languages_table.innerHTML = ''; var htmlstr = "
"; htmlstr += "
'; htmlstr += '
'; dojo.require('dijit.form.FilteringSelect'); @@ -278,23 +290,19 @@ dojo.declare( this.dialogCounter + "'>"; - for (var i = 0; i < data.length; i++) { - htmlstr += "'; - } - + htmlstr += options; htmlstr += ''; htmlstr += '
'; htmlstr += '
'; dojo.place(htmlstr, this.search_languages_table); dojo.parser.parse(this.search_languages_table); + + let obj = dijit.byId('langcombo+' + this.dialogCounter); + + // Set the displayed value + if (selectedLang) { + obj.set('displayedValue', this._getCountryLabel(selectedLang)); + } }, _getSiteFolderFieldDefaultHTML: function (){ @@ -1556,6 +1564,10 @@ dojo.declare( return iconCode.substring(startIndex, endIndex); }, + _getCountryLabel: function (data) { + return data.language + (data.country === '' ? '' : ' - ' + data.country) + }, + _replaceWithIcon: function (parentElement, iconName) { parentElement.innerHTML = '