csmith1188 / formbar

Interactive Classroom Mangement Tool using Raspberry Pi, Python, and NeoPixels
5 stars 55 forks source link

Conflicting Accordion Code in /controlpanel #403

Open csmith1188 opened 1 year ago

csmith1188 commented 1 year ago

Firstly, please stop importing jquery externally. jquery is already loaded in the header*.html templates.

Second, each user in the /controlpanel user list needs to be in a black header "tag".

Third, there is a conflict between the exiting code that "Expands All" and "Collapes All" users in the /controlpanel. Remove the old code that opens and closes individual users and replace the code in the Expand/Collapse button with the appropriate code to expand all users or collapse all users in jQuery.

The problem is the jquery accordion works until the original accordion code takes over from a status polling and disables the jquery.

csmith1188 commented 1 year ago

I haven't looked at the code yet, but I believe what's happening is the page will poll the students through an API call every few seconds, and erase the list and replace it with a new list of users. This has the annoying effect of cancelling your dropdown menu if you're trying to change a user's permissions.

What is also does is remove the existing elements from the jquery accordion widget, and puts new elements in that are not handled by the jquery accordion. The refresh() method in the accordion object may fix this. You may also hav to

Possibly as a separate issue, we should probably compare the polled/websocket list of users and check for the ones that are added/removed and ONLY add/remove those users. Hopefully, this will prevent cancelling the drop-down while updating the list.