-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af96582
commit 0321ae6
Showing
20 changed files
with
1,174 additions
and
522 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 4 additions & 17 deletions
21
src/main/resources/admin/widgets/siteimprove/siteimprove.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,8 @@ | ||
<widget data-th-id="${'widget-' + widgetId}"> | ||
<link rel="stylesheet" data-th-href="${portal.assetUrl({'_path=styles/siteimprove.css'})}" type="text/css" media="all"/> | ||
<script data-th-src="${portal.assetUrl({'_path=js/siteimprove.js'})}"></script> | ||
<div class="siteimprove"></div> | ||
<script data-th-if="${!hasError}" data-th-src="${portal.assetUrl({'_path=js/siteimprove.js'})}" data-th-attr="data-config-service-url=${configServiceUrl}, data-content-id=${contentId}"></script> | ||
<div class="siteimprove"> | ||
<div data-th-if="${hasError}" class="error" data-th-text="${errorMessage}"></div> | ||
</div> | ||
|
||
</widget> | ||
|
||
<script data-th-inline="javascript"> | ||
/*<![CDATA[*/ | ||
var SITEIMPROVE = { | ||
config: { | ||
widgetId: [[${widgetId}]], | ||
errorMessage: [[${errorMessage}]], | ||
vhost: [[${vhost}]], | ||
contentPath: [[${contentPath}]], | ||
services: [[${services}]] | ||
} | ||
}; | ||
|
||
/*]]>*/ | ||
</script> |
48 changes: 10 additions & 38 deletions
48
src/main/resources/admin/widgets/siteimprove/siteimprove.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
src/main/resources/assets/js/widget/SiteimproveWidgetConfig.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const contentLib = require('/lib/xp/content'); | ||
const portalLib = require('/lib/xp/portal'); | ||
|
||
function handleGet(req) { | ||
let contentId = req.params.contentId; | ||
let content; | ||
let site; | ||
let siteConfig; | ||
let pageId = -1; | ||
let contentPath; | ||
|
||
if (!contentId) { | ||
const content = portalLib.getContent(); | ||
if (content) { | ||
contentId = content._id; | ||
} | ||
} | ||
|
||
if (contentId) { | ||
content = contentLib.get({key: contentId}); | ||
site = contentLib.getSite({key: contentId}); | ||
contentPath = site ? content._path.slice(content._path.indexOf(site._name) - 1) : content._path; | ||
siteConfig = contentLib.getSiteConfig({key: contentId, applicationKey: app.name}); | ||
if (siteConfig) { | ||
pageId = (content.type.indexOf(':site') === -1 && site) ? content._path.replace(site._path, '') : ''; | ||
} | ||
} | ||
|
||
return { | ||
status: 200, | ||
contentType: 'application/json', | ||
body: { | ||
widgetId: app.name, | ||
contentPath, | ||
pageId, | ||
vhost: siteConfig ? siteConfig.vhost : '', | ||
services: { | ||
sitesUrl: portalLib.serviceUrl({service: 'sites'}), | ||
pagesUrl: portalLib.serviceUrl({service: 'pages'}), | ||
dciOverviewUrl: portalLib.serviceUrl({service: 'dcioverview'}), | ||
pageSummaryUrl: portalLib.serviceUrl({service: 'pagesummary'}), | ||
crawlStatusUrl: portalLib.serviceUrl({service: 'crawlstatus'}), | ||
crawlUrl: portalLib.serviceUrl({service: 'crawl'}), | ||
checkStatusUrl: portalLib.serviceUrl({service: 'checkstatus'}), | ||
checkUrl: portalLib.serviceUrl({service: 'check'}), | ||
checkByUrlUrl: portalLib.serviceUrl({service: 'checkbyurl'}), | ||
linksUrl: portalLib.serviceUrl({service: 'links'}), | ||
checkUrlExistsUrl: portalLib.serviceUrl({service: 'checkurlexists'}) | ||
} | ||
} | ||
}; | ||
} | ||
|
||
exports.get = handleGet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<service> | ||
<allow> | ||
<principal>role:system.authenticated</principal> | ||
</allow> | ||
</service> |
Oops, something went wrong.