mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-31 06:21:11 +00:00 
			
		
		
		
	If a change is part of a force-push and the commit(s) have a CI status, this will now be shown after the hashes. `interactiveBorder` has been lowered as it was possible to activate the hover state for both commits. It would be unreasonable to test this within Playwright and thus this needs to be manually tested. On a pull request page that contains a force-push you will notice: a) the (de)activation area for force-pushes is now smaller, and; b) it is not possible to activate the hover state/popup for both commits. ExecuteTemplate function from @gusted https://codeberg.org/forgejo/forgejo/pulls/5168 https://codeberg.org/forgejo/forgejo/pulls/2884 Close #4932 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8655 Reviewed-by: Otto <otto@codeberg.org> Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: Squel <squeljur+git@gmail.com> Co-committed-by: Squel <squeljur+git@gmail.com>
		
			
				
	
	
		
			45 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import {createTippy} from '../modules/tippy.js';
 | |
| import {toggleElem} from '../utils/dom.js';
 | |
| 
 | |
| export function initRepoEllipsisButton() {
 | |
|   for (const button of document.querySelectorAll('.js-toggle-commit-body')) {
 | |
|     button.addEventListener('click', function (e) {
 | |
|       e.preventDefault();
 | |
|       const expanded = this.getAttribute('aria-expanded') === 'true';
 | |
|       toggleElem(this.parentElement.querySelector('.commit-body'));
 | |
|       this.setAttribute('aria-expanded', String(!expanded));
 | |
|     });
 | |
|   }
 | |
| }
 | |
| 
 | |
| export function initCommitStatuses() {
 | |
|   for (const element of document.querySelectorAll('[data-tippy="commit-statuses"]')) {
 | |
|     const top = document.querySelector('.repository.file.list') || document.querySelector('.repository.diff');
 | |
| 
 | |
|     createTippy(element, {
 | |
|       content: element.nextElementSibling,
 | |
|       placement: top ? 'top-start' : 'bottom-start',
 | |
|       interactive: true,
 | |
|       role: 'dialog',
 | |
|       theme: 'box-with-header',
 | |
|       interactiveBorder: element.closest('.forced-push') ? 0 : 20,
 | |
|     });
 | |
|   }
 | |
| }
 | |
| 
 | |
| export function initCommitNotes() {
 | |
|   const notesEditButton = document.getElementById('commit-notes-edit-button');
 | |
|   if (notesEditButton !== null) {
 | |
|     notesEditButton.addEventListener('click', () => {
 | |
|       document.getElementById('commit-notes-display-area').classList.add('tw-hidden');
 | |
|       document.getElementById('commit-notes-edit-area').classList.remove('tw-hidden');
 | |
|     });
 | |
|   }
 | |
| 
 | |
|   const notesAddButton = document.getElementById('commit-notes-add-button');
 | |
|   if (notesAddButton !== null) {
 | |
|     notesAddButton.addEventListener('click', () => {
 | |
|       document.getElementById('commit-notes-add-area').classList.remove('tw-hidden');
 | |
|     });
 | |
|   }
 | |
| }
 |