fix: [js:bootstrap-helper] Correctly returns promise
parent
cd8d537273
commit
41f96dedcb
|
@ -2,7 +2,7 @@
|
|||
if (!isset($data['requirement']) || $data['requirement']) {
|
||||
if (!empty($data['popover_url'])) {
|
||||
$onClick = sprintf(
|
||||
'onClick="openModalForButton(%s)"',
|
||||
'onClick="openModalForButton(this, %s)"',
|
||||
sprintf("'%s'", h($data['popover_url']))
|
||||
);
|
||||
}
|
||||
|
@ -69,7 +69,11 @@
|
|||
?>
|
||||
|
||||
<script>
|
||||
function openModalForButton(url) {
|
||||
UI.openModalFromURL(url, '<?= $this->Url->build(['action' => 'index']); ?>', '<?= $tableRandomValue ?>')
|
||||
function openModalForButton(clicked, url) {
|
||||
const loadingOverlay = new OverlayFactory(clicked);
|
||||
loadingOverlay.show()
|
||||
UI.openModalFromURL(url, '<?= $this->Url->build(['action' => 'index']); ?>', '<?= $tableRandomValue ?>').finally(() => {
|
||||
loadingOverlay.hide()
|
||||
})
|
||||
}
|
||||
</script>
|
|
@ -52,7 +52,7 @@ class UIFactory {
|
|||
* @return {Promise<Object>} Promise object resolving to the ModalFactory object
|
||||
*/
|
||||
openModalFromURL(url, reloadUrl=false, tableId=false) {
|
||||
UI.modalFromURL(url, () => {
|
||||
return UI.modalFromURL(url, () => {
|
||||
if (reloadUrl === false || tableId === false) { // Try to get information from the DOM
|
||||
let $elligibleTable = $('table.table')
|
||||
let currentModel = location.pathname.split('/')[1]
|
||||
|
|
Loading…
Reference in New Issue