-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Outsource initialization of Bootstrap popovers (Fix "New comment" button) #534
Conversation
…e to have no effect, if pressed multiple times. The reason for this is that the variables popoverTriggerList and popoverList (in the file that is being changed for this commit) are declared as constants. Clicking the button a second time causes the script to run again such that the variables will be defined a second time.
Codecov Report
@@ Coverage Diff @@
## mampf-next #534 +/- ##
===========================================
Coverage 66.48% 66.48%
===========================================
Files 311 311
Lines 9417 9417
===========================================
Hits 6261 6261
Misses 3156 3156 |
@Frodo161 You're change certainly gets the job done. However, the code you were touching is actually duplicated code. Bootstrap requires to manually initialize popovers. When we dynamically add content to the page, we have to reinitialize this. I outsourced this behavior to a new function in If you are fine with this, please make sure to test that popovers work everywhere, e.g. test popovers at some places, but especially in places where content is loaded dynamically, e.g. when you add a new chapter and a modal opens for that operation that has some popovers (helptexts) in it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see anything in the code (except the two missing lines you already added).
In my local MaMpf environment I tested some popovers (chapters, sections, lessons, comments and some more) and everything worked.
This branch fixes issue #524: Open the show_comment page. Hit the "new comment" button, then click "abort". Hitting the "new comment" button again won't have any effect now.
The problem is that two variables in the edit javascript file are declared as constants while hitting the button twice causes them to be redefined.
Changing the variable declaration from "const" to "var" won't cause any problems in this situation and fixes the bug.