mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 06:19:45 +00:00 
			
		
		
		
	Fix repo home file list (#32788)
1. use grid instead of table, completely drop "ui table" from that list 2. move some "commit sign" related styles into a new file by the way (no change) because I need to figure out where `#repo-files-table` is used. 3. move legacy "branch/tag selector" related code into repo-legacy.ts, now there are 13 `import $` files left.
This commit is contained in:
		| @@ -1,5 +1,4 @@ | ||||
| import $ from 'jquery'; | ||||
| import {hideElem, queryElems, showElem} from '../utils/dom.ts'; | ||||
| import {queryElems} from '../utils/dom.ts'; | ||||
| import {POST} from '../modules/fetch.ts'; | ||||
| import {showErrorToast} from '../modules/toast.ts'; | ||||
| import {sleep} from '../utils.ts'; | ||||
| @@ -92,6 +91,8 @@ function initCloneSchemeUrlSelection(parent: Element) { | ||||
|  | ||||
| function initClonePanelButton(btn: HTMLButtonElement) { | ||||
|   const elPanel = btn.nextElementSibling; | ||||
|   // "init" must be before the "createTippy" otherwise the "tippy-target" will be removed from the document | ||||
|   initCloneSchemeUrlSelection(elPanel); | ||||
|   createTippy(btn, { | ||||
|     content: elPanel, | ||||
|     trigger: 'click', | ||||
| @@ -99,7 +100,6 @@ function initClonePanelButton(btn: HTMLButtonElement) { | ||||
|     interactive: true, | ||||
|     hideOnClick: true, | ||||
|   }); | ||||
|   initCloneSchemeUrlSelection(elPanel); | ||||
| } | ||||
|  | ||||
| export function initRepoCloneButtons() { | ||||
| @@ -107,33 +107,6 @@ export function initRepoCloneButtons() { | ||||
|   queryElems(document, '.clone-buttons-combo', initCloneSchemeUrlSelection); | ||||
| } | ||||
|  | ||||
| export function initRepoCommonBranchOrTagDropdown(selector: string) { | ||||
|   $(selector).each(function () { | ||||
|     const $dropdown = $(this); | ||||
|     $dropdown.find('.reference.column').on('click', function () { | ||||
|       hideElem($dropdown.find('.scrolling.reference-list-menu')); | ||||
|       showElem($($(this).data('target'))); | ||||
|       return false; | ||||
|     }); | ||||
|   }); | ||||
| } | ||||
|  | ||||
| export function initRepoCommonFilterSearchDropdown(selector: string) { | ||||
|   const $dropdown = $(selector); | ||||
|   if (!$dropdown.length) return; | ||||
|  | ||||
|   $dropdown.dropdown({ | ||||
|     fullTextSearch: 'exact', | ||||
|     selectOnKeydown: false, | ||||
|     onChange(_text, _value, $choice) { | ||||
|       if ($choice[0].getAttribute('data-url')) { | ||||
|         window.location.href = $choice[0].getAttribute('data-url'); | ||||
|       } | ||||
|     }, | ||||
|     message: {noResults: $dropdown[0].getAttribute('data-no-results')}, | ||||
|   }); | ||||
| } | ||||
|  | ||||
| export async function updateIssuesMeta(url, action, issue_ids, id) { | ||||
|   try { | ||||
|     const response = await POST(url, {data: new URLSearchParams({action, issue_ids, id})}); | ||||
|   | ||||
| @@ -8,9 +8,7 @@ import { | ||||
| } from './repo-issue.ts'; | ||||
| import {initUnicodeEscapeButton} from './repo-unicode-escape.ts'; | ||||
| import {initRepoBranchTagSelector} from '../components/RepoBranchTagSelector.vue'; | ||||
| import { | ||||
|   initRepoCloneButtons, initRepoCommonBranchOrTagDropdown, initRepoCommonFilterSearchDropdown, | ||||
| } from './repo-common.ts'; | ||||
| import {initRepoCloneButtons} from './repo-common.ts'; | ||||
| import {initCitationFileCopyContent} from './citation.ts'; | ||||
| import {initCompLabelEdit} from './comp/LabelEdit.ts'; | ||||
| import {initRepoDiffConversationNav} from './repo-diff.ts'; | ||||
| @@ -36,6 +34,33 @@ export function initBranchSelectorTabs() { | ||||
|   }); | ||||
| } | ||||
|  | ||||
| function initRepoCommonBranchOrTagDropdown(selector: string) { | ||||
|   $(selector).each(function () { | ||||
|     const $dropdown = $(this); | ||||
|     $dropdown.find('.reference.column').on('click', function () { | ||||
|       hideElem($dropdown.find('.scrolling.reference-list-menu')); | ||||
|       showElem($($(this).data('target'))); | ||||
|       return false; | ||||
|     }); | ||||
|   }); | ||||
| } | ||||
|  | ||||
| function initRepoCommonFilterSearchDropdown(selector: string) { | ||||
|   const $dropdown = $(selector); | ||||
|   if (!$dropdown.length) return; | ||||
|  | ||||
|   $dropdown.dropdown({ | ||||
|     fullTextSearch: 'exact', | ||||
|     selectOnKeydown: false, | ||||
|     onChange(_text, _value, $choice) { | ||||
|       if ($choice[0].getAttribute('data-url')) { | ||||
|         window.location.href = $choice[0].getAttribute('data-url'); | ||||
|       } | ||||
|     }, | ||||
|     message: {noResults: $dropdown[0].getAttribute('data-no-results')}, | ||||
|   }); | ||||
| } | ||||
|  | ||||
| export function initRepository() { | ||||
|   if (!$('.page-content.repository').length) return; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user