forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
Hide/Show all checks
button to commit status check (go-gitea#26284
) Step one for a GitHub like commit status check ui: ![image](https://github.com/go-gitea/gitea/assets/18380374/22953b88-1f91-4d19-bc57-ad92d33fa11f) ![image](https://github.com/go-gitea/gitea/assets/18380374/78572a49-c9b0-472b-86a8-8293197e807b) ![image](https://github.com/go-gitea/gitea/assets/18380374/bc5c8d1c-2ab5-4b03-b8c6-20c34b86d856) Step two: ![image](https://github.com/go-gitea/gitea/assets/18380374/938b359e-8823-4192-b82d-55fa40b986fd) ![image](https://github.com/go-gitea/gitea/assets/18380374/2de5bb8f-40f5-462a-8d6d-bac13a32bc2a) The design now will list all commit status checks which takes too much space. This is a pre-improve for go-gitea#26247 --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
- Loading branch information
Showing
15 changed files
with
132 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,51 @@ | ||
{{if $.LatestCommitStatus}} | ||
{{if not $.Issue.PullRequest.HasMerged}} | ||
<div class="ui top attached header"> | ||
{{if eq .LatestCommitStatus.State "pending"}} | ||
{{ctx.Locale.Tr "repo.pulls.status_checking"}} | ||
{{else if eq .LatestCommitStatus.State "success"}} | ||
{{ctx.Locale.Tr "repo.pulls.status_checks_success"}} | ||
{{else if eq .LatestCommitStatus.State "warning"}} | ||
{{ctx.Locale.Tr "repo.pulls.status_checks_warning"}} | ||
{{else if eq .LatestCommitStatus.State "failure"}} | ||
{{ctx.Locale.Tr "repo.pulls.status_checks_failure"}} | ||
{{else if eq .LatestCommitStatus.State "error"}} | ||
{{ctx.Locale.Tr "repo.pulls.status_checks_error"}} | ||
{{else}} | ||
{{ctx.Locale.Tr "repo.pulls.status_checking"}} | ||
{{end}} | ||
</div> | ||
{{end}} | ||
{{/* | ||
Template Attributes: | ||
* CommitStatus: summary of all commit status state | ||
* CommitStatuses: all commit status elements | ||
* ShowHideChecks: whether use a button to show/hide the checks | ||
* is_context_required: Used in pull request commit status check table | ||
*/}} | ||
|
||
{{if .CommitStatus}} | ||
<div class="commit-status-panel"> | ||
<div class="ui top attached header commit-status-header"> | ||
{{if eq .CommitStatus.State "pending"}} | ||
{{ctx.Locale.Tr "repo.pulls.status_checking"}} | ||
{{else if eq .CommitStatus.State "success"}} | ||
{{ctx.Locale.Tr "repo.pulls.status_checks_success"}} | ||
{{else if eq .CommitStatus.State "warning"}} | ||
{{ctx.Locale.Tr "repo.pulls.status_checks_warning"}} | ||
{{else if eq .CommitStatus.State "failure"}} | ||
{{ctx.Locale.Tr "repo.pulls.status_checks_failure"}} | ||
{{else if eq .CommitStatus.State "error"}} | ||
{{ctx.Locale.Tr "repo.pulls.status_checks_error"}} | ||
{{else}} | ||
{{ctx.Locale.Tr "repo.pulls.status_checking"}} | ||
{{end}} | ||
|
||
{{range $.LatestCommitStatuses}} | ||
<div class="ui attached segment pr-status"> | ||
{{template "repo/commit_status" .}} | ||
<div class="status-context"> | ||
<span>{{.Context}} <span class="text grey">{{.Description}}</span></span> | ||
{{if .ShowHideChecks}} | ||
<div class="ui right"> | ||
<button class="commit-status-hide-checks btn interact-fg" | ||
data-show-all="{{ctx.Locale.Tr "repo.pulls.status_checks_show_all"}}" | ||
data-hide-all="{{ctx.Locale.Tr "repo.pulls.status_checks_hide_all"}}"> | ||
{{ctx.Locale.Tr "repo.pulls.status_checks_hide_all"}}</button> | ||
</div> | ||
{{end}} | ||
</div> | ||
|
||
<div class="commit-status-list"> | ||
{{range .CommitStatuses}} | ||
<div class="commit-status-item"> | ||
{{template "repo/commit_status" .}} | ||
<div class="status-context gt-ellipsis">{{.Context}} <span class="text light-2">{{.Description}}</span></div> | ||
<div class="ui status-details"> | ||
{{if $.is_context_required}} | ||
{{if (call $.is_context_required .Context)}}<div class="ui label">{{ctx.Locale.Tr "repo.pulls.status_checks_requested"}}</div>{{end}} | ||
{{end}} | ||
<span>{{if .TargetURL}}<a href="{{.TargetURL}}">{{ctx.Locale.Tr "repo.pulls.status_checks_details"}}</a>{{end}}</span> | ||
</div> | ||
</div> | ||
</div> | ||
{{end}} | ||
{{end}} | ||
</div> | ||
</div> | ||
{{end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export function initRepoPullRequestCommitStatus() { | ||
for (const btn of document.querySelectorAll('.commit-status-hide-checks')) { | ||
const panel = btn.closest('.commit-status-panel'); | ||
const list = panel.querySelector('.commit-status-list'); | ||
btn.addEventListener('click', () => { | ||
list.style.maxHeight = list.style.maxHeight ? '' : '0px'; // toggle | ||
list.style.overflow = 'hidden'; // hide scrollbar when hiding | ||
btn.textContent = btn.getAttribute(list.style.maxHeight ? 'data-show-all' : 'data-hide-all'); | ||
}); | ||
list.addEventListener('animationend', () => list.style.overflow = ''); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters