Skip to content
Snippets Groups Projects
Commit f676f9fb authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire: Committed by Reiter, Christoph
Browse files

Add new api-url attribute

parent 7dd236d5
No related branches found
No related tags found
No related merge requests found
......@@ -37,11 +37,11 @@ class KnowledgeBaseWebPageElementViewDemo extends LitElement {
</div>
<div class="content">
<h2 class="subtitle">Deutsch</h2>
<vpu-knowledge-base-web-page-element-view lang="de" value="bedienstete/bibliothek/buch-ausleihen"></vpu-knowledge-base-web-page-element-view>
<vpu-knowledge-base-web-page-element-view api-url="${utils.getAPiUrl()}" lang="de" value="bedienstete/bibliothek/buch-ausleihen"></vpu-knowledge-base-web-page-element-view>
</div>
<div class="content">
<h2 class="subtitle">Englisch</h2>
<vpu-knowledge-base-web-page-element-view lang="en" value="bedienstete/bibliothek/buch-ausleihen"></vpu-knowledge-base-web-page-element-view>
<vpu-knowledge-base-web-page-element-view api-url="${utils.getAPiUrl()}" lang="en" value="bedienstete/bibliothek/buch-ausleihen"></vpu-knowledge-base-web-page-element-view>
</div>
</section>
`;
......
......@@ -15,6 +15,7 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement {
this.lang = 'de';
this.value = '';
this.html = '';
this.apiUrl = utils.getAPiUrl();
}
/**
......@@ -25,6 +26,7 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement {
lang: { type: String },
value: { type: String },
html: { type: String, attribute: false },
apiUrl: { type: String, attribute: 'api-url' },
};
}
......@@ -33,12 +35,13 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement {
i18n.changeLanguage(this.lang);
const that = this;
// JSONLD.initialize(utils.getAPiUrl(), function (jsonld) {
// const apiUrl = jsonld.getApiUrlForEntityName("KnowledgeBaseWebPageElement") + '/' + btoa(that.value);
// JSONLD.initialize(this.apiUrl, function (jsonld) {
// const apiUrl = jsonld.getApiUrlForEntityName("KnowledgeBaseWebPageElement") + '/' +
// encodeURIComponent(commonUtils.base64EncodeUnicode(encodeURIComponent(that.value)));
// });
// sadly there there is no entity url without "collectionOperations" in entity KnowledgeBaseWebPageElement!
const apiUrl = utils.getAPiUrl("/web_page_elements/knowledge_base_web_page_elements/") +
const apiUrl = this.apiUrl + "/web_page_elements/knowledge_base_web_page_elements/" +
encodeURIComponent(commonUtils.base64EncodeUnicode(encodeURIComponent(that.value))) +
"?lang=" + encodeURIComponent(that.lang);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment