How to prevent popup from closing when using GRUD


#1

I wonder if there is a way to prevent the popup from closing when using GRUD the reason it is that the user can cancel a file upload and not saving the changes to the db then the data still there while physically does not exist anymore…

I think preventing closing the popup without saving will be the solution!!!
any ideas!
thanks


#2

I think it’s outside of the scope for ATK, perhaps something can be done in JS / Semantic


#3

Thanks I will check it with semantic UI and post the solution here… thanks


#4

Theres quite some examples, shouldn’t be too hard to achieve:
https://semantic-ui.com/modules/modal.html


#5

I have seen there is. in ATK a inside Modal.php an explanation about using

$modal->notClosable().

But this works only when I want to use your own modal…

but the issue it is that I need that for the GRUD when editing a record it opens instantly a Modal to edit the record… and this modal it is closable… and I need this to be non closable; I have not found where it is the code for preventing this when using the GRUD

Any ideas?
thanks


#6

Ok, so to find out more about modals, here is how they were implemented:

  1. first jsModal was added: https://github.com/atk4/ui/pull/71/files.

It creates new modal markup and activates is with semantic ui. This code is more than a year old, so it has been cleaned up since then, but it should give you the idea.

  1. we added “static modals” or “Modal view” later. It adds a hidden modal div and only invokes semantic ui when needed. https://github.com/atk4/ui/pull/194

so we have two implementations of modal. CRUD uses jsModal. They behave very similarly though.

ATK does not have support for setting modal “not closable”, but it’s doable in SemanticUI. Perhaps setOption here can help:

Still this won’t be usable in CRUD, because it uses jsModal: https://github.com/atk4/ui/blob/develop/src/CRUD.php#L138

so it would require some tweaks to the core classes to achieve your goal.


#7

thanks for the info!!