Skip to content

Commit 95062f1

Browse files
committed
fix
1 parent 0025ea9 commit 95062f1

File tree

5 files changed

+26
-49
lines changed

5 files changed

+26
-49
lines changed

templates/repo/commit_statuses.tmpl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88
{{template "repo/commit_status" .Status}}
99
</span>
1010
{{end}}
11-
<div class="tippy-target ui relaxed list divided">
12-
{{template "repo/pulls/status" (dict
13-
"CommitStatuses" .Statuses
14-
"CommitStatus" .Status
15-
"IsPopup" true
16-
)}}
11+
<div class="tippy-target">
12+
{{template "repo/pulls/status" (dict "CommitStatuses" .Statuses "CommitStatus" .Status)}}
1713
</div>
1814
{{end}}

templates/repo/issue/view_content/pull.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@
2020
{{- else if .Issue.PullRequest.CanAutoMerge}}green
2121
{{- else}}red{{end}}">{{svg "octicon-git-merge" 40}}</div>
2222
<div class="content">
23+
<div class="ui attached segment fitted">
2324
{{template "repo/pulls/status" (dict
2425
"CommitStatus" .LatestCommitStatus
2526
"CommitStatuses" .LatestCommitStatuses
27+
"ShowHideChecks" true
2628
"is_context_required" .is_context_required
2729
)}}
30+
</div>
2831
{{$showGeneralMergeForm := false}}
2932
<div class="ui attached merge-section segment {{if not $.LatestCommitStatus}}no-header{{end}} flex-items-block">
3033
{{if .Issue.PullRequest.HasMerged}}

templates/repo/pulls/status.tmpl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
Template Attributes:
33
* CommitStatus: summary of all commit status state
44
* CommitStatuses: all commit status elements
5-
* IsPopup: whether this template is in a popup
5+
* ShowHideChecks: whether use a button to show/hide the checks
66
* is_context_required: Used in pull request commit status check table
77
*/}}
88

99
{{if .CommitStatus}}
10-
<div class="{{if .IsPopup}}tippy-commit-status{{else}}pr-commit-status{{end}}"{{if not .IsPopup}} data-toggled="true"{{end}}>
11-
<div class="ui attached header top">
10+
<div class="commit-status-panel">
11+
<div class="ui top attached header commit-status-header">
1212
{{if eq .CommitStatus.State "pending"}}
1313
{{ctx.Locale.Tr "repo.pulls.status_checking"}}
1414
{{else if eq .CommitStatus.State "success"}}
@@ -23,19 +23,19 @@ Template Attributes:
2323
{{ctx.Locale.Tr "repo.pulls.status_checking"}}
2424
{{end}}
2525

26-
{{if not .IsPopup}}
26+
{{if .ShowHideChecks}}
2727
<div class="ui right">
28-
<button class="hide-all-checks btn interact-fg"
28+
<button class="commit-status-hide-checks btn interact-fg"
2929
data-show-all="{{ctx.Locale.Tr "repo.pulls.status_checks_show_all"}}"
3030
data-hide-all="{{ctx.Locale.Tr "repo.pulls.status_checks_hide_all"}}">
3131
{{ctx.Locale.Tr "repo.pulls.status_checks_hide_all"}}</button>
3232
</div>
3333
{{end}}
3434
</div>
3535

36-
<div class="ui attached segment commit-status-list">
36+
<div class="commit-status-list">
3737
{{range .CommitStatuses}}
38-
<div class="ui attached segment commit-status-item">
38+
<div class="commit-status-item">
3939
{{template "repo/commit_status" .}}
4040
<span class="status-context text truncate">{{.Context}} <span class="text light-2">{{.Description}}</span></span>
4141
<div class="ui status-details">

web_src/css/repo.css

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3074,40 +3074,23 @@ tbody.commit-list {
30743074
}
30753075
}
30763076

3077+
.commit-status-header {
3078+
border: none !important; /* reset the default ".ui.attached.header" styles, to use the outer border */
3079+
margin: 0 !important;
3080+
}
3081+
30773082
.commit-status-list {
3078-
padding: 0 !important;
30793083
max-height: 195px; /* fit exactly 4 items */
30803084
overflow-x: hidden;
30813085
transition: max-height .2s;
3082-
border-bottom: none !important;
3083-
}
3084-
3085-
.pr-commit-status[data-toggled="false"] .commit-status-list {
3086-
max-height: 0; /* hide it for the slide transition */
3087-
}
3088-
3089-
.pr-commit-status[data-toggled="false"] {
3090-
border-bottom: none !important;
3091-
}
3092-
3093-
.pr-commit-status[data-toggled="false"] .ui.attached.header {
3094-
transition-delay: .2s; /* hide border when transition ends */
3095-
border-bottom-width: 0 !important;
30963086
}
30973087

30983088
.commit-status-item {
30993089
padding: 14px 10px !important;
31003090
display: flex;
31013091
gap: 8px;
31023092
align-items: center;
3103-
}
3104-
3105-
.commit-status-item:first-child {
3106-
border-top: none !important;
3107-
}
3108-
3109-
.commit-status-item:last-child {
3110-
border-bottom: none !important;
3093+
border-top: 1px solid var(--color-secondary);
31113094
}
31123095

31133096
.commit-status-item .commit-status {
@@ -3140,10 +3123,6 @@ tbody.commit-list {
31403123
padding-right: 0.5em; /* To match the alignment with the "required" label */
31413124
}
31423125

3143-
.tippy-commit-status .ui.attached.header {
3144-
border-top: 0 !important;
3145-
}
3146-
31473126
.search-fullname {
31483127
color: var(--color-text-light-2);
31493128
}
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
export function initRepoPullRequestCommitStatus() {
2-
const btn = document.querySelector('.hide-all-checks');
3-
if (!btn) return;
4-
5-
btn.addEventListener('click', () => {
6-
const prCommitStatus = document.querySelector('.pr-commit-status');
7-
const toggled = prCommitStatus.getAttribute('data-toggled') === 'true';
8-
btn.textContent = btn.getAttribute(toggled ? 'data-hide-all' : 'data-show-all');
9-
prCommitStatus.setAttribute('data-toggled', String(!toggled));
10-
});
2+
for (const btn of document.querySelectorAll('.commit-status-hide-checks')) {
3+
btn.addEventListener('click', () => {
4+
const panel = btn.closest('.commit-status-panel');
5+
const list = panel.querySelector('.commit-status-list');
6+
list.style.maxHeight = list.style.maxHeight ? '' : '0px';
7+
btn.textContent = btn.getAttribute(list.style.maxHeight ? 'data-show-all' : 'data-hide-all');
8+
});
9+
}
1110
}

0 commit comments

Comments
 (0)