@@ -38,7 +38,9 @@ protected function _ajax($method, $url, $responseElement = "", $parameters = [])
38
38
$ retour .= $ before ;
39
39
if ($ hasLoader === true && JString::isNotNull ($ responseElement )) {
40
40
$ this ->addLoading ($ retour , $ responseElement , $ ajaxLoader );
41
- } elseif ($ hasLoader === "internal " ) {
41
+ } elseif ($ hasLoader === 'response ' ) {
42
+ $ this ->addResponseLoading ($ retour , $ responseElement , $ ajaxLoader );
43
+ } elseif ($ hasLoader === 'internal ' ) {
42
44
$ retour .= "\n$(this).addClass('loading'); " ;
43
45
}
44
46
$ ajaxParameters = [
@@ -202,6 +204,14 @@ public static function _implodeParams($parameters) {
202
204
}
203
205
204
206
protected function addLoading (&$ retour , $ responseElement , $ ajaxLoader = null ) {
207
+ if (! isset ($ ajaxLoader )) {
208
+ $ ajaxLoader = $ this ->ajaxLoader ;
209
+ }
210
+ $ loading_notifier = '<div class="ajax-loader ui active inverted dimmer"> ' . $ ajaxLoader . '</div> ' ;
211
+ $ retour .= "\t\t{$ responseElement }.append(' {$ loading_notifier }'); \n" ;
212
+ }
213
+
214
+ protected function addResponseLoading (&$ retour , $ responseElement , $ ajaxLoader = null ) {
205
215
if (! isset ($ ajaxLoader )) {
206
216
$ ajaxLoader = $ this ->ajaxLoader ;
207
217
}
@@ -729,7 +739,9 @@ private function _postForm($url, $form, $responseElement, $parameters = []) {
729
739
$ retour .= $ before ;
730
740
if ($ hasLoader === true ) {
731
741
$ this ->addLoading ($ retour , $ responseElement , $ ajaxLoader );
732
- } elseif ($ hasLoader === "internal " ) {
742
+ } elseif ($ hasLoader === 'response ' ) {
743
+ $ this ->addResponseLoading ($ retour , $ responseElement , $ ajaxLoader );
744
+ } elseif ($ hasLoader === 'internal ' ) {
733
745
$ retour .= "\n$(this).addClass('loading'); " ;
734
746
}
735
747
$ ajaxParameters = [
0 commit comments