loads the menu for the CISVUE-Header in the server side instead of the client side

This commit is contained in:
SimonGschnell
2024-09-30 11:14:34 +02:00
parent 0e385e8628
commit 8c6f9d1bc4
3 changed files with 16 additions and 8 deletions
@@ -18,7 +18,7 @@ $this->load->view('templates/FHC-Header', $includesArray);
if (!isset($menu)) {
$ci =& get_instance(); // get CI instance
$ci->load->model('content/Content_model', 'ContentModel');
$result = $ci->ContentModel->getMenu(defined('CIS4_MENU_ENTRY') ? CIS4_MENU_ENTRY : null, get_uid());
$result = $ci->ContentModel->getMenu(null, get_uid());
$menu = getData($result) ?? (object)['childs' => []];
}
?>
+10 -1
View File
@@ -15,6 +15,13 @@ $includesArray = array(
$this->load->view('templates/FHC-Header', $includesArray);
if (!isset($menu)) {
$ci =& get_instance(); // get CI instance
$ci->load->model('content/Content_model', 'ContentModel');
$result = $ci->ContentModel->getMenu(defined('CIS4_MENU_ENTRY') ? CIS4_MENU_ENTRY : null, get_uid());
$menu = getData($result)->childs ?? [];
}
?>
<script type="text/javascript">
@@ -30,7 +37,9 @@ $this->load->view('templates/FHC-Header', $includesArray);
logout-url="<?= site_url('Cis/Auth/logout'); ?>"
:selectedtypes="selectedtypes"
:searchbaroptions="searchbaroptions"
:searchfunction="searchfunction" />
:searchfunction="searchfunction"
:menu="<?= htmlspecialchars(json_encode(array_values($menu)), ENT_QUOTES, 'UTF-8') ?>"
></cis-menu>
</header>
<main id="cis-main" class="flex-grow-1 overflow-scroll p-4">
+5 -6
View File
@@ -7,7 +7,8 @@ export default {
FhcSearchbar
},
props: {
rootUrl: String,
menu: Array,
rootUrl: String,
logoUrl: String,
avatarUrl: String,
logoutUrl: String,
@@ -27,11 +28,9 @@ export default {
this.activeEntry = content_id;
}
},
created() {
axios.get(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/components/CisVue/Menu').then(res => {
this.entries = res.data.retval.childs;
});
},
mounted(){
this.entries = this.menu;
},
template: /*html*/`
<!--<p>CISVUE HEADER</p>
<p>active entry content_id : {{activeEntry}}</p>