diff --git a/system/typemill/Controllers/ControllerWebSystem.php b/system/typemill/Controllers/ControllerWebSystem.php index 4bfa34a..97ca36d 100644 --- a/system/typemill/Controllers/ControllerWebSystem.php +++ b/system/typemill/Controllers/ControllerWebSystem.php @@ -74,6 +74,7 @@ class ControllerWebSystem extends Controller $extension = new Extension(); $themeDefinitions = $extension->getThemeDetails($this->settings['theme']); $themeSettings = $extension->getThemeSettings($this->settings['themes']); + $readymades = []; # add userroles and other datasets foreach($themeDefinitions as $name => $definitions) @@ -93,6 +94,11 @@ class ControllerWebSystem extends Controller } } } + + if(isset($definitions['readymades'])) + { + $readymades[$name] = $definitions['readymades']; + } } $license = []; @@ -106,9 +112,10 @@ class ControllerWebSystem extends Controller 'darkmode' => $request->getAttribute('c_darkmode'), 'mainnavi' => $mainNavigation, 'jsdata' => [ - 'systemnavi' => $systemNavigation, + 'systemnavi' => $systemNavigation, 'settings' => $themeSettings, 'definitions' => $themeDefinitions, + 'readymades' => $readymades, 'theme' => $this->settings['theme'], 'license' => $license, 'labels' => $this->c->get('translations'), diff --git a/system/typemill/author/js/vue-forms.js b/system/typemill/author/js/vue-forms.js index b686dd3..95f63ed 100644 --- a/system/typemill/author/js/vue-forms.js +++ b/system/typemill/author/js/vue-forms.js @@ -88,17 +88,25 @@ app.component('component-codearea', { `, mounted: function() { - this.resizeCodearea(); - this.highlight(this.value); + this.initialize() + + eventBus.$on('codeareaupdate', this.initialize ); }, methods: { - update: function($event, name) + initialize() + { + this.$nextTick(() => { + this.highlight(this.value); + this.resizeCodearea(); + }); + }, + update($event, name) { this.highlight($event.target.value); this.resizeCodearea(); eventBus.$emit('forminput', {'name': name, 'value': $event.target.value}); }, - resizeCodearea: function() + resizeCodearea() { let codeeditor = this.$refs["editor"]; @@ -110,7 +118,7 @@ app.component('component-codearea', { } }); }, - highlight: function(code) + highlight(code) { if(code === undefined) { diff --git a/system/typemill/author/js/vue-themes.js b/system/typemill/author/js/vue-themes.js index 8fc1cbc..23121a8 100644 --- a/system/typemill/author/js/vue-themes.js +++ b/system/typemill/author/js/vue-themes.js @@ -35,6 +35,31 @@ const app = Vue.createApp({
+
+
+ Readymades +

Readymades help you to setup your theme with prefilled settings. Load some readymades, check out the frontend and adjust the settings as needed. Find more informations about specific readymades on the theme's website.

+

If you load and save a readymade, then your individual settins will be overwritten and are lost!

+
    +
  • +
    + +
    +

    Load your stored individual settings.

    +
    +
    +
  • +
  • +
    + +
    +

    {{ readysetup.description }}

    +
    +
    +
  • +
+
+
{{ fieldDefinition.legend }} @@ -89,6 +114,7 @@ const app = Vue.createApp({ current: '', formDefinitions: data.definitions, formData: data.settings, + readymades: data.readymades, theme: data.theme, license: data.license, message: '', @@ -140,6 +166,10 @@ const app = Vue.createApp({ }); }, methods: { + themeurl(name) + { + return 'https://themes.typemill.net/' + name; + }, deactivateThemes() { for (const theme in this.formData) { @@ -212,6 +242,19 @@ const app = Vue.createApp({ { return 'component-'+type; }, + loadReadymade(name) + { + if(this.readymades[this.current] && this.readymades[this.current].individual === undefined) + { + this.readymades[this.current].individual = { 'settings' : this.formData[this.current] }; + } + + if(this.readymades[this.current][name] !== undefined) + { + this.formData[this.current] = this.readymades[this.current][name].settings; + eventBus.$emit('codeareaupdate'); + } + }, save() { this.reset(); diff --git a/system/typemill/author/layouts/layoutSystem.twig b/system/typemill/author/layouts/layoutSystem.twig index 65243a0..f89eebc 100644 --- a/system/typemill/author/layouts/layoutSystem.twig +++ b/system/typemill/author/layouts/layoutSystem.twig @@ -48,6 +48,7 @@ const data = {{ jsdata | json_encode() | raw }}; +