From 493a831ccc7754d08eda65e23ae564b71368a0f4 Mon Sep 17 00:00:00 2001 From: Humberto Morera Date: Tue, 6 Feb 2024 09:04:12 -0600 Subject: [PATCH 1/3] add contentType param + clickable label --- .../form/content-types-form.component.html | 10 ++++++++-- .../ext/contentlet/view_contentlets_js_inc.jsp | 17 +++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/core-web/apps/dotcms-ui/src/app/portlets/shared/dot-content-types-edit/components/form/content-types-form.component.html b/core-web/apps/dotcms-ui/src/app/portlets/shared/dot-content-types-edit/components/form/content-types-form.component.html index 2ca5a97e8cc3..f02c1f1ce65d 100644 --- a/core-web/apps/dotcms-ui/src/app/portlets/shared/dot-content-types-edit/components/form/content-types-form.component.html +++ b/core-web/apps/dotcms-ui/src/app/portlets/shared/dot-content-types-edit/components/form/content-types-form.component.html @@ -8,9 +8,15 @@ class="content-type__new-content-banner" *ngIf="newContentEditorEnabled" data-test-id="content-type__new-content-banner"> - + - +
diff --git a/dotCMS/src/main/webapp/html/portlet/ext/contentlet/view_contentlets_js_inc.jsp b/dotCMS/src/main/webapp/html/portlet/ext/contentlet/view_contentlets_js_inc.jsp index 00697cb31829..262b4ad6ed03 100644 --- a/dotCMS/src/main/webapp/html/portlet/ext/contentlet/view_contentlets_js_inc.jsp +++ b/dotCMS/src/main/webapp/html/portlet/ext/contentlet/view_contentlets_js_inc.jsp @@ -395,13 +395,14 @@ final String calendarEventInode = null!=calendarEventSt ? calendarEventSt.inode( var permissions = data["permissions"]; var write = userHasWritePermission (data, userId)?"1":"0"; var structure_id = data["structureInode"]; + var typeVariable = data["typeVariable"]; var editRef = ''; if(structure_id == '<%=calendarEventInode %>'){ editRef = " editEvent('" + inode + "','<%=user.getUserId()%>','<%= referer %>'," + liveSt + "," + workingSt + "," + write + ") "; }else{ - editRef = " editContentlet('" + inode + "','<%=user.getUserId()%>','<%= referer %>'," + liveSt + "," + workingSt + "," + write + ") "; + editRef = " editContentlet('" + inode + "','<%=user.getUserId()%>','<%= referer %>'," + liveSt + "," + workingSt + "," + write + ", ,'" + typeVariable + "') "; } var ref = ""; @@ -1930,11 +1931,12 @@ final String calendarEventInode = null!=calendarEventSt ? calendarEventSt.inode( var liveSt = data.live === "true" ? "1" : "0"; var workingSt = data.working === "true" ? "1" : "0"; var write = userHasWritePermission (data, userId) ? "1" : "0"; + var typeVariable = data.typeVariable; if (data.structureInode == '<%=calendarEventInode %>') { editEvent(inode, '<%=user.getUserId()%>', '<%= referer %>', liveSt, workingSt, write); }else{ - editContentlet(inode, '<%=user.getUserId()%>', '<%= referer %>', liveSt, workingSt, write); + editContentlet(inode, '<%=user.getUserId()%>', '<%= referer %>', liveSt, workingSt, write, typeVariable); } }; @@ -1954,6 +1956,7 @@ final String calendarEventInode = null!=calendarEventSt ? calendarEventSt.inode( const contentStructureType = data["contentStructureType"]; const structure_id = data["structureInode"]; const hasLiveVersion = data["hasLiveVersion"]; + const typeVariable = data.typeVariable; const contentAdmin = new dotcms.dijit.contentlet.ContentAdmin(data.identifier, data.inode, data.languageId); const wfActionMapList = JSON.parse(data["wfActionMapList"]); @@ -1965,7 +1968,7 @@ final String calendarEventInode = null!=calendarEventSt ? calendarEventSt.inode( }); } else { actions.push({ label: write === '1' ? '<%=LanguageUtil.get(pageContext, "Edit") %>' : '<%=LanguageUtil.get(pageContext, "View") %>', - action: () => { editContentlet(data.inode, '<%= user.getUserId() %>', '<%= referer %>', liveSt, workingSt, write)} + action: () => { editContentlet(data.inode, '<%= user.getUserId() %>', '<%= referer %>', liveSt, workingSt, write, typeVariable)} }); } } @@ -2086,6 +2089,7 @@ final String calendarEventInode = null!=calendarEventSt ? calendarEventSt.inode( var wfActionMapList; var structure_id; var contentStructureType; + var typeVariable; cbContentInodeList = data; @@ -2130,6 +2134,7 @@ final String calendarEventInode = null!=calendarEventSt ? calendarEventSt.inode( write = userHasWritePermission (cellData, userId)?"1":"0"; publish = userHasPublishPermission (cellData, userId)?"1":"0"; contentStructureType = cellData["contentStructureType"]; + typeVariable = cellData["typeVariable"]; structure_id = cellData["structureInode"]; hasLiveVersion = cellData["hasLiveVersion"]; holderDiv.setAttribute('data-inode', cellData["inode"]); @@ -2138,7 +2143,7 @@ final String calendarEventInode = null!=calendarEventSt ? calendarEventSt.inode( holderDiv.setAttribute('data-write', write); holderDiv.addEventListener('click', function(e){ let dataSet = e.currentTarget.dataset; - editContentlet(dataSet["inode"],'<%= user.getUserId() %>','<%= referer %>', dataSet["live"] , dataSet["working"] , dataSet["write"] ); + editContentlet(dataSet["inode"],'<%= user.getUserId() %>','<%= referer %>', dataSet["live"] , dataSet["working"] , dataSet["write"], dataSet["typeVariable"] ); }, false); @@ -2239,9 +2244,9 @@ final String calendarEventInode = null!=calendarEventSt ? calendarEventSt.inode( } }else{ if (write=="1"){ - popupMenuItems += "
','<%= referer %>'," + liveSt + "," + workingSt + "," + write + ");\"><%=LanguageUtil.get(pageContext, "Edit") %>
"; + popupMenuItems += "
','<%= referer %>'," + liveSt + "," + workingSt + "," + write + ",'" + typeVariable + "');\"><%=LanguageUtil.get(pageContext, "Edit") %>
"; }else{ - popupMenuItems += "
','<%= referer %>'," + liveSt + "," + workingSt + "," + write + ");\"><%=LanguageUtil.get(pageContext, "View") %>
"; + popupMenuItems += "
','<%= referer %>'," + liveSt + "," + workingSt + "," + write + ",'" + typeVariable + "');\"><%=LanguageUtil.get(pageContext, "View") %>
"; } } } From e410ecb3326c02b878bb12630a43ad295a6277c1 Mon Sep 17 00:00:00 2001 From: Humberto Morera Date: Tue, 6 Feb 2024 09:31:59 -0600 Subject: [PATCH 2/3] send contentType correctly and update test --- .../dot-edit-content-form.component.html | 2 +- .../dot-edit-content-form.component.spec.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form.component.html b/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form.component.html index fc9ea2c025f2..74815ef7efb9 100644 --- a/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form.component.html +++ b/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form.component.html @@ -19,7 +19,7 @@ *ngFor="let field of column.fields" [field]="field" [contentlet]="formData.contentlet" - [contentType]="formData.contentType" + [contentType]="formData.contentType.variable" data-testId="field" />
diff --git a/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form.component.spec.ts b/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form.component.spec.ts index 52a1eb7ea9aa..4140b6256615 100644 --- a/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form.component.spec.ts +++ b/core-web/libs/edit-content/src/lib/components/dot-edit-content-form/dot-edit-content-form.component.spec.ts @@ -89,6 +89,10 @@ describe('DotFormComponent', () => { const fields = spectator.queryAll(DotEditContentFieldComponent); JUST_FIELDS_MOCKS.forEach((field, index) => { expect(fields[index].field).toEqual(field); + expect(fields[index].contentType).toEqual( + CONTENT_FORM_DATA_MOCK.contentType.variable + ); + expect(fields[index].contentlet).toEqual(CONTENT_FORM_DATA_MOCK.contentlet); }); }); From a350837520bf7cf11e6bc73ae195380e67a44330 Mon Sep 17 00:00:00 2001 From: Humberto Morera Date: Tue, 6 Feb 2024 10:48:53 -0600 Subject: [PATCH 3/3] cover event content type and click on thumbnail in table listing --- .../ext/contentlet/view_contentlets_js_inc.jsp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dotCMS/src/main/webapp/html/portlet/ext/contentlet/view_contentlets_js_inc.jsp b/dotCMS/src/main/webapp/html/portlet/ext/contentlet/view_contentlets_js_inc.jsp index 262b4ad6ed03..6dd00d7f57ba 100644 --- a/dotCMS/src/main/webapp/html/portlet/ext/contentlet/view_contentlets_js_inc.jsp +++ b/dotCMS/src/main/webapp/html/portlet/ext/contentlet/view_contentlets_js_inc.jsp @@ -400,9 +400,9 @@ final String calendarEventInode = null!=calendarEventSt ? calendarEventSt.inode( var editRef = ''; if(structure_id == '<%=calendarEventInode %>'){ - editRef = " editEvent('" + inode + "','<%=user.getUserId()%>','<%= referer %>'," + liveSt + "," + workingSt + "," + write + ") "; + editRef = " editEvent('" + inode + "','<%=user.getUserId()%>','<%= referer %>'," + liveSt + "," + workingSt + "," + write + ", '" + typeVariable + "') "; }else{ - editRef = " editContentlet('" + inode + "','<%=user.getUserId()%>','<%= referer %>'," + liveSt + "," + workingSt + "," + write + ", ,'" + typeVariable + "') "; + editRef = " editContentlet('" + inode + "','<%=user.getUserId()%>','<%= referer %>'," + liveSt + "," + workingSt + "," + write + ", '" + typeVariable + "') "; } var ref = ""; @@ -1934,7 +1934,7 @@ final String calendarEventInode = null!=calendarEventSt ? calendarEventSt.inode( var typeVariable = data.typeVariable; if (data.structureInode == '<%=calendarEventInode %>') { - editEvent(inode, '<%=user.getUserId()%>', '<%= referer %>', liveSt, workingSt, write); + editEvent(inode, '<%=user.getUserId()%>', '<%= referer %>', liveSt, workingSt, write, typeVariable); }else{ editContentlet(inode, '<%=user.getUserId()%>', '<%= referer %>', liveSt, workingSt, write, typeVariable); } @@ -1964,7 +1964,7 @@ final String calendarEventInode = null!=calendarEventSt ? calendarEventSt.inode( if ((live || working) && (read=="1") && (!deleted)) { if(structure_id == '<%=calendarEventInode %>'){ actions.push({ label: write === '1' ? '<%=LanguageUtil.get(pageContext, "Edit") %>' : '<%=LanguageUtil.get(pageContext, "View") %>', - action: () => { editEvent(data.inode, '<%= user.getUserId() %>', '<%= referer %>', liveSt, workingSt, write)} + action: () => { editEvent(data.inode, '<%= user.getUserId() %>', '<%= referer %>', liveSt, workingSt, write, typeVariable)} }); } else { actions.push({ label: write === '1' ? '<%=LanguageUtil.get(pageContext, "Edit") %>' : '<%=LanguageUtil.get(pageContext, "View") %>', @@ -2141,9 +2141,10 @@ final String calendarEventInode = null!=calendarEventSt ? calendarEventSt.inode( holderDiv.setAttribute('data-live', liveSt); holderDiv.setAttribute('data-working', workingSt); holderDiv.setAttribute('data-write', write); + holderDiv.setAttribute('data-typevariable', typeVariable); holderDiv.addEventListener('click', function(e){ let dataSet = e.currentTarget.dataset; - editContentlet(dataSet["inode"],'<%= user.getUserId() %>','<%= referer %>', dataSet["live"] , dataSet["working"] , dataSet["write"], dataSet["typeVariable"] ); + editContentlet(dataSet["inode"],'<%= user.getUserId() %>','<%= referer %>', dataSet["live"] , dataSet["working"] , dataSet["write"], dataSet["typevariable"] ); }, false); @@ -2238,9 +2239,9 @@ final String calendarEventInode = null!=calendarEventSt ? calendarEventSt.inode( if ((live || working) && (read=="1") && (!deleted)) { if(structure_id == '<%=calendarEventInode %>'){ if (write=="1"){ - popupMenuItems += "
','<%= referer %>'," + liveSt + "," + workingSt + "," + write + ");\"><%=LanguageUtil.get(pageContext, "Edit") %>
"; + popupMenuItems += "
','<%= referer %>'," + liveSt + "," + workingSt + "," + write + ",'" + typeVariable + "');\"><%=LanguageUtil.get(pageContext, "Edit") %>
"; }else{ - popupMenuItems += "
','<%= referer %>'," + liveSt + "," + workingSt + "," + write + ");\"><%=LanguageUtil.get(pageContext, "View") %>
"; + popupMenuItems += "
','<%= referer %>'," + liveSt + "," + workingSt + "," + write + ",'" + typeVariable + "');\"><%=LanguageUtil.get(pageContext, "View") %>
"; } }else{ if (write=="1"){