1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-04 08:17:24 -05:00

Add support for "Show/Hide outdated"

Signed-off-by: Jonas Franz <info@jonasfranz.software>
This commit is contained in:
Jonas Franz 2018-05-15 16:34:19 +02:00
parent 7c1edf93ff
commit 8bb51135b6
No known key found for this signature in database
GPG Key ID: 506AEEBE80BEDECD
6 changed files with 38 additions and 8 deletions

View File

@ -853,8 +853,13 @@ func fetchCodeCommentsByReview(e Engine, issue *Issue, currentUser *User, review
IssueID: issue.ID,
ReviewID: review.ID,
}
conds := opts.toConds()
if review.ID == 0 {
conds.And(builder.Eq{"invalidated": false})
}
var comments []*Comment
if err := e.Where(opts.toConds().And(builder.Eq{"invalidated": false})).
if err := e.Where(conds).
Asc("comment.created_unix").
Asc("comment.id").
Find(&comments); err != nil {

View File

@ -764,6 +764,8 @@ issues.review.comment = "reviewed %s"
issues.review.reject = "rejected these changes %s"
issues.review.pending = Pending
issues.review.review = Review
issues.review.show_outdated = Show outdated
issues.review.hide_outdated = Hide outdated
pulls.desc = Enable merge requests and code reviews.
pulls.new = New Pull Request

File diff suppressed because one or more lines are too long

View File

@ -762,6 +762,23 @@ function initRepository() {
}
function initPullRequestReview() {
$('.show-outdated').on('click', function (e) {
e.preventDefault();
var id = $(this).data('comment');
$(this).addClass("hide");
$("#code-comments-" + id).removeClass('hide');
$("#code-preview-" + id).removeClass('hide');
$("#hide-outdated-" + id).removeClass('hide');
});
$('.hide-outdated').on('click', function (e) {
e.preventDefault();
var id = $(this).data('comment');
$(this).addClass("hide");
$("#code-comments-" + id).addClass('hide');
$("#code-preview-" + id).addClass('hide');
$("#show-outdated-" + id).removeClass('hide');
});
if ($('.repository.pull.diff').length == 0) {
return;
}

View File

@ -442,7 +442,7 @@ footer {
}
.hide {
display: none;
display: none !important;
}
.center {
text-align: center;

View File

@ -260,14 +260,20 @@
{{range $line, $comms := $lines}}
<div class="ui segments">
<div class="ui segment">
{{if (index $comms 0).Invalidated}}
<button class="ui icon button">
<i class="indend icon"></i>
{{$invalid := (index $comms 0).Invalidated}}
{{if $invalid}}
<button id="show-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="ui compact right labeled button show-outdated">
<i class="octicon octicon-fold"></i>
{{$.i18n.Tr "repo.issues.review.show_outdated"}}
</button>
<button id="hide-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="hide ui compact right labeled button hide-outdated">
<i class="octicon octicon-fold"></i>
{{$.i18n.Tr "repo.issues.review.hide_outdated"}}
</button>
{{end}}
<code>{{$filename}}</code>
</div>
<div class="ui table segment">
<div id="code-preview-{{(index $comms 0).ID}}" class="ui table segment{{if $invalid}} hide{{end}}">
<div class="diff-file-box diff-box file-content tab-size-8">
<div class="file-body file-code code-view code-diff code-diff-unified">
<table>
@ -387,7 +393,7 @@
</div>
</div>
</div>
<div class="ui segment">
<div id="code-comments-{{(index $comms 0).ID}}" class="ui segment{{if $invalid}} hide{{end}}">
<div class="ui comments">
{{range $comms}}
{{ $createdSubStr:= TimeSinceUnix .CreatedUnix $.Lang }}