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:
wxiaoguang 2024-12-11 23:54:42 +08:00 committed by GitHub
parent 18061af490
commit 4814f43af7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 441 additions and 559 deletions

View File

@ -102,8 +102,7 @@
{{end}}
</div>
{{/* by default, the row-right flex grows, but on non-root tree path, it should not because the row-left might contain a long path */}}
<div class="repo-button-row-right {{if not $isTreePathRoot}}tw-flex-grow-0{{end}}">
<div class="repo-button-row-right">
<!-- Only show clone panel in repository home page -->
{{if $isTreePathRoot}}
{{template "repo/clone_panel" .}}
@ -124,6 +123,9 @@
{{template "repo/code/upstream_diverging_info" .}}
{{end}}
{{template "repo/view_list" .}}
{{if and .ReadmeExist (or .IsMarkup .IsPlainText)}}
{{template "repo/view_file" .}}
{{end}}
{{end}}
</div>

View File

@ -1,5 +1,5 @@
{{if not .LatestCommit}}
<div class="ui active tiny slow centered inline"></div>
{{else}}
{{if .LatestCommitUser}}
{{ctx.AvatarUtils.Avatar .LatestCommitUser 24 "tw-mr-1"}}

View File

@ -1,73 +1,57 @@
<table id="repo-files-table" class="ui single line fixed table tw-mt-0" {{if .HasFilesWithoutLatestCommit}}hx-indicator="tr.notready td.message span" hx-trigger="load" hx-swap="morph" hx-post="{{.LastCommitLoaderURL}}"{{end}}>
<thead>
<tr class="commit-list">
<th class="tw-overflow-hidden" colspan="2">
<div class="tw-flex">
<div class="latest-commit">
{{template "repo/latest_commit" .}}
</div>
</div>
</th>
<th class="text grey right age">{{if .LatestCommit}}{{if .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}{{end}}</th>
</tr>
</thead>
<tbody>
{{if .HasParentPath}}
<tr class="has-parent">
<td colspan="3">{{svg "octicon-reply"}}<a class="muted" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">..</a></td>
</tr>
{{end}}
{{range $item := .Files}}
{{/* use grid layout, still use the old ID because there are many other CSS styles depending on this ID */}}
<div id="repo-files-table" {{if .HasFilesWithoutLatestCommit}}hx-indicator="#repo-files-table .repo-file-cell.message" hx-trigger="load" hx-swap="morph" hx-post="{{.LastCommitLoaderURL}}"{{end}}>
<div class="repo-file-line">
<div class="latest-commit">{{template "repo/latest_commit" .}}</div>
<div>{{if and .LatestCommit .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}</div>
</div>
{{if .HasParentPath}}
<div class="repo-file-line">
{{svg "octicon-reply"}} <a class="muted" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">..</a>
</div>
{{end}}
{{range $item := .Files}}
<div class="repo-file-item">
{{$entry := $item.Entry}}
{{$commit := $item.Commit}}
{{$subModuleFile := $item.SubModuleFile}}
<tr data-entryname="{{$entry.Name}}" data-ready="{{if $commit}}true{{else}}false{{end}}" class="{{if not $commit}}not{{end}}ready entry">
<td class="name four wide">
<span class="truncate">
{{if $entry.IsSubModule}}
{{svg "octicon-file-submodule"}}
{{$refURL := $subModuleFile.RefURL AppUrl $.Repository.FullName $.SSHDomain}} {{/* FIXME: the usage of AppUrl seems incorrect, it would be fixed in the future, use AppSubUrl instead */}}
{{if $refURL}}
<a class="muted" href="{{$refURL}}">{{$entry.Name}}</a><span class="at">@</span><a href="{{$refURL}}/commit/{{PathEscape $subModuleFile.RefID}}">{{ShortSha $subModuleFile.RefID}}</a>
<div class="repo-file-cell name {{if not $commit}}notready{{end}}">
{{if $entry.IsSubModule}}
{{svg "octicon-file-submodule"}}
{{$refURL := $subModuleFile.RefURL AppUrl $.Repository.FullName $.SSHDomain}} {{/* FIXME: the usage of AppUrl seems incorrect, it would be fixed in the future, use AppSubUrl instead */}}
{{if $refURL}}
<a class="muted" href="{{$refURL}}">{{$entry.Name}}</a><span class="at">@</span><a href="{{$refURL}}/commit/{{PathEscape $subModuleFile.RefID}}">{{ShortSha $subModuleFile.RefID}}</a>
{{else}}
{{$entry.Name}}<span class="at">@</span>{{ShortSha $subModuleFile.RefID}}
{{end}}
{{else}}
{{if $entry.IsDir}}
{{$subJumpablePathName := $entry.GetSubJumpablePathName}}
{{svg "octicon-file-directory-fill"}}
<a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $subJumpablePathName}}" title="{{$subJumpablePathName}}">
{{$subJumpablePathFields := StringUtils.Split $subJumpablePathName "/"}}
{{$subJumpablePathFieldLast := (Eval (len $subJumpablePathFields) "-" 1)}}
{{if eq $subJumpablePathFieldLast 0}}
{{$subJumpablePathName}}
{{else}}
{{$entry.Name}}<span class="at">@</span>{{ShortSha $subModuleFile.RefID}}
{{$subJumpablePathPrefixes := slice $subJumpablePathFields 0 $subJumpablePathFieldLast}}
<span class="text light-2">{{StringUtils.Join $subJumpablePathPrefixes "/"}}</span>/{{index $subJumpablePathFields $subJumpablePathFieldLast}}
{{end}}
{{else}}
{{if $entry.IsDir}}
{{$subJumpablePathName := $entry.GetSubJumpablePathName}}
{{svg "octicon-file-directory-fill"}}
<a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $subJumpablePathName}}" title="{{$subJumpablePathName}}">
{{$subJumpablePathFields := StringUtils.Split $subJumpablePathName "/"}}
{{$subJumpablePathFieldLast := (Eval (len $subJumpablePathFields) "-" 1)}}
{{if eq $subJumpablePathFieldLast 0}}
{{$subJumpablePathName}}
{{else}}
{{$subJumpablePathPrefixes := slice $subJumpablePathFields 0 $subJumpablePathFieldLast}}
<span class="text light-2">{{StringUtils.Join $subJumpablePathPrefixes "/"}}</span>/{{index $subJumpablePathFields $subJumpablePathFieldLast}}
{{end}}
</a>
{{else}}
{{svg (printf "octicon-%s" (EntryIcon $entry))}}
<a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a>
{{end}}
{{end}}
</span>
</td>
<td class="message nine wide">
<span class="truncate">
{{if $commit}}
{{$commitLink := printf "%s/commit/%s" $.RepoLink (PathEscape $commit.ID.String)}}
{{ctx.RenderUtils.RenderCommitMessageLinkSubject $commit.Message $commitLink ($.Repository.ComposeMetas ctx)}}
{{else}}
<div class="ui active tiny slow centered inline"></div>
{{end}}
</span>
</td>
<td class="text right age three wide">{{if $commit}}{{DateUtils.TimeSince $commit.Committer.When}}{{end}}</td>
</tr>
{{end}}
</tbody>
</table>
{{if and .ReadmeExist (or .IsMarkup .IsPlainText)}}
{{template "repo/view_file" .}}
{{end}}
</a>
{{else}}
{{svg (printf "octicon-%s" (EntryIcon $entry))}}
<a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a>
{{end}}
{{end}}
</div>
<div class="repo-file-cell message loading-icon-2px">
{{if $commit}}
{{$commitLink := printf "%s/commit/%s" $.RepoLink (PathEscape $commit.ID.String)}}
{{ctx.RenderUtils.RenderCommitMessageLinkSubject $commit.Message $commitLink ($.Repository.ComposeMetas ctx)}}
{{else}}
{{/* will be loaded again by LastCommitLoaderURL */}}
{{end}}
</div>
<div class="repo-file-cell age">{{if $commit}}{{DateUtils.TimeSince $commit.Committer.When}}{{end}}</div>
</div>
{{end}}
</div>

