HGustavs / LenaSYS

Code Viewer and Course Organization System used in some courses at University of Skövde
57 stars 31 forks source link

The new toast system is missing in fileed.php #16169

Open a22chrfa opened 4 months ago

a22chrfa commented 4 months ago

There was an issue created (#16121) which has not yet been acted upon. No commits has been done as far as I can tell.

The issue reads "Integrate toasts to replace all alerts in fileed.php. I'e when deleting a file an alert is shown."

I've taken a quick look. The alert is not only an alert, it is a chance for the user to select yes or no in case a trashcan was missclicked. I don't think this should be removed, but I still think implementing the toast as a confirmation of deletion is good idea.

a22chrfa commented 4 months ago

Read the documentation here: https://github.com/HGustavs/LenaSYS/wiki/Toast

Have made a first implementation and test. Seems to work. As of now the toast always shows after clicking the button. Will have to add conditionals.

a22chrfa commented 4 months ago

I've tried wrapping the call in AJAXService in a promise-object´: image

And then using this to show the correct toast and log: image

But it isn't working. It seems the promise isn't working. I'm not sure why, and I would have to research promise objects more in order to solve this.

Since it's taking up too much time and research would only result in me spending time. I will likely make a pull request with the toast for deletion, as the toast is implemented, but the handling of errors would probably be better suited in a separate issue since the first few attempts suggest that it might need a more thorough looking into. I've wasted much time as it is trying to get the promise to what I thought was right.

a22chrfa commented 3 months ago

The problem is that the confirmation box uses the alert. And the alert that is part of another library is making a follow up check.

Essentially, the toast is now showing after clicking yes. But when clicking yes you might get information that it can't be removed. Still, the toast is there.

This would require a lot to fix and would make this issue very long and slighly alter the scope. This will therefore be be commited in it's current state with the suggestion that a follow up issue would deal specifically with changing the current confirmation.