cuny-academic-commons / cbox-theme

Default theme for Commons In A Box
GNU General Public License v2.0
20 stars 15 forks source link

Duplicate tabs created when clicking on toolbar button multiple times in Theme Options page #266

Closed r-a-y closed 5 years ago

r-a-y commented 5 years ago

Reported internally.

When on the CBOX Theme Options page, if you click on a toolbar button multiple times (Start, Options, User Docs, Dev Docs), duplicate tabs are created in the main horizontal navigation of the page.

To fix this, I had to alter the jquery.juicy.browsertabs JS in a few places:

It appears that the _getIndex() method returns the incorrect tab index, so I created a new method, getTabIndex(), to do this. Could this be more elegant? Yes, but I'm not too familiar with the JS.

I believe jquery.juicy was created for CBOX Theme, since I couldn't find anything online about it. I could be wrong though. If we don't want to patch up juicy.browsertabs, we could also copy the changes over to dashboard/assets/js/cpanel.js since that file extends juicy.browsertabs, but that would require duplicating the methods I mention above.

I also removed a line where the JS was trying to load the same AJAX hook again after clicking on a toolbar button. See commit 8577149.

Tested in Chrome, Firefox and Edge.