diff --git a/CHANGELOG-DEV.md b/CHANGELOG-DEV.md
index ff96dcb606..a0cd58bc25 100644
--- a/CHANGELOG-DEV.md
+++ b/CHANGELOG-DEV.md
@@ -51,3 +51,4 @@ HumHub Changelog
- Enh #6369: Don't pin draft and scheduled contents on dashboard
- Enh #6370: Remove FlatElements CSS
- Enh #6384: Added Serbian(sr) language
+- Enh #6389: Remove deprecated JS function `setModalLoader()`
diff --git a/MIGRATE-DEV.md b/MIGRATE-DEV.md
index 1538524138..fecffb6f4c 100644
--- a/MIGRATE-DEV.md
+++ b/MIGRATE-DEV.md
@@ -13,6 +13,7 @@ Version 1.15 (Unreleased)
want to match against the end of the names.
- `\humhub\libs\BaseSettingsManager::get()` now returns a pure int in case the (trimmed) value can be converted
- New `PolymorphicRelation::getObjectModel()`: should replace `get_class()`
+- Removed deprecated javascript method `setModalLoader()`
### Type restrictions
diff --git a/protected/humhub/config/assets-prod.php b/protected/humhub/config/assets-prod.php
index 243e7a289d..7e2a6461d8 100644
--- a/protected/humhub/config/assets-prod.php
+++ b/protected/humhub/config/assets-prod.php
@@ -2,7 +2,7 @@
/**
* This file is generated by the "yii asset" command.
* DO NOT MODIFY THIS FILE DIRECTLY.
- * @version 2023-06-02 15:55:23
+ * @version 2023-06-14 17:22:59
*/
return [
'app' => [
diff --git a/protected/humhub/modules/admin/views/module/setAsDefault.php b/protected/humhub/modules/admin/views/module/setAsDefault.php
index be5d6f4c2f..c8e298ccfe 100644
--- a/protected/humhub/modules/admin/views/module/setAsDefault.php
+++ b/protected/humhub/modules/admin/views/module/setAsDefault.php
@@ -4,7 +4,6 @@ use humhub\modules\space\models\Space;
use humhub\modules\ui\form\widgets\ActiveForm;
use humhub\modules\user\models\User;
use humhub\widgets\AjaxButton;
-use humhub\widgets\LoaderWidget;
/**
* @var $module \humhub\components\Module
@@ -51,8 +50,8 @@ use humhub\widgets\LoaderWidget;
'label' => Yii::t('AdminModule.modules', 'Save'),
'ajaxOptions' => [
'type' => 'POST',
- 'beforeSend' => new yii\web\JsExpression('function(){ setModalLoader(); }'),
- 'success' => new yii\web\JsExpression('function(html){ $("#globalModal").html(html); }'),
+ 'beforeSend' => new yii\web\JsExpression('humhub.require("ui.modal").footerLoader'),
+ 'success' => new yii\web\JsExpression('humhub.require("ui.modal").setContent'),
'url' => \yii\helpers\Url::to(['/admin/module/set-as-default', 'moduleId' => $module->id]),
],
'htmlOptions' => ['class' => 'btn btn-primary']
@@ -61,8 +60,6 @@ use humhub\widgets\LoaderWidget;
-
- = LoaderWidget::widget(['id' => 'default-loader', 'cssClass' => 'loader-modal hidden']); ?>
diff --git a/protected/humhub/modules/space/views/membership/requestMembership.php b/protected/humhub/modules/space/views/membership/requestMembership.php
index f7181272bd..cc9dbcc562 100644
--- a/protected/humhub/modules/space/views/membership/requestMembership.php
+++ b/protected/humhub/modules/space/views/membership/requestMembership.php
@@ -5,7 +5,6 @@ use humhub\modules\space\models\forms\RequestMembershipForm;
use humhub\modules\space\models\Space;
use humhub\modules\ui\form\widgets\ActiveForm;
use humhub\widgets\AjaxButton;
-use humhub\widgets\LoaderWidget;
/**
* @var $space Space
@@ -39,8 +38,8 @@ use humhub\widgets\LoaderWidget;
'label' => Yii::t('SpaceModule.base', 'Send'),
'ajaxOptions' => [
'type' => 'POST',
- 'beforeSend' => new yii\web\JsExpression('function(){ setModalLoader(evt); }'),
- 'success' => new yii\web\JsExpression('function(html){ $("#globalModal").html(html); }'),
+ 'beforeSend' => new yii\web\JsExpression('humhub.require("ui.modal").footerLoader'),
+ 'success' => new yii\web\JsExpression('humhub.require("ui.modal").setContent'),
'url' => $space->createUrl('/space/membership/request-membership-form'),
],
'htmlOptions' => [
@@ -51,8 +50,6 @@ use humhub\widgets\LoaderWidget;
-
- = LoaderWidget::widget(['id' => 'send-loader', 'cssClass' => 'loader-modal hidden']); ?>
diff --git a/protected/humhub/widgets/AjaxLinkPager.php b/protected/humhub/widgets/AjaxLinkPager.php
index 76266ec8a2..9aec965952 100644
--- a/protected/humhub/widgets/AjaxLinkPager.php
+++ b/protected/humhub/widgets/AjaxLinkPager.php
@@ -25,14 +25,14 @@ class AjaxLinkPager extends \humhub\widgets\LinkPager
*
* @var string
*/
- public $jsBeforeSend = 'function(){ setModalLoader(); }';
+ public $jsBeforeSend = 'humhub.require("ui.modal").footerLoader';
/**
* Success Javascript Expression
*
- * @var string
+ * @var string
*/
- public $jsSuccess = 'function(html){ $("#globalModal").html(html); }';
+ public $jsSuccess = 'humhub.require("ui.modal").setContent';
/**
* @inheritdoc
diff --git a/static/js/humhub/humhub.ui.additions.js b/static/js/humhub/humhub.ui.additions.js
index e80de56993..dcd8395319 100644
--- a/static/js/humhub/humhub.ui.additions.js
+++ b/static/js/humhub/humhub.ui.additions.js
@@ -415,15 +415,3 @@ humhub.module('ui.additions', function (module, require, $) {
};
})(jQuery, window);
-
-/**
- * @deprecated since v1.2
- */
-function setModalLoader(evt) {
- var modalFooter = $('.modal-footer');
- if (typeof evt === 'object') {
- modalFooter = $(evt.target).closest('.modal-footer');
- }
- modalFooter.find('.btn').hide();
- modalFooter.find('.loader').removeClass('hidden');
-}
\ No newline at end of file
diff --git a/static/js/humhub/humhub.ui.modal.js b/static/js/humhub/humhub.ui.modal.js
index bc46657376..b44743c1ef 100644
--- a/static/js/humhub/humhub.ui.modal.js
+++ b/static/js/humhub/humhub.ui.modal.js
@@ -128,6 +128,13 @@ humhub.module('ui.modal', function (module, require, $) {
this.show();
};
+ /**
+ * Sets the loader to footer in order to inactivate the action buttons
+ */
+ Modal.prototype.footerLoader = function () {
+ loader.set(this.getFooter(), {css: {padding: '13px 0 14px'}});
+ }
+
/**
* Sets the default content (a loader animation)
* @returns {undefined}
@@ -756,6 +763,14 @@ humhub.module('ui.modal', function (module, require, $) {
};
};
+ const footerLoader = function () {
+ module.global.footerLoader();
+ }
+
+ const setContent = function (html) {
+ module.global.setContent(html);
+ }
+
module.export({
init: init,
sortOrder: 100,
@@ -767,6 +782,8 @@ humhub.module('ui.modal', function (module, require, $) {
load: load,
unload: unload,
show: show,
- submit: submit
+ submit: submit,
+ footerLoader,
+ setContent
});
});
diff --git a/static/js/humhub/legacy/app.js b/static/js/humhub/legacy/app.js
index 893f9a9e0f..cc9a4b0d9b 100644
--- a/static/js/humhub/legacy/app.js
+++ b/static/js/humhub/legacy/app.js
@@ -1,12 +1,4 @@
-/**
- * @deprecated since v1.2
- */
-function setModalLoader() {
- $(".modal-footer .btn").hide();
- $(".modal-footer .loader").removeClass("hidden");
-}
-
/**
* USED in fileuploader.js
*/