]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6727 @3
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 15 Feb 2024 18:25:17 +0000 (19:25 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 15 Feb 2024 18:25:17 +0000 (19:25 +0100)
config/backpack/base.php
public/images/loader.json [new file with mode: 0644]
public/packages/fluidbook/toolbox/css/loader.less
public/packages/fluidbook/toolbox/js/bundle.js
resources/views/vendor/backpack/base/inc/sidebar_content.blade.php
resources/views/vendor/backpack/crud/inc/form_save_buttons.blade.php

index 2f7e3b1a0932c655c25fffeab03b2dc974d99513..857c2d18af84861e7897d30e88500f71e1046002 100644 (file)
@@ -156,6 +156,7 @@ return [
         'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.4/gsap.min.js',
         'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js',
         'https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.7.3/sweetalert2.all.js',
+        'https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js',
 
         // examples (everything inside the bundle, loaded from CDN)
         // 'https://code.jquery.com/jquery-3.4.1.min.js',
diff --git a/public/images/loader.json b/public/images/loader.json
new file mode 100644 (file)
index 0000000..6635011
--- /dev/null
@@ -0,0 +1 @@
+{"v":"5.8.1","fr":30,"ip":0,"op":60,"w":300,"h":300,"nm":"loading_6","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"t":60,"s":[360]}],"ix":10},"p":{"a":0,"k":[150.00000000000003,150.00000000000003,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[30.000000000000004,30.000000000000004,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[300,300],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.2039,0.4431,0.7843,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":50,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":10,"s":[0]},{"t":60,"s":[99]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[1]},{"t":50,"s":[100]}],"ix":2},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"t":60,"s":[3]}],"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":300,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":30,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[150.00000000000003,150.00000000000003,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[30.000000000000004,30.000000000000004,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[300,300],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.6598,0.7683,0.9202,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":50,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":300,"st":0,"bm":0}],"markers":[]}
index 8260abdeaa2236f7e543bf6a1ecd910d53b58294..1500a385c5b23686bc7b7158e1ec42d60605420b 100644 (file)
@@ -6,6 +6,11 @@
     height: 100%;
     background-color: rgba(0, 0, 0, 0.25);
     cursor: wait;
+    z-index: 2147483648;
+
+    lottie-player {
+        margin: 0 auto;
+    }
 
     div {
         position: absolute;
@@ -76,4 +81,7 @@
     }
 }
 
+.featherlight {
+    z-index: auto !important;
+}
 
index a2918dc8c422127165be905aab7ad7609b443f3d..ca014657344d2e17964b315d6956cd72e8c9c9e7 100644 (file)
@@ -54,9 +54,31 @@ $(function () {
     });
 });
 
+function reloadPagePortions(callback) {
+    $.ajax({
+        url: window.location,
+        dataType: 'html',
+        cache: false,
+    }).done(function (html) {
+        let res = $(html);
+        $("[data-reload-portion]").each(function () {
+            let selector = '#' + $(this).attr('id');
+            let c = $(res).find(selector).html();
+            $(this).html(c);
+        });
+        if (callback !== undefined) {
+            callback.call();
+        }
+    });
+}
+
+function showSimpleLoader() {
+    $('body').prepend('<div id="loader"><lottie-player autoplay loop mode="normal" src="/images/loader.json" style="width: 175px"></lottie-player></div>');
+}
+
 function showLoader(message, progress) {
     if ($("#loader").length === 0) {
-        $('body').append('<div id="loader"><div><span></span><progress data-progress="" data-step="0" value="0" max="100"></progress></div></div>');
+        $('body').prepend('<div id="loader"><div><span></span><progress data-progress="" data-step="0" value="0" max="100"></progress></div></div>');
     }
     if (message !== '' && progress > 0) {
         var pb = $("#loader progress");
index 03b613054d682727c54dadb24dee3e74ef63345a..3b11bd1c9b3d0064043d361f1c65365c09a6087b 100644 (file)
@@ -29,9 +29,7 @@
             });
 
             function checkUnread() {
-
                 if (!isFocused()) {
-                    console.log('is not focused');
                     setTimeout(checkUnread, 10000);
                     return;
                 }
index 6541252ce80807f6f28b4f21cfa0b79daddad04f..c8dd21519426c589d57daa1b172c89869e253fb6 100644 (file)
@@ -29,7 +29,7 @@
                     @if(!empty($saveAction['options']))
                         <button id="bpSaveButtonsGroup" type="button" class="btn btn-success dropdown-toggle"
                                 data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span
-                                    class="caret"></span><span class="sr-only">&#x25BC;</span></button>
+                                class="caret"></span><span class="sr-only">&#x25BC;</span></button>
                         <div class="dropdown-menu" aria-labelledby="bpSaveButtonsGroup">
                             @foreach( $saveAction['options'] as $value => $label)
                                 <button type="button" class="dropdown-item"
@@ -55,7 +55,7 @@
 
         @if ($crud->get('update.showDeleteButton') && $crud->get('delete.configuration') && $crud->hasAccess('delete'))
             <button onclick="confirmAndDeleteEntry()" type="button" class="btn btn-danger float-right"><i
-                        class="la la-trash-alt"></i> {{ trans('backpack::crud.delete') }}</button>
+                    class="la la-trash-alt"></i> {{ trans('backpack::crud.delete') }}</button>
         @endif
     </div>
 @endif
         <script>
             (function ($) {
                 $(function () {
+                    let p = window.parent;
                     $(document).on('click', '.btn-form-cancel', function () {
-                        window.parent.jQuery.featherlight.current().close();
+                       p.jQuery.featherlight.current().close();
                         return false;
                     });
 
                     $(window).on('unload', function () {
+
                         try {
-                            window.parent.crud.table.ajax.reload();
+                            if(p.crud && p.crud.table && p.crud.table.ajax) {
+                                p.crud.table.ajax.reload();
+                            }
+                            p.reloadPagePortions(function () {
+                                p.hideLoader();
+                            });
                         } catch (e) {
-
+                            p.hideLoader();
+                            console.error(e);
                         }
-                        window.parent.jQuery.featherlight.current().close();
+                        p.jQuery.featherlight.current().close();
                         return true;
                     });
                 });
 
         // make all submit buttons trigger HTML5 validation
         jQuery(document).ready(function ($) {
-
             var selector = $('#bpSaveButtonsGroup').next();
             var form = $(selector).closest('form');
+            if($(form).length===0){
+                form=$('#saveActions').closest('form');
+            }
             var saveActionField = $('[name="_save_action"]');
             var $defaultSubmitButton = $(form).find(':submit');
             // this is the main submit button, the default save action.
                 $saveAction = $(this).children('span').eq(1);
                 // if form is valid just submit it
                 if (checkFormValidity(form)) {
+                    @if($embeded)
+                    window.parent.showSimpleLoader();
+                    @endif
                     saveActionField.val($saveAction.attr('data-value'));
                     form[0].requestSubmit();
                 } else {
                 $(this).click(function (e) {
                     //we check if form is valid
                     if (checkFormValidity(form)) {
+                        @if($embeded)
+                        window.parent.showSimpleLoader();
+                        @endif
                         //if everything is validated we proceed with the submission
                         var saveAction = $(this).data('value');
                         saveActionField.val(saveAction);