mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 13:28:25 +00:00 
			
		
		
		
	Remove fomantic checkbox module (#30162)
CSS is pretty slim already and the `.ui.toggle.checkbox` sliders on admin page also still work. The only necessary JS is the one that links `input` and `label` so that it can be toggled via label. All checkboxes except the markdown ones render at `--checkbox-size: 16px` now. <img width="174" alt="Screenshot 2024-03-28 at 22 15 10" src="https://github.com/go-gitea/gitea/assets/115237/3455c1bb-166b-47e4-9847-2d20dd1f04db"> <img width="499" alt="Screenshot 2024-03-28 at 21 00 07" src="https://github.com/go-gitea/gitea/assets/115237/412be2b3-d5a0-478a-b17b-43e6bc12e8ce"> <img width="83" alt="Screenshot 2024-03-28 at 22 14 34" src="https://github.com/go-gitea/gitea/assets/115237/d8c89838-a420-4723-8c49-89405bb39474"> --------- Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
		@@ -282,32 +282,26 @@ export function initRepoPullRequestMergeInstruction() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function initRepoPullRequestAllowMaintainerEdit() {
 | 
			
		||||
  const checkbox = document.getElementById('allow-edits-from-maintainers');
 | 
			
		||||
  if (!checkbox) return;
 | 
			
		||||
  const wrapper = document.getElementById('allow-edits-from-maintainers');
 | 
			
		||||
  if (!wrapper) return;
 | 
			
		||||
 | 
			
		||||
  const $checkbox = $(checkbox);
 | 
			
		||||
 | 
			
		||||
  const promptError = checkbox.getAttribute('data-prompt-error');
 | 
			
		||||
  $checkbox.checkbox({
 | 
			
		||||
    'onChange': async () => {
 | 
			
		||||
      const checked = $checkbox.checkbox('is checked');
 | 
			
		||||
      let url = checkbox.getAttribute('data-url');
 | 
			
		||||
      url += '/set_allow_maintainer_edit';
 | 
			
		||||
      $checkbox.checkbox('set disabled');
 | 
			
		||||
      try {
 | 
			
		||||
        const response = await POST(url, {
 | 
			
		||||
          data: {allow_maintainer_edit: checked},
 | 
			
		||||
        });
 | 
			
		||||
        if (!response.ok) {
 | 
			
		||||
          throw new Error('Failed to update maintainer edit permission');
 | 
			
		||||
        }
 | 
			
		||||
      } catch (error) {
 | 
			
		||||
        console.error(error);
 | 
			
		||||
        showTemporaryTooltip(checkbox, promptError);
 | 
			
		||||
      } finally {
 | 
			
		||||
        $checkbox.checkbox('set enabled');
 | 
			
		||||
  wrapper.querySelector('input[type="checkbox"]')?.addEventListener('change', async (e) => {
 | 
			
		||||
    const checked = e.target.checked;
 | 
			
		||||
    const url = `${wrapper.getAttribute('data-url')}/set_allow_maintainer_edit`;
 | 
			
		||||
    wrapper.classList.add('is-loading');
 | 
			
		||||
    e.target.disabled = true;
 | 
			
		||||
    try {
 | 
			
		||||
      const response = await POST(url, {data: {allow_maintainer_edit: checked}});
 | 
			
		||||
      if (!response.ok) {
 | 
			
		||||
        throw new Error('Failed to update maintainer edit permission');
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    } catch (error) {
 | 
			
		||||
      console.error(error);
 | 
			
		||||
      showTemporaryTooltip(wrapper, wrapper.getAttribute('data-prompt-error'));
 | 
			
		||||
    } finally {
 | 
			
		||||
      wrapper.classList.remove('is-loading');
 | 
			
		||||
      e.target.disabled = false;
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user