]> source.dussan.org Git - gitea.git/commitdiff
Fix a UI error when folding a file content in a commit view (#17446)
authorwxiaoguang <wxiaoguang@gmail.com>
Wed, 27 Oct 2021 11:11:56 +0000 (19:11 +0800)
committerGitHub <noreply@github.com>
Wed, 27 Oct 2021 11:11:56 +0000 (19:11 +0800)
templates/repo/diff/box.tmpl
web_src/js/features/repo-code.js

index d2651d7e08f778cfaa73cd55db5126caf55a0d11..30039f0d1ab7e76398ae42768dc143808255fac8 100644 (file)
@@ -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}}
index 74b3c1fba8189d3601e9319d535406263993c161..8a361a750d07a450f891af3780def8b19c0b2dbb 100644 (file)
@@ -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}) => {