From b1e7b27ad3811494c58072e09e043ed7598e1538 Mon Sep 17 00:00:00 2001 From: Georgios Papadakis Date: Sat, 14 Jan 2017 22:17:55 +0200 Subject: [PATCH] [com_fields] Add Joomla loading overlay when form submit is triggered by category selector change (#13320) * Added overlay box and message box for submit and reload form after category change * Removed commented testing code * Added language strings * CS fix, added missing spaces * Used Joomla logo spinner instead of fixed message * Reverted changes in admin lang file * CS * Revert frontend lang changes * Added Joomla loading overlay to new field form when changing field type * Added Joomla.loadingLayer show to typeHasChanged JS method too --- .../components/com_fields/helpers/fields.php | 8 ++++++-- .../components/com_fields/models/fields/type.php | 12 +++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php index 2f1338ab556c8..6a3d89e17865c 100644 --- a/administrator/components/com_fields/helpers/fields.php +++ b/administrator/components/com_fields/helpers/fields.php @@ -320,8 +320,11 @@ public static function prepareForm($context, JForm $form, $data) * has changed */ $form->setFieldAttribute('catid', 'onchange', 'categoryHasChanged(this);'); - JFactory::getDocument()->addScriptDeclaration( - "function categoryHasChanged(element){ + + // Preload spindle-wheel when we need to submit form due to category selector changed + JFactory::getDocument()->addScriptDeclaration(" + function categoryHasChanged(element) { + Joomla.loadingLayer('show'); var cat = jQuery(element); if (cat.val() == '" . $assignedCatids . "')return; jQuery('input[name=task]').val('field.storeform'); @@ -329,6 +332,7 @@ public static function prepareForm($context, JForm $form, $data) element.form.submit(); } jQuery( document ).ready(function() { + Joomla.loadingLayer('load'); var formControl = '#" . $form->getFormControl() . "_catid'; if (!jQuery(formControl).val() != '" . $assignedCatids . "'){jQuery(formControl).val('" . $assignedCatids . "');} });"); diff --git a/administrator/components/com_fields/models/fields/type.php b/administrator/components/com_fields/models/fields/type.php index 7da01eb0fed31..48f9b02e2c2cb 100644 --- a/administrator/components/com_fields/models/fields/type.php +++ b/administrator/components/com_fields/models/fields/type.php @@ -86,13 +86,19 @@ 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){ + Joomla.loadingLayer('show'); var cat = jQuery(element); jQuery('input[name=task]').val('field.storeform'); element.form.action='" . $uri . "'; element.form.submit(); - }"); + } + "); return $options; }