mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-30 19:08:37 +00:00 
			
		
		
		
	Fix incorrect toggle buttons (#23676)
				
					
				
			Some of those are still Copy&Paste problems.
This PR:
* Only cleans the legacy incorrect code, doesn't change or improve the
"action" logic.
* Remove the redundant `$('.toggle.button').on('click')`, now
`$('.show-panel.button').on('click')` handles that kinds of buttons
Actually, there is only one correct "toggle button" in code, the one on
the webhook page.
No need to backport.
			
			
This commit is contained in:
		| @@ -118,10 +118,6 @@ export function initGlobalCommon() { | ||||
|  | ||||
|   $('.tabular.menu .item').tab(); | ||||
|  | ||||
|   $('.toggle.button').on('click', function () { | ||||
|     toggleElem($($(this).data('target'))); | ||||
|   }); | ||||
|  | ||||
|   // prevent multiple form submissions on forms containing .loading-button | ||||
|   document.addEventListener('submit', (e) => { | ||||
|     const btn = e.target.querySelector('.loading-button'); | ||||
| @@ -310,8 +306,15 @@ export function initGlobalButtons() { | ||||
|   }); | ||||
|  | ||||
|   $('.show-panel.button').on('click', function (e) { | ||||
|     // a '.show-panel.button' can show a panel, by `data-panel="selector"` | ||||
|     // if the button is a "toggle" button, it toggles the panel | ||||
|     e.preventDefault(); | ||||
|     showElem($(this).data('panel')); | ||||
|     const sel = $(this).attr('data-panel'); | ||||
|     if (this.classList.contains('toggle')) { | ||||
|       toggleElem(sel); | ||||
|     } else { | ||||
|       showElem(sel); | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   $('.hide-panel.button').on('click', function (e) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user