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 { ...@@ -37,11 +37,11 @@ class KnowledgeBaseWebPageElementViewDemo extends LitElement {
</div> </div>
<div class="content"> <div class="content">
<h2 class="subtitle">Deutsch</h2> <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>
<div class="content"> <div class="content">
<h2 class="subtitle">Englisch</h2> <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> </div>
</section> </section>
`; `;
......
...@@ -15,6 +15,7 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement { ...@@ -15,6 +15,7 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement {
this.lang = 'de'; this.lang = 'de';
this.value = ''; this.value = '';
this.html = ''; this.html = '';
this.apiUrl = utils.getAPiUrl();
} }
/** /**
...@@ -25,6 +26,7 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement { ...@@ -25,6 +26,7 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement {
lang: { type: String }, lang: { type: String },
value: { type: String }, value: { type: String },
html: { type: String, attribute: false }, html: { type: String, attribute: false },
apiUrl: { type: String, attribute: 'api-url' },
}; };
} }
...@@ -33,12 +35,13 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement { ...@@ -33,12 +35,13 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement {
i18n.changeLanguage(this.lang); i18n.changeLanguage(this.lang);
const that = this; const that = this;
// JSONLD.initialize(utils.getAPiUrl(), function (jsonld) { // JSONLD.initialize(this.apiUrl, function (jsonld) {
// const apiUrl = jsonld.getApiUrlForEntityName("KnowledgeBaseWebPageElement") + '/' + btoa(that.value); // const apiUrl = jsonld.getApiUrlForEntityName("KnowledgeBaseWebPageElement") + '/' +
// encodeURIComponent(commonUtils.base64EncodeUnicode(encodeURIComponent(that.value)));
// }); // });
// sadly there there is no entity url without "collectionOperations" in entity KnowledgeBaseWebPageElement! // 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))) + encodeURIComponent(commonUtils.base64EncodeUnicode(encodeURIComponent(that.value))) +
"?lang=" + encodeURIComponent(that.lang); "?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