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