From 02569b83e665f3a544bb9a8b5482b71c9b27191a Mon Sep 17 00:00:00 2001 From: jr-k Date: Wed, 3 Jul 2024 19:31:34 +0200 Subject: [PATCH] minor fixes --- data/www/js/slideshow/slides.js | 30 +++++++++++--------- src/service/PluginStore.py | 10 +++---- views/slideshow/slides/modal/edit.jinja.html | 6 ++-- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/data/www/js/slideshow/slides.js b/data/www/js/slideshow/slides.js index dbbd199..70a5750 100644 --- a/data/www/js/slideshow/slides.js +++ b/data/www/js/slideshow/slides.js @@ -64,18 +64,15 @@ jQuery(document).ready(function ($) { return $(el).val() === value; }).data('input'); - if ($modal.find('.picker').length === 0) { - $modal.find('.upload').find('input, select').prop('disabled', false); + if ($modal.find('.picker:visible').length === 0) { + $('.slide-add-object-input') + .addClass('hidden') + .prop('disabled', true).prop('required', false) + .filter('#slide-add-object-input-' + inputType) + .removeClass('hidden') + .prop('disabled', false).prop('required', true) + ; } - - $('.slide-add-object-input') - .addClass('hidden') - .prop('disabled', true) - .filter('#slide-add-object-input-' + inputType) - .removeClass('hidden') - .prop('disabled', false) - ; - }; const inputSchedulerUpdate = function() { @@ -213,14 +210,19 @@ jQuery(document).ready(function ($) { $(document).on('click', '.picker button', function () { const $parent = $(this).parents('.modal-slide-add'); - $parent.find('.picker').remove(); - $parent.find('.upload').removeClass('hidden'); + $parent.find('.picker').addClass('hidden').find('select').prop('disabled', true); + $parent.find('.upload').removeClass('hidden').find('input,select').prop('disabled', false); inputTypeUpdate(); }); $(document).on('click', '.slide-add', function () { showModal('modal-slide-add'); - loadDateTimePicker($('.modal-slide-add .datetimepicker')) + const $modal = $('.modal-slide-add:visible'); + loadDateTimePicker($modal.find('.datetimepicker')); + $modal.find('.picker').removeClass('hidden').find('select').prop('disabled', false); + $modal.find('.upload').addClass('hidden').find('input,select').prop('disabled', true); + $modal.find('button[type=submit]').removeClass('hidden'); + $modal.find('.btn-loading').addClass('hidden'); inputTypeUpdate(); inputSchedulerUpdate(); inputContentUpdate(); diff --git a/src/service/PluginStore.py b/src/service/PluginStore.py index a85b69d..8552f66 100644 --- a/src/service/PluginStore.py +++ b/src/service/PluginStore.py @@ -129,6 +129,10 @@ class PluginStore: if variable.name in self._dead_variables_candidates: del self._dead_variables_candidates[variable.name] + # LANGS + self._model_store.lang().load(directory=plugin.get_directory(), prefix=plugin.use_id()) + self._model_store.variable().reload() + if not self.is_plugin_enabled(plugin): return @@ -157,10 +161,6 @@ class PluginStore: "s" if len(hooks_registrations) > 1 else "", )) - # LANGS - self._model_store.lang().load(directory=plugin.get_directory(), prefix=plugin.use_id()) - self._model_store.variable().reload() - # WEB CONTROLLERS self.load_controllers(plugin) @@ -171,6 +171,6 @@ class PluginStore: def is_plugin_enabled(self, plugin: ObPlugin) -> bool: var = self._model_store.variable().get_one_by_name(plugin.get_plugin_variable_name(self.DEFAULT_PLUGIN_ENABLED_VARIABLE)) - logging.info("[plugin] {} {}".format("🟢" if var.as_bool() else "⚫️", plugin.use_title())) + logging.info("[plugin] {} {}".format("🟢" if var.as_bool() else "⚫️", self._model_store.lang().translate(plugin.use_title()))) return var.as_bool() if var else False diff --git a/views/slideshow/slides/modal/edit.jinja.html b/views/slideshow/slides/modal/edit.jinja.html index 01770df..0287a27 100644 --- a/views/slideshow/slides/modal/edit.jinja.html +++ b/views/slideshow/slides/modal/edit.jinja.html @@ -16,9 +16,9 @@
- +
+ +