Skip to content

Commit c22f911

Browse files
sriiobkcsoft
authored andcommitted
Implementation of Folder Jumping
1 parent 3313168 commit c22f911

File tree

6 files changed

+54
-5
lines changed

6 files changed

+54
-5
lines changed

modules/templates/helper.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,17 @@ func NewFuncMap() []template.FuncMap {
117117
}
118118
return "tab-size-8"
119119
},
120+
"SubJumpablePath": func(str string) []string {
121+
var path []string
122+
index := strings.LastIndex(str, "/")
123+
if index != -1 && index != len(str) {
124+
path = append(path, string(str[0:index+1]))
125+
path = append(path, string(str[index+1:]))
126+
} else {
127+
path = append(path, str)
128+
}
129+
return path
130+
},
120131
}}
121132
}
122133

public/css/index.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,9 @@ footer .ui.language .menu {
12721272
.repository.file.list #repo-files-table tr:hover {
12731273
background-color: #ffffEE;
12741274
}
1275+
.repository.file.list #repo-files-table .jumpable-path {
1276+
color: #888;
1277+
}
12751278
.repository.file.list #file-content .header .icon {
12761279
font-size: 1em;
12771280
margin-top: -2px;

public/less/_repository.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@
205205
tr:hover {
206206
background-color: #ffffEE;
207207
}
208+
.jumpable-path {
209+
color: #888;
210+
}
208211
}
209212

210213
#file-content {

templates/repo/view_list.tmpl

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,21 @@
4343
</td>
4444
{{else}}
4545
<td class="name">
46-
<span class="octicon octicon-file-{{if or $entry.IsDir}}directory{{else}}text{{end}}"></span>
47-
<a href="{{EscapePound $.TreeLink}}/{{EscapePound $entry.Name}}">{{$entry.Name}}</a>
46+
{{if $entry.IsDir}}
47+
{{$subJumpablePathName := $entry.GetSubJumpablePathName}}
48+
{{$subJumpablePath := SubJumpablePath $subJumpablePathName}}
49+
<span class="octicon octicon-file-directory"></span>
50+
<a href="{{EscapePound $.TreeLink}}/{{EscapePound $subJumpablePathName}}">
51+
{{if eq (len $subJumpablePath) 2}}
52+
<span class="jumpable-path">{{index $subJumpablePath 0}}</span>{{index $subJumpablePath 1}}
53+
{{else}}
54+
{{index $subJumpablePath 0}}
55+
{{end}}
56+
</a>
57+
{{else}}
58+
<span class="octicon octicon-file-text"></span>
59+
<a href="{{EscapePound $.TreeLink}}/{{EscapePound $entry.Name}}">{{$entry.Name}}</a>
60+
{{end}}
4861
</td>
4962
{{end}}
5063
<td class="message collapsing has-emoji">

vendor/code.gitea.io/git/tree_entry.go

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/vendor.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"ignore": "test",
44
"package": [
55
{
6-
"checksumSHA1": "OWuUWQ8sWC8n+eTQttx+3vfES8g=",
6+
"checksumSHA1": "mIaKLz6373W+jDLjgE/Yzt/exeo=",
77
"path": "code.gitea.io/git",
8-
"revision": "634abd6a61c350a95f6b146c3a5fc323282608ae",
9-
"revisionTime": "2016-12-22T08:49:21Z"
8+
"revision": "3d0fa331865619d2f3a7a0fcf23670a389310954",
9+
"revisionTime": "2016-12-28T14:57:51Z"
1010
},
1111
{
1212
"checksumSHA1": "dnGaLR7sd9D5YpQZP4QUGZiEq+c=",

0 commit comments

Comments
 (0)