Skip to content

Commit

Permalink
Fix a UI error when folding a file content in a commit view (go-gitea…
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang authored and Stelios Malathouras committed Mar 28, 2022
1 parent 0247cbf commit cb8221c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion templates/repo/diff/box.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
{{$showFileViewToggle := or $isImage (and (not $file.IsIncomplete) $isCsv)}}
<div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}} mt-3" id="diff-{{.Index}}" data-old-filename="{{$file.OldName}}" data-new-filename="{{$file.Name}}" {{if $file.IsGenerated}}data-folded="true"{{end}}>
<h4 class="diff-file-header sticky-2nd-row ui top attached normal header df ac sb">
<div class="fold-file df ac">
<div class="df ac">
<a role="button" class="fold-file muted mr-2">
{{if $file.IsGenerated}}
{{svg "octicon-chevron-right" 18}}
Expand Down
3 changes: 1 addition & 2 deletions web_src/js/features/repo-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,8 @@ export function initRepoCodeView() {
}
$(document).on('click', '.fold-file', ({currentTarget}) => {
const box = currentTarget.closest('.file-content');
const chevron = currentTarget.querySelector('a.chevron');
const folded = box.dataset.folded !== 'true';
chevron.innerHTML = svg(`octicon-chevron-${folded ? 'right' : 'down'}`, 18);
currentTarget.innerHTML = svg(`octicon-chevron-${folded ? 'right' : 'down'}`, 18);
box.dataset.folded = String(folded);
});
$(document).on('click', '.blob-excerpt', async ({currentTarget}) => {
Expand Down

0 comments on commit cb8221c

Please sign in to comment.