From f209bb5474e2eac10ac9b4c46bfe1c0655dc68f7 Mon Sep 17 00:00:00 2001 From: ggppdk Date: Wed, 21 Dec 2016 21:48:36 +0200 Subject: [PATCH 01/10] Added overlay box and message box for submit and reload form after category change --- .../components/com_fields/helpers/fields.php | 45 ++++++++++++++++--- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php index 6eb6cd8fb664d..c1d43ccc8c2cb 100644 --- a/administrator/components/com_fields/helpers/fields.php +++ b/administrator/components/com_fields/helpers/fields.php @@ -303,13 +303,44 @@ public static function prepareForm($context, JForm $form, $data) * has changed */ $form->setFieldAttribute('catid', 'onchange', 'categoryHasChanged(this);'); - JFactory::getDocument()->addScriptDeclaration( - "function categoryHasChanged(element){ - var cat = jQuery(element); - if (cat.val() == '" . $assignedCatids . "')return; - jQuery('input[name=task]').val('field.storeform'); - element.form.action='" . $uri . "'; - element.form.submit(); + JFactory::getDocument()->addStyleDeclaration(" + #jfields-overlay { + position:absolute; + top:0; + left:0; + right:0; + bottom:0; + background-color: #707070; + background-image: -webkit-repeating-linear-gradient(135deg,#707070,#707070 6px,#676767 6px,#676767 12px); + background-image: repeating-linear-gradient(135deg,#707070,#707070 6px,#676767 6px,#676767 12px); + opacity: 0.5; + filter: alpha(opacity=50); + z-index: 2000; + } + #jfields-loading-msg { + background: white; + border-radius: 4px; + padding: 24px; + font-size: 24px; + position: fixed; + top: 50%; + left: 50%; + -webkit-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + box-shadow: 0px 0px 30px 0px rgba(0,0,0,0.75); + z-index: 2050; + }"); + JFactory::getDocument()->addScriptDeclaration(" + function categoryHasChanged(element){ + jQuery('
').appendTo(document.body); + jQuery('
Loading ... please wait
').appendTo(document.body); + //setTimeout(function() { + var cat = jQuery(element); + if (cat.val() == '" . $assignedCatids . "')return; + jQuery('input[name=task]').val('field.storeform'); + element.form.action='" . $uri . "'; + element.form.submit(); + //}, 20); } jQuery( document ).ready(function() { var formControl = '#" . $form->getFormControl() . "_catid'; From c73c8c2e795fef8bb3c0518b4ee5966c37d461bf Mon Sep 17 00:00:00 2001 From: ggppdk Date: Wed, 21 Dec 2016 22:05:50 +0200 Subject: [PATCH 02/10] Removed commented testing code --- .../components/com_fields/helpers/fields.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php index c1d43ccc8c2cb..b7cebf63667fe 100644 --- a/administrator/components/com_fields/helpers/fields.php +++ b/administrator/components/com_fields/helpers/fields.php @@ -334,13 +334,11 @@ public static function prepareForm($context, JForm $form, $data) function categoryHasChanged(element){ jQuery('
').appendTo(document.body); jQuery('
Loading ... please wait
').appendTo(document.body); - //setTimeout(function() { - var cat = jQuery(element); - if (cat.val() == '" . $assignedCatids . "')return; - jQuery('input[name=task]').val('field.storeform'); - element.form.action='" . $uri . "'; - element.form.submit(); - //}, 20); + var cat = jQuery(element); + if (cat.val() == '" . $assignedCatids . "')return; + jQuery('input[name=task]').val('field.storeform'); + element.form.action='" . $uri . "'; + element.form.submit(); } jQuery( document ).ready(function() { var formControl = '#" . $form->getFormControl() . "_catid'; From 790d1e4c6bdd5a085a6c732e713f50c1c7ac2179 Mon Sep 17 00:00:00 2001 From: ggppdk Date: Thu, 22 Dec 2016 00:33:48 +0200 Subject: [PATCH 03/10] Added language strings --- administrator/components/com_fields/helpers/fields.php | 10 +++++----- administrator/language/en-GB/en-GB.ini | 1 + language/en-GB/en-GB.ini | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php index b7cebf63667fe..86655197bca96 100644 --- a/administrator/components/com_fields/helpers/fields.php +++ b/administrator/components/com_fields/helpers/fields.php @@ -320,20 +320,20 @@ public static function prepareForm($context, JForm $form, $data) #jfields-loading-msg { background: white; border-radius: 4px; - padding: 24px; - font-size: 24px; + padding: 6px 12px; + font-size: 18px; position: fixed; - top: 50%; + top: 45%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); - box-shadow: 0px 0px 30px 0px rgba(0,0,0,0.75); + box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75); z-index: 2050; }"); JFactory::getDocument()->addScriptDeclaration(" function categoryHasChanged(element){ jQuery('
').appendTo(document.body); - jQuery('
Loading ... please wait
').appendTo(document.body); + jQuery('
".JText::_('JLOADING')." ...
').appendTo(document.body); var cat = jQuery(element); if (cat.val() == '" . $assignedCatids . "')return; jQuery('input[name=task]').val('field.storeform'); diff --git a/administrator/language/en-GB/en-GB.ini b/administrator/language/en-GB/en-GB.ini index c7192670aaf9b..8650075ca0287 100644 --- a/administrator/language/en-GB/en-GB.ini +++ b/administrator/language/en-GB/en-GB.ini @@ -126,6 +126,7 @@ JUNPUBLISHED="Unpublished" JVERSION="Version" JYES="Yes" JACTIONS="Actions for: %s" +JLOADING="Loading" JACTION_ADMIN="Configure ACL & Options" JACTION_ADMIN_COMPONENT_DESC="Allows users in the group to edit the options and permissions of this extension." diff --git a/language/en-GB/en-GB.ini b/language/en-GB/en-GB.ini index e4e96259a3fe4..68a3713ba675c 100644 --- a/language/en-GB/en-GB.ini +++ b/language/en-GB/en-GB.ini @@ -103,6 +103,7 @@ JTRUE="True" JUNPUBLISHED="Unpublished" JYEAR="Year" JYES="Yes" +JLOADING="Loading" JBROWSERTARGET_MODAL="Modal" JBROWSERTARGET_NEW="Open in new window" From 885f33e1d6ffb3a4d1974e4712555a760133941e Mon Sep 17 00:00:00 2001 From: Georgios Papadakis Date: Fri, 23 Dec 2016 21:55:41 +0200 Subject: [PATCH 04/10] CS fix, added missing spaces --- administrator/components/com_fields/helpers/fields.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php index 86655197bca96..5b7a6ec2005ac 100644 --- a/administrator/components/com_fields/helpers/fields.php +++ b/administrator/components/com_fields/helpers/fields.php @@ -333,7 +333,7 @@ public static function prepareForm($context, JForm $form, $data) JFactory::getDocument()->addScriptDeclaration(" function categoryHasChanged(element){ jQuery('
').appendTo(document.body); - jQuery('
".JText::_('JLOADING')." ...
').appendTo(document.body); + jQuery('
" . JText::_('JLOADING') . " ...
').appendTo(document.body); var cat = jQuery(element); if (cat.val() == '" . $assignedCatids . "')return; jQuery('input[name=task]').val('field.storeform'); From 367848698090c651358d8bfc1e9d37407afa29c9 Mon Sep 17 00:00:00 2001 From: Georgios Papadakis Date: Fri, 23 Dec 2016 22:57:05 +0200 Subject: [PATCH 05/10] Used Joomla logo spinner instead of fixed message --- .../components/com_fields/helpers/fields.php | 36 ++++--------------- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php index 5b7a6ec2005ac..c10e2eb7a7a9f 100644 --- a/administrator/components/com_fields/helpers/fields.php +++ b/administrator/components/com_fields/helpers/fields.php @@ -11,6 +11,7 @@ JLoader::register('FieldsHelperInternal', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/internal.php'); JLoader::register('JFolder', JPATH_LIBRARIES . '/joomla/filesystem/folder.php'); + /** * FieldsHelper * @@ -303,37 +304,11 @@ public static function prepareForm($context, JForm $form, $data) * has changed */ $form->setFieldAttribute('catid', 'onchange', 'categoryHasChanged(this);'); - JFactory::getDocument()->addStyleDeclaration(" - #jfields-overlay { - position:absolute; - top:0; - left:0; - right:0; - bottom:0; - background-color: #707070; - background-image: -webkit-repeating-linear-gradient(135deg,#707070,#707070 6px,#676767 6px,#676767 12px); - background-image: repeating-linear-gradient(135deg,#707070,#707070 6px,#676767 6px,#676767 12px); - opacity: 0.5; - filter: alpha(opacity=50); - z-index: 2000; - } - #jfields-loading-msg { - background: white; - border-radius: 4px; - padding: 6px 12px; - font-size: 18px; - position: fixed; - top: 45%; - left: 50%; - -webkit-transform: translate(-50%, -50%); - transform: translate(-50%, -50%); - box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75); - z-index: 2050; - }"); + + // Preload spindle-wheel when we need to submit form due to category selector changed JFactory::getDocument()->addScriptDeclaration(" - function categoryHasChanged(element){ - jQuery('
').appendTo(document.body); - jQuery('
" . JText::_('JLOADING') . " ...
').appendTo(document.body); + function categoryHasChanged(element) { + Joomla.loadingLayer('show'); var cat = jQuery(element); if (cat.val() == '" . $assignedCatids . "')return; jQuery('input[name=task]').val('field.storeform'); @@ -341,6 +316,7 @@ function categoryHasChanged(element){ element.form.submit(); } jQuery( document ).ready(function() { + Joomla.loadingLayer('load'); var formControl = '#" . $form->getFormControl() . "_catid'; if (!jQuery(formControl).val() != '" . $assignedCatids . "'){jQuery(formControl).val('" . $assignedCatids . "');} });"); From e1189e6ed72706a23804934bb763bee1cd8bdf98 Mon Sep 17 00:00:00 2001 From: Georgios Papadakis Date: Fri, 23 Dec 2016 22:59:50 +0200 Subject: [PATCH 06/10] Reverted changes in admin lang file --- administrator/language/en-GB/en-GB.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/administrator/language/en-GB/en-GB.ini b/administrator/language/en-GB/en-GB.ini index 8650075ca0287..c7192670aaf9b 100644 --- a/administrator/language/en-GB/en-GB.ini +++ b/administrator/language/en-GB/en-GB.ini @@ -126,7 +126,6 @@ JUNPUBLISHED="Unpublished" JVERSION="Version" JYES="Yes" JACTIONS="Actions for: %s" -JLOADING="Loading" JACTION_ADMIN="Configure ACL & Options" JACTION_ADMIN_COMPONENT_DESC="Allows users in the group to edit the options and permissions of this extension." From 08745a04edcb29d268467de064bbac2fefdd383f Mon Sep 17 00:00:00 2001 From: Georgios Papadakis Date: Fri, 23 Dec 2016 23:00:33 +0200 Subject: [PATCH 07/10] CS --- administrator/components/com_fields/helpers/fields.php | 1 - 1 file changed, 1 deletion(-) diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php index c10e2eb7a7a9f..10f9d0fb41463 100644 --- a/administrator/components/com_fields/helpers/fields.php +++ b/administrator/components/com_fields/helpers/fields.php @@ -11,7 +11,6 @@ JLoader::register('FieldsHelperInternal', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/internal.php'); JLoader::register('JFolder', JPATH_LIBRARIES . '/joomla/filesystem/folder.php'); - /** * FieldsHelper * From 82ae6df98044a5614df1a8963cf0f35bdd9d0bb5 Mon Sep 17 00:00:00 2001 From: Georgios Papadakis Date: Fri, 23 Dec 2016 23:01:27 +0200 Subject: [PATCH 08/10] Revert frontend lang changes --- language/en-GB/en-GB.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/language/en-GB/en-GB.ini b/language/en-GB/en-GB.ini index 68a3713ba675c..e4e96259a3fe4 100644 --- a/language/en-GB/en-GB.ini +++ b/language/en-GB/en-GB.ini @@ -103,7 +103,6 @@ JTRUE="True" JUNPUBLISHED="Unpublished" JYEAR="Year" JYES="Yes" -JLOADING="Loading" JBROWSERTARGET_MODAL="Modal" JBROWSERTARGET_NEW="Open in new window" From a15d4d363d52b1a7bc3b0810046cfc6b4f5d3afe Mon Sep 17 00:00:00 2001 From: ggppdk Date: Sun, 25 Dec 2016 06:12:02 +0200 Subject: [PATCH 09/10] Added Joomla loading overlay to new field form when changing field type --- .../components/com_fields/models/fields/type.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/administrator/components/com_fields/models/fields/type.php b/administrator/components/com_fields/models/fields/type.php index dbd7395e633bc..52057ec7d0b96 100644 --- a/administrator/components/com_fields/models/fields/type.php +++ b/administrator/components/com_fields/models/fields/type.php @@ -146,13 +146,18 @@ function ($a, $b) $uri->setVar('view', null); $uri->setVar('layout', null); - JFactory::getDocument()->addScriptDeclaration( - "function typeHasChanged(element){ + + JFactory::getDocument()->addScriptDeclaration(" + jQuery( document ).ready(function() { + Joomla.loadingLayer('load'); + }); + function typeHasChanged(element){ var cat = jQuery(element); jQuery('input[name=task]').val('field.storeform'); element.form.action='" . $uri . "'; element.form.submit(); - }"); + } + "); return $options; } From 0ee2b7b5f423b99518b76dd020cb41b32f4583c7 Mon Sep 17 00:00:00 2001 From: Georgios Papadakis Date: Sat, 7 Jan 2017 13:46:11 +0200 Subject: [PATCH 10/10] Added Joomla.loadingLayer show to typeHasChanged JS method too --- administrator/components/com_fields/models/fields/type.php | 1 + 1 file changed, 1 insertion(+) diff --git a/administrator/components/com_fields/models/fields/type.php b/administrator/components/com_fields/models/fields/type.php index 52057ec7d0b96..11e79666bcac6 100644 --- a/administrator/components/com_fields/models/fields/type.php +++ b/administrator/components/com_fields/models/fields/type.php @@ -152,6 +152,7 @@ function ($a, $b) Joomla.loadingLayer('load'); }); function typeHasChanged(element){ + Joomla.loadingLayer('show'); var cat = jQuery(element); jQuery('input[name=task]').val('field.storeform'); element.form.action='" . $uri . "';