Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sticky diff stats container #12002

Merged
merged 6 commits into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion semantic.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"segment",
"sidebar",
"site",
"sticky",
"tab",
"table",
"text",
Expand Down
8 changes: 4 additions & 4 deletions templates/repo/diff/box.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{if .DiffNotAvailable}}
<div class="diff-detail-box diff-box ui sticky">
<div class="diff-detail-box diff-box sticky">
<div>
<div class="ui right">
{{if .PageIsPullFiles}}
Expand All @@ -17,7 +17,7 @@
<h4>{{.i18n.Tr "repo.diff.data_not_available"}}</h4>
{{else}}
<div>
<div class="diff-detail-box diff-box ui sticky">
<div class="diff-detail-box diff-box sticky">
<i class="fa fa-retweet"></i>
{{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
<div class="ui right">
Expand Down Expand Up @@ -192,15 +192,15 @@
<td class="add-comment-right">
{{if and $resolved (eq $line.GetCommentSide "proposed")}}
<div class="ui top attached header">
<span class="ui grey text left"><b>{{$resolveDoer.Name}}</b> {{$.i18n.Tr "repo.issues.review.resolved_by"}}</span>
<span class="ui grey text left"><b>{{$resolveDoer.Name}}</b> {{$.i18n.Tr "repo.issues.review.resolved_by"}}</span>
<button id="show-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="ui compact right labeled button show-outdated">
{{svg "octicon-unfold" 16}}
{{$.i18n.Tr "repo.issues.review.show_resolved"}}
</button>
<button id="hide-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="hide ui compact right labeled button hide-outdated">
{{svg "octicon-fold" 16}}
{{$.i18n.Tr "repo.issues.review.hide_resolved"}}
</button>
</button>
</div>
{{end}}
{{if eq $line.GetCommentSide "proposed"}}
Expand Down
3 changes: 0 additions & 3 deletions web_src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1204,8 +1204,6 @@ function initPullRequestReview() {
return;
}

$('.diff-detail-box.ui.sticky').sticky();

$('.btn-review').on('click', function (e) {
e.preventDefault();
$(this).closest('.dropdown').find('.menu').toggle('visible');
Expand Down Expand Up @@ -2042,7 +2040,6 @@ function initCodeView() {
$.get(`${$blob.data('url')}?${$blob.data('query')}&anchor=${$blob.data('anchor')}`, (blob) => {
$row.replaceWith(blob);
$(`[data-anchor="${$blob.data('anchor')}"]`).on('click', (e) => { insertBlobExcerpt(e) });
$('.diff-detail-box.ui.sticky').sticky();
});
}
$('.ui.blob-excerpt').on('click', (e) => { insertBlobExcerpt(e) });
Expand Down
8 changes: 8 additions & 0 deletions web_src/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -1567,6 +1567,14 @@
background: #ffffff;
line-height: 30px;

&.sticky {
position: sticky;
top: 0;
z-index: 800;
margin-bottom: 10px;
border-bottom: 1px solid #d4d4d5;
CirnoT marked this conversation as resolved.
Show resolved Hide resolved
}

> div:after {
clear: both;
content: "";
Expand Down