diff --git a/application/config/Events.php b/application/config/Events.php new file mode 100644 index 000000000..191a1eb98 --- /dev/null +++ b/application/config/Events.php @@ -0,0 +1,14 @@ + 'TEST', + 'component' => './Stv/Studentenverwaltung/Details/Notizen.js' + ]; + }); + */ diff --git a/application/controllers/public/js/Components.php b/application/controllers/public/js/Components.php new file mode 100644 index 000000000..830e7ea65 --- /dev/null +++ b/application/controllers/public/js/Components.php @@ -0,0 +1,43 @@ +output->set_content_type('text/javascript'); + $this->output->set_output($contents); + } +} diff --git a/application/core/CI3_Events.php b/application/core/CI3_Events.php new file mode 100644 index 000000000..33a96b89e --- /dev/null +++ b/application/core/CI3_Events.php @@ -0,0 +1,51 @@ + CoreRESTClient.getData(result.data)) + .then(result => { + const tabs = {}; + // TODO(chris): check if result is array + Object.entries(result).forEach(([key, config]) => { + if (!config.component) + return console.error('Component missing for ' + key); + + tabs[key] = { + component: Vue.markRaw(Vue.defineAsyncComponent(() => import(config.component))), + title: config.title || key, + config: config.config, + key + } + }); + if (tabs[this.default]) + this.current = this.default; + else + this.current = Object.keys(tabs)[0]; + this.tabs = tabs; + }) + .catch(this.$fhcAlert.handleSystemError); + }, + template: ` +