View File

@ -4,7 +4,7 @@
{{$title := .title}}
<div class="ui container">
<div class="repo-button-row">
<div class="tw-flex tw-items-center">
<div class="flex-text-block tw-flex-1">
<div class="ui floating filter dropdown" data-no-results="{{ctx.Locale.Tr "no_results_found"}}">
<div class="ui basic small button">
<span class="text">
@ -42,7 +42,7 @@
</div>
</div>
</div>
<div class="flex-text-block tw-flex-wrap tw-justify-end">
<div class="repo-button-row">
{{if .EscapeStatus.Escaped}}
<a class="ui small button unescape-button tw-m-0 tw-hidden">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</a>
<a class="ui small button escape-button tw-m-0">{{ctx.Locale.Tr "repo.escape_control_characters"}}</a>

View File

@ -49,7 +49,7 @@ func testViewRepo(t *testing.T) {
resp := session.MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
files := htmlDoc.doc.Find("#repo-files-table > TBODY > TR")
files := htmlDoc.doc.Find("#repo-files-table .repo-file-item")
type file struct {
fileName string
@ -61,7 +61,7 @@ func testViewRepo(t *testing.T) {
var items []file
files.Each(func(i int, s *goquery.Selection) {
tds := s.Find("td")
tds := s.Find(".repo-file-cell")
var f file
tds.Each(func(i int, s *goquery.Selection) {
if i == 0 {
@ -161,7 +161,7 @@ func TestViewRepoWithSymlinks(t *testing.T) {
resp := session.MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
files := htmlDoc.doc.Find("#repo-files-table > TBODY > TR > TD.name > SPAN.truncate")
files := htmlDoc.doc.Find("#repo-files-table .repo-file-cell.name")
items := files.Map(func(i int, s *goquery.Selection) string {
cls, _ := s.Find("SVG").Attr("class")
file := strings.Trim(s.Find("A").Text(), " \t\n")

View File

@ -66,8 +66,10 @@
@import "./repo/wiki.css";
@import "./repo/header.css";
@import "./repo/home.css";
@import "./repo/home-file-list.css";
@import "./repo/reactions.css";
@import "./repo/clone.css";
@import "./repo/commit-sign.css";
@import "./editor/fileeditor.css";
@import "./editor/combomarkdowneditor.css";

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,272 @@
.repository .ui.attached.isSigned.isWarning {
border-left: 1px solid var(--color-error-border);
border-right: 1px solid var(--color-error-border);
}
.repository .ui.attached.isSigned.isWarning.top,
.repository .ui.attached.isSigned.isWarning.message {
border-top: 1px solid var(--color-error-border);
}
.repository .ui.attached.isSigned.isWarning.message {
box-shadow: none;
background-color: var(--color-error-bg);
color: var(--color-error-text);
}
.repository .ui.attached.isSigned.isWarning.message .ui.text {
color: var(--color-error-text);
}
.repository .ui.attached.isSigned.isWarning:last-child,
.repository .ui.attached.isSigned.isWarning.bottom {
border-bottom: 1px solid var(--color-error-border);
}
.repository .ui.attached.isSigned.isVerified {
border-left: 1px solid var(--color-success-border);
border-right: 1px solid var(--color-success-border);
}
.repository .ui.attached.isSigned.isVerified.top,
.repository .ui.attached.isSigned.isVerified.message {
border-top: 1px solid var(--color-success-border);
}
.repository .ui.attached.isSigned.isVerified.message {
box-shadow: none;
background-color: var(--color-success-bg);
color: var(--color-success-text);
}
.repository .ui.attached.isSigned.isVerified.message .pull-right {
color: var(--color-text);
}
.repository .ui.attached.isSigned.isVerified.message .ui.text {
color: var(--color-success-text);
}
.repository .ui.attached.isSigned.isVerified:last-child,
.repository .ui.attached.isSigned.isVerified.bottom {
border-bottom: 1px solid var(--color-success-border);
}
.repository .ui.attached.isSigned.isVerifiedUntrusted,
.repository .ui.attached.isSigned.isVerifiedUnmatched {
border-left: 1px solid var(--color-warning-border);
border-right: 1px solid var(--color-warning-border);
}
.repository .ui.attached.isSigned.isVerifiedUntrusted.top,
.repository .ui.attached.isSigned.isVerifiedUnmatched.top,
.repository .ui.attached.isSigned.isVerifiedUntrusted.message,
.repository .ui.attached.isSigned.isVerifiedUnmatched.message {
border-top: 1px solid var(--color-warning-border);
}
.repository .ui.attached.isSigned.isVerifiedUntrusted.message,
.repository .ui.attached.isSigned.isVerifiedUnmatched.message {
box-shadow: none;
background-color: var(--color-warning-bg);
color: var(--color-warning-text);
}
.repository .ui.attached.isSigned.isVerifiedUntrusted.message .ui.text,
.repository .ui.attached.isSigned.isVerifiedUnmatched.message .ui.text {
color: var(--color-warning-text);
}
.repository .ui.attached.isSigned.isVerifiedUntrusted:last-child,
.repository .ui.attached.isSigned.isVerifiedUnmatched:last-child,
.repository .ui.attached.isSigned.isVerifiedUntrusted.bottom,
.repository .ui.attached.isSigned.isVerifiedUnmatched.bottom {
border-bottom: 1px solid var(--color-warning-border);
}
.repository #commits-table td.sha .sha.label,
.repository #repo-files-table .sha.label,
.repository #repo-file-commit-box .sha.label,
.repository #rev-list .sha.label,
.repository .timeline-item.commits-list .singular-commit .sha.label {
border: 1px solid var(--color-light-border);
}
.repository #commits-table td.sha .sha.label .detail.icon,
.repository #repo-files-table .sha.label .detail.icon,
.repository #repo-file-commit-box .sha.label .detail.icon,
.repository #rev-list .sha.label .detail.icon,
.repository .timeline-item.commits-list .singular-commit .sha.label .detail.icon {
background: var(--color-light);
margin: -6px -10px -4px 0;
padding: 5px 4px 5px 6px;
border-left: 1px solid var(--color-light-border);
border-top: 0;
border-right: 0;
border-bottom: 0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.repository #commits-table td.sha .sha.label .detail.icon .svg,
.repository #repo-files-table .sha.label .detail.icon .svg,
.repository #repo-file-commit-box .sha.label .detail.icon .svg,
.repository #rev-list .sha.label .detail.icon .svg,
.repository .timeline-item.commits-list .singular-commit .sha.label .detail.icon .svg {
margin: 0 0.25em 0 0;
}
.repository #commits-table td.sha .sha.label .detail.icon > div,
.repository #repo-files-table .sha.label .detail.icon > div,
.repository #repo-file-commit-box .sha.label .detail.icon > div,
.repository #rev-list .sha.label .detail.icon > div,
.repository .timeline-item.commits-list .singular-commit .sha.label .detail.icon > div {
display: flex;
align-items: center;
}
.repository #commits-table td.sha .sha.label.isSigned.isWarning,
.repository #repo-files-table .sha.label.isSigned.isWarning,
.repository #repo-file-commit-box .sha.label.isSigned.isWarning,
.repository #rev-list .sha.label.isSigned.isWarning,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isWarning {
border: 1px solid var(--color-red-badge);
background: var(--color-red-badge-bg);
}
.repository #commits-table td.sha .sha.label.isSigned.isWarning .detail.icon,
.repository #repo-files-table .sha.label.isSigned.isWarning .detail.icon,
.repository #repo-file-commit-box .sha.label.isSigned.isWarning .detail.icon,
.repository #rev-list .sha.label.isSigned.isWarning .detail.icon,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isWarning .detail.icon {
border-left: 1px solid var(--color-red-badge);
color: var(--color-red-badge);
}
.repository #commits-table td.sha .sha.label.isSigned.isWarning:hover,
.repository #repo-files-table .sha.label.isSigned.isWarning:hover,
.repository #repo-file-commit-box .sha.label.isSigned.isWarning:hover,
.repository #rev-list .sha.label.isSigned.isWarning:hover,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isWarning:hover {
background: var(--color-red-badge-hover-bg) !important;
}
.repository #commits-table td.sha .sha.label.isSigned.isVerified,
.repository #repo-files-table .sha.label.isSigned.isVerified,
.repository #repo-file-commit-box .sha.label.isSigned.isVerified,
.repository #rev-list .sha.label.isSigned.isVerified,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerified {
border: 1px solid var(--color-green-badge);
background: var(--color-green-badge-bg);
}
.repository #commits-table td.sha .sha.label.isSigned.isVerified .detail.icon,
.repository #repo-files-table .sha.label.isSigned.isVerified .detail.icon,
.repository #repo-file-commit-box .sha.label.isSigned.isVerified .detail.icon,
.repository #rev-list .sha.label.isSigned.isVerified .detail.icon,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerified .detail.icon {
border-left: 1px solid var(--color-green-badge);
color: var(--color-green-badge);
}
.repository #commits-table td.sha .sha.label.isSigned.isVerified:hover,
.repository #repo-files-table .sha.label.isSigned.isVerified:hover,
.repository #repo-file-commit-box .sha.label.isSigned.isVerified:hover,
.repository #rev-list .sha.label.isSigned.isVerified:hover,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerified:hover {
background: var(--color-green-badge-hover-bg) !important;
}
.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUntrusted,
.repository #repo-files-table .sha.label.isSigned.isVerifiedUntrusted,
.repository #repo-file-commit-box .sha.label.isSigned.isVerifiedUntrusted,
.repository #rev-list .sha.label.isSigned.isVerifiedUntrusted,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerifiedUntrusted {
border: 1px solid var(--color-yellow-badge);
background: var(--color-yellow-badge-bg);
}
.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUntrusted .detail.icon,
.repository #repo-files-table .sha.label.isSigned.isVerifiedUntrusted .detail.icon,
.repository #repo-file-commit-box .sha.label.isSigned.isVerifiedUntrusted .detail.icon,
.repository #rev-list .sha.label.isSigned.isVerifiedUntrusted .detail.icon,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerifiedUntrusted .detail.icon {
border-left: 1px solid var(--color-yellow-badge);
color: var(--color-yellow-badge);
}
.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUntrusted:hover,
.repository #repo-files-table .sha.label.isSigned.isVerifiedUntrusted:hover,
.repository #repo-file-commit-box .sha.label.isSigned.isVerifiedUntrusted:hover,
.repository #rev-list .sha.label.isSigned.isVerifiedUntrusted:hover,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerifiedUntrusted:hover {
background: var(--color-yellow-badge-hover-bg) !important;
}
.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUnmatched,
.repository #repo-files-table .sha.label.isSigned.isVerifiedUnmatched,
.repository #repo-file-commit-box .sha.label.isSigned.isVerifiedUnmatched,
.repository #rev-list .sha.label.isSigned.isVerifiedUnmatched,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerifiedUnmatched {
border: 1px solid var(--color-orange-badge);
background: var(--color-orange-badge-bg);
}
.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUnmatched .detail.icon,
.repository #repo-files-table .sha.label.isSigned.isVerifiedUnmatched .detail.icon,
.repository #repo-file-commit-box .sha.label.isSigned.isVerifiedUnmatched .detail.icon,
.repository #rev-list .sha.label.isSigned.isVerifiedUnmatched .detail.icon,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerifiedUnmatched .detail.icon {
border-left: 1px solid var(--color-orange-badge);
color: var(--color-orange-badge);
}
.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUnmatched:hover,
.repository #repo-files-table .sha.label.isSigned.isVerifiedUnmatched:hover,
.repository #repo-file-commit-box .sha.label.isSigned.isVerifiedUnmatched:hover,
.repository #rev-list .sha.label.isSigned.isVerifiedUnmatched:hover,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerifiedUnmatched:hover {
background: var(--color-orange-badge-hover-bg) !important;
}
.singular-commit .shabox .sha.label {
margin: 0;
border: 1px solid var(--color-light-border);
}
.singular-commit .shabox .sha.label.isSigned.isWarning {
border: 1px solid var(--color-red-badge);
background: var(--color-red-badge-bg);
}
.singular-commit .shabox .sha.label.isSigned.isWarning:hover {
background: var(--color-red-badge-hover-bg) !important;
}
.singular-commit .shabox .sha.label.isSigned.isVerified {
border: 1px solid var(--color-green-badge);
background: var(--color-green-badge-bg);
}
.singular-commit .shabox .sha.label.isSigned.isVerified:hover {
background: var(--color-green-badge-hover-bg) !important;
}
.singular-commit .shabox .sha.label.isSigned.isVerifiedUntrusted {
border: 1px solid var(--color-yellow-badge);
background: var(--color-yellow-badge-bg);
}
.singular-commit .shabox .sha.label.isSigned.isVerifiedUntrusted:hover {
background: var(--color-yellow-badge-hover-bg) !important;
}
.singular-commit .shabox .sha.label.isSigned.isVerifiedUnmatched {
border: 1px solid var(--color-orange-badge);
background: var(--color-orange-badge-bg);
}
.singular-commit .shabox .sha.label.isSigned.isVerifiedUnmatched:hover {
background: var(--color-orange-badge-hover-bg) !important;
}

