File tree Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -647,6 +647,22 @@ func LastCommit(ctx *context.Context) {
647
647
return
648
648
}
649
649
650
+ var treeNames []string
651
+ paths := make ([]string , 0 , 5 )
652
+ if len (ctx .Repo .TreePath ) > 0 {
653
+ treeNames = strings .Split (ctx .Repo .TreePath , "/" )
654
+ for i := range treeNames {
655
+ paths = append (paths , strings .Join (treeNames [:i + 1 ], "/" ))
656
+ }
657
+
658
+ ctx .Data ["HasParentPath" ] = true
659
+ if len (paths )- 2 >= 0 {
660
+ ctx .Data ["ParentPath" ] = "/" + paths [len (paths )- 2 ]
661
+ }
662
+ }
663
+ branchLink := ctx .Repo .RepoLink + "/src/" + ctx .Repo .BranchNameSubURL ()
664
+ ctx .Data ["BranchLink" ] = branchLink
665
+
650
666
ctx .HTML (http .StatusOK , tplRepoViewList )
651
667
}
652
668
Original file line number Diff line number Diff line change 47
47
{{$entry := $item.Entry}}
48
48
{{$commit := $item.Commit}}
49
49
{{$subModuleFile := $item.SubModuleFile}}
50
- <tr data-entryname="{{$entry.Name}}" data-ready="{{if $commit}}true{{else}}false{{end}}" {{if not $commit}}class="notready" {{end}}>
50
+ <tr data-entryname="{{$entry.Name}}" data-ready="{{if $commit}}true{{else}}false{{end}}" class=" {{if not $commit}}not {{end}}ready entry" >
51
51
<td class="name four wide">
52
52
<span class="truncate">
53
53
{{if $entry.IsSubModule}}
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ export async function initLastCommitLoader() {
5
5
6
6
const entries = $ ( 'table#repo-files-table tr.notready' )
7
7
. map ( ( _ , v ) => {
8
- entryMap [ $ ( v ) . data ( ' entryname') ] = $ ( v ) ;
9
- return $ ( v ) . data ( ' entryname') ;
8
+ entryMap [ $ ( v ) . attr ( 'data- entryname') ] = $ ( v ) ;
9
+ return $ ( v ) . attr ( 'data- entryname') ;
10
10
} )
11
11
. get ( ) ;
12
12
@@ -16,6 +16,15 @@ export async function initLastCommitLoader() {
16
16
17
17
const lastCommitLoaderURL = $ ( 'table#repo-files-table' ) . data ( 'lastCommitLoaderUrl' ) ;
18
18
19
+ if ( entries . length > 200 ) {
20
+ $ . post ( lastCommitLoaderURL , {
21
+ _csrf : csrf ,
22
+ } , ( data ) => {
23
+ $ ( 'table#repo-files-table' ) . replaceWith ( data ) ;
24
+ } ) ;
25
+ return ;
26
+ }
27
+
19
28
$ . post ( lastCommitLoaderURL , {
20
29
_csrf : csrf ,
21
30
'f' : entries ,
@@ -25,7 +34,7 @@ export async function initLastCommitLoader() {
25
34
$ ( 'table#repo-files-table .commit-list' ) . replaceWith ( row ) ;
26
35
return ;
27
36
}
28
- entryMap [ $ ( row ) . data ( ' entryname') ] . replaceWith ( row ) ;
37
+ entryMap [ $ ( row ) . attr ( 'data- entryname') ] . replaceWith ( row ) ;
29
38
} ) ;
30
39
} ) ;
31
40
}
You can’t perform that action at this time.
0 commit comments