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:
parent
18061af490
commit
4814f43af7
11 changed files with 441 additions and 559 deletions
|
@ -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})});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue