Skip to content

Commit 7f433d2

Browse files
committed
improve
1 parent 1e76a82 commit 7f433d2

File tree

5 files changed

+54
-12
lines changed

5 files changed

+54
-12
lines changed

options/locale/locale_en-US.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,6 +1751,8 @@ pulls.status_checks_failure = Some checks failed
17511751
pulls.status_checks_error = Some checks reported errors
17521752
pulls.status_checks_requested = Required
17531753
pulls.status_checks_details = Details
1754+
pulls.status_checks_hide_all = Hide all checks
1755+
pulls.status_checks_show_all = Show all checks
17541756
pulls.update_branch = Update branch by merge
17551757
pulls.update_branch_rebase = Update branch by rebase
17561758
pulls.update_branch_success = Branch update was successful

templates/repo/pulls/status.tmpl

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,29 @@
1414
{{else}}
1515
{{$.locale.Tr "repo.pulls.status_checking"}}
1616
{{end}}
17+
<div class="ui right">
18+
<a class="hide-all-checks muted"
19+
data-show-all="{{$.locale.Tr "repo.pulls.status_checks_show_all"}}"
20+
data-hide-all="{{$.locale.Tr "repo.pulls.status_checks_hide_all"}}">
21+
{{$.locale.Tr "repo.pulls.status_checks_hide_all"}}</a>
1722
</div>
23+
</div>
1824
{{end}}
1925

20-
{{range $.LatestCommitStatuses}}
21-
<div class="ui attached segment pr-status">
22-
{{template "repo/commit_status" .}}
23-
<div class="status-context">
24-
<span>{{.Context}} <span class="text grey">{{.Description}}</span></span>
25-
<div class="ui status-details">
26-
{{if $.is_context_required}}
27-
{{if (call $.is_context_required .Context)}}<div class="ui label">{{$.locale.Tr "repo.pulls.status_checks_requested"}}</div>{{end}}
28-
{{end}}
29-
<span>{{if .TargetURL}}<a href="{{.TargetURL}}">{{$.locale.Tr "repo.pulls.status_checks_details"}}</a>{{end}}</span>
26+
<div class="ui attached segment pr-status-list">
27+
{{range $.LatestCommitStatuses}}
28+
<div class="ui attached segment pr-status">
29+
{{template "repo/commit_status" .}}
30+
<div class="status-context">
31+
<span>{{.Context}} <span class="text grey">{{.Description}}</span></span>
32+
<div class="ui status-details">
33+
{{if $.is_context_required}}
34+
{{if (call $.is_context_required .Context)}}<div class="ui label">{{$.locale.Tr "repo.pulls.status_checks_requested"}}</div>{{end}}
35+
{{end}}
36+
<span>{{if .TargetURL}}<a href="{{.TargetURL}}">{{$.locale.Tr "repo.pulls.status_checks_details"}}</a>{{end}}</span>
37+
</div>
3038
</div>
3139
</div>
32-
</div>
33-
{{end}}
40+
{{end}}
41+
</div>
3442
{{end}}

web_src/css/repo.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3284,6 +3284,19 @@ tbody.commit-list {
32843284
}
32853285
}
32863286

3287+
.ui.segment.pr-status-list {
3288+
padding: 0 0.1em;
3289+
max-height: 30vh;
3290+
overflow-x: auto;
3291+
transition: max-height 0.4s;
3292+
}
3293+
3294+
.ui.segment.pr-status-list.hide{
3295+
padding: 0 0.1em;
3296+
max-height: 0;
3297+
transition: max-height 0.4s;
3298+
}
3299+
32873300
.pr-status {
32883301
padding: 0 !important; /* To clear fomantic's padding on .ui.segment elements */
32893302
display: flex;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import $ from 'jquery';
2+
3+
export function initRepoPullRequestCommitStatus() {
4+
const $prStatusList = $('.pr-status-list');
5+
6+
$('.hide-all-checks').on('click', async (e) => {
7+
e.preventDefault();
8+
const $this = $(e.currentTarget);
9+
if ($prStatusList.hasClass('hide')) {
10+
$prStatusList.removeClass('hide');
11+
$this.text($this.attr('data-hide-all'));
12+
} else {
13+
$prStatusList.addClass('hide');
14+
$this.text($this.attr('data-show-all'));
15+
}
16+
});
17+
}

web_src/js/features/repo-legacy.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {initCommentContent, initMarkupContent} from '../markup/content.js';
2121
import {initCompReactionSelector} from './comp/ReactionSelector.js';
2222
import {initRepoSettingBranches} from './repo-settings.js';
2323
import {initRepoPullRequestMergeForm} from './repo-issue-pr-form.js';
24+
import {initRepoPullRequestCommitStatus} from './repo-issue-pr-status.js';
2425
import {hideElem, showElem} from '../utils/dom.js';
2526
import {getComboMarkdownEditor, initComboMarkdownEditor} from './comp/ComboMarkdownEditor.js';
2627
import {attachRefIssueContextPopup} from './contextpopup.js';
@@ -547,6 +548,7 @@ export function initRepository() {
547548
initCompReactionSelector($(document));
548549

549550
initRepoPullRequestMergeForm();
551+
initRepoPullRequestCommitStatus();
550552
}
551553

552554
// Pull request

0 commit comments

Comments
 (0)