View File

@ -0,0 +1,70 @@
#repo-files-table {
width: 100%;
display: grid;
grid-template-columns: auto 1fr auto;
border: 1px solid var(--color-light-border);
border-radius: var(--border-radius);
margin: 10px 0; /* match the "clone-panel-popup" margin to avoid "visual double-border" */
}
#repo-files-table .svg.octicon-file-directory-fill,
#repo-files-table .svg.octicon-file-submodule {
color: var(--color-primary);
}
#repo-files-table .svg.octicon-file,
#repo-files-table .svg.octicon-file-symlink-file,
#repo-files-table .svg.octicon-file-directory-symlink {
color: var(--color-secondary-dark-7);
}
#repo-files-table .repo-file-item {
display: contents;
}
#repo-files-table .repo-file-item:hover > .repo-file-cell {
background: var(--color-hover);
}
#repo-files-table .repo-file-line,
#repo-files-table .repo-file-cell {
border-top: 1px solid var(--color-light-border);
padding: 6px 10px;
}
#repo-files-table .repo-file-line:first-child {
border-top: none;
}
#repo-files-table .repo-file-line {
grid-column: 1 / span 3;
display: flex;
align-items: center;
gap: 0.5em;
padding: 6px 10px;
}
#repo-files-table .repo-file-cell.name {
max-width: 300px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#repo-files-table .repo-file-cell.message {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: var(--color-text-light-1);
}
#repo-files-table .repo-file-cell.age {
white-space: nowrap;
color: var(--color-text-light-1);
}
@media (max-width: 767.98px) {
#repo-files-table .repo-file-cell.name {
max-width: 150px;
}
}

View File

@ -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})});

View File

@ -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;