Skip to content

Commit 667c8a6

Browse files
committed
PR review fixes
1 parent 84e9a4d commit 667c8a6

File tree

13 files changed

+131
-196
lines changed

13 files changed

+131
-196
lines changed

modules/app/src/main/resources/admin/widgets/preview-site-engine/preview-site-engine.js

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ exports.get = function (req) {
3737
if (params.mode === 'inline' || params.mode === 'edit') {
3838
// we handle that on the client in inline and edit modes
3939
return widgetLib.widgetResponse(200, data);
40-
} else {
41-
// in other modes we leave it to browser to handle the redirect
42-
return widgetLib.redirectResponse(url, data);
4340
}
41+
42+
// in other modes we leave it to browser to handle the redirect
43+
return widgetLib.redirectResponse(url, data);
44+
4445
} catch (e) {
4546
log.error(`Site [${req.method}] error: ${e.message}`);
4647
return widgetLib.widgetResponse(500);
@@ -55,11 +56,7 @@ exports.canRender = function (req) {
5556
return false;
5657
}
5758

58-
if (params.type === SHORTCUT_TYPE || params.archive) {
59-
return false;
60-
}
61-
62-
return true;
59+
return params.type !== SHORTCUT_TYPE && !params.archive;
6360
}
6461

6562
function createUrl(req, params) {
@@ -76,8 +73,7 @@ function collectResponseData(req, params, url) {
7673
const messages = [];
7774
const i18n = widgetLib.i18nFn(req);
7875

79-
const appsMissing = hasMissingApps(appKeys);
80-
if (appsMissing) {
76+
if (hasMissingApps(appKeys)) {
8177
messages.push(i18n('field.preview.missing.description'));
8278
}
8379

@@ -88,7 +84,7 @@ function collectResponseData(req, params, url) {
8884

8985
return {
9086
messages: messages.length ? messages : undefined,
91-
hasControllers: /*!params.auto &&*/ hasControllers,
87+
hasControllers,
9288
hasPage: isPageOrFragment,
9389
redirect: url
9490
}
@@ -111,32 +107,6 @@ function hasAvailableControllers(params, appKeys) {
111107
});
112108
}
113109

114-
function hasSupportingTemplates(site, params) {
115-
if (!site) {
116-
return false;
117-
}
118-
119-
return widgetLib.queryContent(params, {
120-
contentTypes: [TEMPLATE_TYPE],
121-
query: '_path LIKE "/content' + site._path + '*"',
122-
count: 3,
123-
filters: {
124-
boolean: {
125-
must: [
126-
{
127-
hasValue: {
128-
field: "data.supports",
129-
values: [
130-
params.type
131-
]
132-
}
133-
}
134-
]
135-
}
136-
}
137-
}).total > 0;
138-
}
139-
140110
function hasPageOrFragment(params) {
141111
const content = widgetLib.fetchContent(params.repository, params.branch, params.id || params.path, params.archive);
142112

modules/app/src/main/resources/lib/export/widget.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,10 @@ function fetchSite(repository, branch, key, archive) {
122122
try {
123123
if (key) {
124124
return contentLib.getSite({key});
125-
} else {
126-
return portalLib.getSite();
127125
}
126+
127+
return portalLib.getSite();
128+
128129
} catch (e) {
129130
log.error(`Failed to fetch site: ${e.message}`);
130131
return null;

modules/lib/src/main/resources/assets/js/app/event/ViewWidgetEvent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {Widget} from '@enonic/lib-admin-ui/content/Widget';
55
export class ViewWidgetEvent
66
extends Event {
77

8-
private widget: Widget;
8+
private readonly widget: Widget;
99

1010
constructor(widget: Widget) {
1111
super();

modules/lib/src/main/resources/assets/js/app/view/ContentItemPreviewPanel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class ContentItemPreviewPanel
9393
const contentSummary = item.getContentSummary();
9494
const widget = (this.toolbar as ContentItemPreviewToolbar).getWidgetSelector().getSelectedWidget();
9595

96-
return this.widgetRenderingHandler.renderWithWidget(contentSummary, widget);
96+
return this.widgetRenderingHandler.render(contentSummary, widget);
9797
}
9898

9999
public isItemRenderable(): Q.Promise<boolean> {

0 commit comments

Comments
 (0)