mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
prevent strange effects when switching between content_types
This commit is contained in:
@@ -30,39 +30,19 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
content_type: null,
|
||||
content: null,
|
||||
content_id_internal: this.content_id
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
fetchContent(){
|
||||
return this.$api
|
||||
this.$api
|
||||
.call(ApiCms.content(this.content_id_internal, this.version, this.sprache, this.sichtbar))
|
||||
.then(res => {
|
||||
this.content = res.data.content;
|
||||
this.content_type = res.data.type;
|
||||
|
||||
document.querySelectorAll("#cms [data-confirm]").forEach((el) => {
|
||||
el.addEventListener("click", (evt) => {
|
||||
evt.preventDefault();
|
||||
BsConfirm.popup(el.dataset.confirm)
|
||||
.then(() => {
|
||||
Axios.get(el.href)
|
||||
.then((res) => {
|
||||
// TODO(chris): check for success then show message and/or reload
|
||||
location = location;
|
||||
})
|
||||
.catch((err) => console.error("ERROR:", err));
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
});
|
||||
});
|
||||
document.querySelectorAll("#cms [data-href]").forEach((el) => {
|
||||
el.href = el.dataset.href.replace(
|
||||
/^ROOT\//,
|
||||
FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
);
|
||||
this.$nextTick(function() {
|
||||
this.content = res.data.content;
|
||||
this.content_type = res.data.type;
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -96,8 +76,6 @@ export default {
|
||||
created() {
|
||||
this.fetchContent();
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
template: /*html*/ `
|
||||
<!-- div that contains the content -->
|
||||
<div id="fhc-cms-content" v-if="content">
|
||||
|
||||
Reference in New Issue
Block a user