Skip to content

Commit

Permalink
update go-gitea#8659 fold/unfold code diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
blueworrybear committed Oct 31, 2019
1 parent cb1048d commit 7ff74b7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions public/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,8 @@ tbody.commit-list{vertical-align:baseline}
.ui.user.list .item .description a:hover{text-decoration:underline}
.ui.button.add-code-comment{font-size:14px;height:16px;padding:2px 0 0;position:relative;width:16px;z-index:5;float:left;margin:-2px -10px -2px -20px;opacity:0;transition:transform .1s ease-in-out;transform:scale(1,1)}
.ui.button.add-code-comment:hover{transform:scale(1.2,1.2)}
.ui.fold-code{margin-right: 1em; padding-left: 5px; cursor: pointer; width: 22px;}
.ui.fold-code:hover{color: #428bca}
.focus-lines-new .ui.button.add-code-comment.add-code-comment-right,.focus-lines-old .ui.button.add-code-comment.add-code-comment-left{opacity:1}
.comment-code-cloud{padding:4px;position:relative;border:1px solid #f1f1f1;margin:13px 10px 5px auto}
.comment-code-cloud:before{content:" ";width:0;height:0;border-left:13px solid transparent;border-right:13px solid transparent;border-bottom:13px solid #f1f1f1;left:20px;position:absolute;top:-13px}
Expand Down
13 changes: 13 additions & 0 deletions public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,19 @@ function initCodeView() {
}
}).trigger('hashchange');
}

$('.ui.fold-code').on('click', function(e){
const $foldButton = $(e.target);
if ($foldButton.hasClass("fa-chevron-down")) {
$(e.target).parent().next().slideUp("fast", function(){
$foldButton.removeClass("fa-chevron-down").addClass("fa-chevron-right");
});
} else {
$(e.target).parent().next().slideDown("fast", function(){
$foldButton.removeClass("fa-chevron-right").addClass("fa-chevron-down");
});
}
})
}

function initU2FAuth() {
Expand Down
1 change: 1 addition & 0 deletions templates/repo/diff/box.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
{{else}}
<div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}" id="diff-{{.Index}}">
<h4 class="ui top attached normal header">
<i class="ui fold-code grey fa fa-chevron-down"></i>
<div class="diff-counter count">
{{if $file.IsBin}}
{{$.i18n.Tr "repo.diff.bin"}}
Expand Down

0 comments on commit 7ff74b7

Please sign in to comment.