]> _ Git - fluidbook-toolbox.git/commitdiff
wip #4210 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 15 Jun 2022 10:59:12 +0000 (12:59 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 15 Jun 2022 10:59:12 +0000 (12:59 +0200)
app/Http/Controllers/API/FluidbookThemeAPIController.php
app/Models/FluidbookTheme.php
config/app.php
public/packages/featherlight/featherlight.min.css
public/packages/fluidbook/toolbox/css/style.less
resources/views/fields/fluidbook_theme_selector.blade.php

index 2719b691678ef1e46432a981528aafd4f5f490f8..8de2014461f8bc6ae412560edc0cf2b155f257b1 100644 (file)
@@ -60,7 +60,7 @@ class FluidbookThemeAPIController extends Controller
      */
     public static function _handleFiles($theme, $data)
     {
-       // $oldRoot = '/home/extranet/www/fluidbook/themes/' . $theme->getAttribute('id') . '/';
+        // $oldRoot = '/home/extranet/www/fluidbook/themes/' . $theme->getAttribute('id') . '/';
         foreach ($theme->getFields() as $field) {
             if (!($field instanceof Files)) {
                 continue;
@@ -124,6 +124,7 @@ class FluidbookThemeAPIController extends Controller
      */
     public function updatefromws2(Request $request, $id)
     {
+        FluidbookTheme::$updateWS2SyncViewOnChange = true;
         $theme = FluidbookTheme::find($id);
         self::_prepareData($theme, $request->get('data'));
         $theme->save();
@@ -132,6 +133,7 @@ class FluidbookThemeAPIController extends Controller
 
     public function clonefromws2(Request $request, $id)
     {
+        FluidbookTheme::$updateWS2SyncViewOnChange = true;
         $theme = FluidbookTheme::find($id);
         $newtheme = $theme->replicate();
         $newtheme->name .= ' (copy)';
@@ -143,6 +145,7 @@ class FluidbookThemeAPIController extends Controller
 
     public function renamefromws2(Request $request, $id)
     {
+        FluidbookTheme::$updateWS2SyncViewOnChange = true;
         $theme = FluidbookTheme::find($id);
         $theme->name = $request->get('newname');
         $theme->save();
@@ -150,6 +153,7 @@ class FluidbookThemeAPIController extends Controller
 
     public function deletefromws2(Request $request, $id)
     {
+        FluidbookTheme::$updateWS2SyncViewOnChange = true;
         /** @var FluidbookTheme $theme */
         $theme = FluidbookTheme::find($id);
         $theme->delete();
@@ -157,6 +161,7 @@ class FluidbookThemeAPIController extends Controller
 
     public function uploadfile(Request $request, $id, $fieldname)
     {
+        FluidbookTheme::$updateWS2SyncViewOnChange = true;
         /** @var FluidbookTheme $theme */
         $theme = FluidbookTheme::find($id);
         $theme->addMediaToField($fieldname, $request->get('path'), true);
index 5187e1b2cc328ae6ed2b2bbd8c6cf7263ccbc6fa..054c5fd3d505fe412d2d1a794e7350a083c8f0e3 100644 (file)
@@ -26,6 +26,7 @@ class FluidbookTheme extends ToolboxModel
     protected $_enableTrackNonDefaultValues = true;
 
     public static $updateWS2ViewOnChange = true;
+    public static $updateWS2SyncViewOnChange = false;
 
     public function setFields()
     {
@@ -665,9 +666,12 @@ class FluidbookTheme extends ToolboxModel
     {
         if (self::$updateWS2ViewOnChange) {
             if (null !== $id) {
-                start_measure('update_theme_table', 'Update ws2 theme');
-                dispatch(new UpdateWS2ThemeTable($id))->onConnection('sync');
-                stop_measure('update_theme_table');
+                $job = new UpdateWS2ThemeTable($id);
+                if (self::$updateWS2SyncViewOnChange) {
+                    dispatch($job);
+                } else {
+                    dispatch_sync($job);
+                }
             }
             dispatch(new UpdateWS2ThemeTable('all'))->onQueue('theme');
         }
index 82e0adcc886584909b30f25ae1b31c24dea7c183..65ad315fbb52646a48f5a00d7ff38695ebd5ad52 100644 (file)
@@ -67,7 +67,7 @@ return [
     |
     */
 
-    'timezone' => 'UTC',
+    'timezone' => env('TIMEZONE', 'UTC'),
 
     /*
     |--------------------------------------------------------------------------
index 62fdb71d1e0a1076beb81d5b189374c5536488f1..262b60d21a56ccdcee96655537442645ffb4eb06 100644 (file)
@@ -5,4 +5,4 @@
  * Copyright 2019, Noël Raoul Bossart (http://www.noelboss.com)
  * MIT Licensed.
 **/
-html.with-featherlight{overflow:hidden}.featherlight{display:none;position:fixed;top:0;right:0;bottom:0;left:0;z-index:2147483647;text-align:center;white-space:nowrap;cursor:pointer;background:#333;background:rgba(0,0,0,0)}.featherlight:last-of-type{background:rgba(0,0,0,.8)}.featherlight:before{content:'';display:inline-block;height:100%;vertical-align:middle}.featherlight .featherlight-content{position:relative;text-align:left;vertical-align:middle;display:inline-block;overflow:auto;padding:25px 25px 0;border-bottom:25px solid transparent;margin-left:5%;margin-right:5%;max-height:95%;background:#fff;cursor:auto;white-space:normal}.featherlight .featherlight-inner{display:block}.featherlight link.featherlight-inner,.featherlight script.featherlight-inner,.featherlight style.featherlight-inner{display:none}.featherlight .featherlight-close-icon{position:absolute;z-index:9999;top:0;right:0;line-height:25px;width:25px;cursor:pointer;text-align:center;font-family:Arial,sans-serif;background:#fff;background:rgba(255,255,255,.3);color:#000;border:0;padding:0}.featherlight .featherlight-close-icon::-moz-focus-inner{border:0;padding:0}.featherlight .featherlight-image{width:100%}.featherlight-iframe .featherlight-content{border-bottom:0;padding:0;-webkit-overflow-scrolling:touch}.featherlight iframe{border:0}.featherlight *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}@media only screen and (max-width:1024px){.featherlight .featherlight-content{margin-left:0;margin-right:0;max-height:98%;padding:10px 10px 0;border-bottom:10px solid transparent}}@media print{html.with-featherlight>*>:not(.featherlight){display:none}}
\ No newline at end of file
+html.with-featherlight{overflow:hidden}.featherlight{display:none;position:fixed;top:0;right:0;bottom:0;left:0;z-index:2147483647;text-align:center;white-space:nowrap;cursor:pointer;background:#333;background:rgba(0,0,0,0)}.featherlight:last-of-type{background:rgba(0,0,0,.8)}.featherlight:before{content:'';display:inline-block;height:100%;vertical-align:middle}.featherlight .featherlight-content{position:relative;text-align:left;vertical-align:middle;display:inline-block;overflow:auto;padding:0;border-bottom:0;margin-left:5%;margin-right:5%;max-height:95%;background:#fff;cursor:auto;white-space:normal}.featherlight .featherlight-inner{display:block}.featherlight link.featherlight-inner,.featherlight script.featherlight-inner,.featherlight style.featherlight-inner{display:none}.featherlight .featherlight-close-icon{position:absolute;z-index:9999;top:0;right:0;line-height:25px;width:25px;cursor:pointer;text-align:center;font-family:Arial,sans-serif;background:#fff;background:rgba(255,255,255,.3);color:#000;border:0;padding:0}.featherlight .featherlight-close-icon::-moz-focus-inner{border:0;padding:0}.featherlight .featherlight-image{width:100%}.featherlight-iframe .featherlight-content{border-bottom:0;padding:0;-webkit-overflow-scrolling:touch}.featherlight iframe{border:0}.featherlight *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}@media only screen and (max-width:1024px){.featherlight .featherlight-content{margin-left:0;margin-right:0;max-height:98%;padding:10px 10px 0;border-bottom:10px solid transparent}}@media print{html.with-featherlight>*>:not(.featherlight){display:none}}
index 35833a9ee6f8e610d366d91262d4e11f21a54b21..da2d4dabe361e66945f6c1638650cb01bab2ba3f 100644 (file)
@@ -406,24 +406,24 @@ body.embeded {
     }
 }
 
-.featherlight .featherlight-content {
-    @media only screen and (max-width: 1024px) {
-        border: 0;
-        padding: 0;
-        min-width: 100%;
-        width: 100%;
-        max-width: 100%;
-        min-height: 100%;
-        height: 100%;
-        max-height: 100%;
-    }
-
-    .featherlight-inner {
-        @media only screen and (max-width: 1024px) {
-            width: 100%;
-            height: 100%;
-        }
-    }
-}
+//.featherlight .featherlight-content {
+//    @media only screen and (max-width: 1024px) {
+//        border: 0;
+//        padding: 0;
+//        min-width: 100%;
+//        width: 100%;
+//        max-width: 100%;
+//        min-height: 100%;
+//        height: 100%;
+//        max-height: 100%;
+//    }
+//
+//    .featherlight-inner {
+//        @media only screen and (max-width: 1024px) {
+//            width: 100%;
+//            height: 100%;
+//        }
+//    }
+//}
 
 @import "tools";
index 5767c9b8055449bacea14e0be9dd8e75eef367c6..518f1f3324cd0890a6f9d65c7c22feeeb4d0d59a 100644 (file)
@@ -33,7 +33,7 @@
                         // Reload theme viewer after editor has been closed
                         var iframe = $('.themeSelector #themePreviewIframe');
                         iframe.get(0).contentWindow.location = $(iframe).attr('src');
-                        console.log('reload preview theme');
+                        updateThemeSelector();
                     }
                     return;
                 }
 
             function updateThemeSelector() {
                 var themeID = $(selector).val();
+                if (null === themeID || themeID === undefined) {
+                    setTimeout(updateThemeSelector, 500);
+                    return;
+                }
                 var iframe = $('.themeSelector .preview iframe');
                 $(iframe).attr('src', $(iframe).data('url').replace(/\$id/, themeID));
                 $(".themeSelector .actions a").each(function () {
@@ -75,6 +79,9 @@
                         $(".themeSelector .actions .owner").html(htmlDecode(data.columns.owner));
                         $(".themeSelector .actions .created_at").html(data.columns.created_at);
                         $(".themeSelector .actions .updated_at").html(data.columns.updated_at);
+                        $('.themeSelector options[value="' + themeID + '"]').each(function () {
+                            $(this).text(data.name + ' (#' + themeID + ')');
+                        });
                     }
                 });
             }