]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6555 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 5 Dec 2023 16:49:17 +0000 (17:49 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 5 Dec 2023 16:49:17 +0000 (17:49 +0100)
app/Models/FluidbookExternalInstallServer.php
resources/views/vendor/backpack/crud/edit-external-server.blade.php
resources/views/vendor/backpack/crud/inc/form_save_buttons.blade.php

index ca9b2e963f4891065596013c676122734660b9a2..16097da5f9c8fde8f458b2d70b3409362534d5f0 100644 (file)
@@ -46,13 +46,13 @@ class FluidbookExternalInstallServer extends ExternalServer
     public function setFields()
     {
         $hostingProtocols = static::getHostingProtocols();
-        $nothostingProtocols = array_diff(array_keys($this->getProtocols(), $hostingProtocols));
+        $nothostingProtocols = array_diff(array_keys($this->getProtocols()),$hostingProtocols);
 
         parent::setFields();
         $this->getField('base_url')->setAttribute('when', ['protocol' => $nothostingProtocols]);
         $this->addField('subdomains', Textarea::class, __('Sous-domaines'), ['when' => ['protocol' => $hostingProtocols]]);
         $this->addField('php', Checkbox::class, __('Activer le support de PHP'), ['default' => false, 'when' => ['protocol' => $hostingProtocols]]);
-        $this->addField('redirections', Table::class, __('Redirections'), ['entity_singular' => __('redirection'), 'columns' => ['from' => __('De'), 'to' => __('Vers')], 'when' => ['protocol' => 'hosting']]);
+        $this->addField('redirections', Table::class, __('Redirections'), ['entity_singular' => __('redirection'), 'columns' => ['from' => __('De'), 'to' => __('Vers')], 'when' => ['protocol' => $hostingProtocols]]);
         $this->addField('allows_root', Checkbox::class, __('Autoriser le chargement à la racine (sur le chemin de base)'), ['default' => false]);
     }
 
index 8019a33362d94ca1daded592dbd47dca35363ccf..6cc8a6d8c60184922edcde395a2451b779a1cbc1 100644 (file)
@@ -5,7 +5,7 @@
             // When clicking on a locale link in the dropdown menu, it doesn't preserve
             // the current tab because this is stored in the hash and managed by JS.
             // To overcome this, we catch the locale links and append the hash to them...
-            $(document).on('click', '.dropdown-menu a[href*="?locale="]', function(event) {
+            $(document).on('click', '.dropdown-menu a[href*="?locale="]', function (event) {
                 event.preventDefault();
                 window.location.href = $(this).attr('href') + document.location.hash;
             });
@@ -16,7 +16,7 @@
                 }, "5000");
             }
 
-            $(document).on("click", "#verifyconnection", function(e) {
+            $(document).on("click", "#verifyconnection", function (e) {
                 e.preventDefault();
                 const data = {
                     id: {{$entry->id}},
                     _token: $('[name=_token]').val(),
                 }
                 $.ajax({
-                    url: '{{url('fluidbook-external-install-server/'.$entry->id)}}/verifyconnection',
+                    url: '{{url('fluidbook-external-install-server/'.$entry->id.'/verifyconnection')}}',
                     method: 'post',
                     data: data,
                     success: function (data) {
                         let type = 'success'
-                        if(data.error) {
+                        if (data.error) {
                             type = 'error'
                         }
-                        $('#saveActions').prepend('<div id="message" class="mb-3 noty_type__'+type+' noty_theme__backstrap"><div class="p-3">'+data.message+'</div></div>')
+                        $('#saveActions').prepend('<div id="message" class="mb-3 noty_type__' + type + ' noty_theme__backstrap"><div class="p-3">' + data.message + '</div></div>')
                         removeBtn()
                     },
-                    error: function(xhr) {
+                    error: function (xhr) {
                         let message = xhr.responseJSON.message ?? "{{ __('Une erreur est survenue') }}"
-                        $('#saveActions').prepend('<div id="message" class="mb-3 noty_type__error noty_theme__backstrap"><div class="p-3">'+message+'</div></div>')
+                        $('#saveActions').prepend('<div id="message" class="mb-3 noty_type__error noty_theme__backstrap"><div class="p-3">' + message + '</div></div>')
                         removeBtn()
                     }
                 });
@@ -49,7 +49,9 @@
         });
     </script>
     <style>
-        #message { border-radius: 5px; }
+        #message {
+            border-radius: 5px;
+        }
     </style>
 @endpush
 
index 4e09d955c10f9e742eedc9a494cc98af1f334741..44bf297ead23dc3172b95687c510103a5ffd8367 100644 (file)
         function checkFormValidity(form) {
             // the condition checks if `checkValidity` is defined in the form (browser compatibility)
             if (form[0].checkValidity) {
+                for (var i in form[0].elements) {
+                    let e = form[0].elements[i];
+                    try {
+                        if (!e.checkValidity()) {
+                            console.warn('Invalid value for field ', e);
+                        }
+                    } catch (e) {
+
+                    }
+                }
                 return form[0].checkValidity();
             }
             return false;