From b440aa4f8d4384869d51d8277376c4db484198a8 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 15 Jun 2022 12:59:12 +0200 Subject: [PATCH] wip #4210 @1 --- .../API/FluidbookThemeAPIController.php | 7 +++- app/Models/FluidbookTheme.php | 10 +++-- config/app.php | 2 +- .../featherlight/featherlight.min.css | 2 +- .../packages/fluidbook/toolbox/css/style.less | 38 +++++++++---------- .../fields/fluidbook_theme_selector.blade.php | 9 ++++- 6 files changed, 42 insertions(+), 26 deletions(-) diff --git a/app/Http/Controllers/API/FluidbookThemeAPIController.php b/app/Http/Controllers/API/FluidbookThemeAPIController.php index 2719b6916..8de201446 100644 --- a/app/Http/Controllers/API/FluidbookThemeAPIController.php +++ b/app/Http/Controllers/API/FluidbookThemeAPIController.php @@ -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); diff --git a/app/Models/FluidbookTheme.php b/app/Models/FluidbookTheme.php index 5187e1b2c..054c5fd3d 100644 --- a/app/Models/FluidbookTheme.php +++ b/app/Models/FluidbookTheme.php @@ -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'); } diff --git a/config/app.php b/config/app.php index 82e0adcc8..65ad315fb 100644 --- a/config/app.php +++ b/config/app.php @@ -67,7 +67,7 @@ return [ | */ - 'timezone' => 'UTC', + 'timezone' => env('TIMEZONE', 'UTC'), /* |-------------------------------------------------------------------------- diff --git a/public/packages/featherlight/featherlight.min.css b/public/packages/featherlight/featherlight.min.css index 62fdb71d1..262b60d21 100644 --- a/public/packages/featherlight/featherlight.min.css +++ b/public/packages/featherlight/featherlight.min.css @@ -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}} diff --git a/public/packages/fluidbook/toolbox/css/style.less b/public/packages/fluidbook/toolbox/css/style.less index 35833a9ee..da2d4dabe 100644 --- a/public/packages/fluidbook/toolbox/css/style.less +++ b/public/packages/fluidbook/toolbox/css/style.less @@ -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"; diff --git a/resources/views/fields/fluidbook_theme_selector.blade.php b/resources/views/fields/fluidbook_theme_selector.blade.php index 5767c9b80..518f1f332 100644 --- a/resources/views/fields/fluidbook_theme_selector.blade.php +++ b/resources/views/fields/fluidbook_theme_selector.blade.php @@ -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; } @@ -60,6 +60,10 @@ 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 + ')'); + }); } }); } -- 2.39.5