Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of Folder Jumping #511

Merged
merged 1 commit into from
Dec 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions modules/templates/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ func NewFuncMap() []template.FuncMap {
}
return "tab-size-8"
},
"SubJumpablePath": func(str string) []string {
var path []string
index := strings.LastIndex(str, "/")
if index != -1 && index != len(str) {
path = append(path, string(str[0:index+1]))
path = append(path, string(str[index+1:]))
} else {
path = append(path, str)
}
return path
},
}}
}

Expand Down
3 changes: 3 additions & 0 deletions public/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,9 @@ footer .ui.language .menu {
.repository.file.list #repo-files-table tr:hover {
background-color: #ffffEE;
}
.repository.file.list #repo-files-table .jumpable-path {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Css files get generated by less

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule added to the less file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great 👍

color: #888;
}
.repository.file.list #file-content .header .icon {
font-size: 1em;
margin-top: -2px;
Expand Down
3 changes: 3 additions & 0 deletions public/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@
tr:hover {
background-color: #ffffEE;
}
.jumpable-path {
color: #888;
}
}

#file-content {
Expand Down
17 changes: 15 additions & 2 deletions templates/repo/view_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,21 @@
</td>
{{else}}
<td class="name">
<span class="octicon octicon-file-{{if or $entry.IsDir}}directory{{else}}text{{end}}"></span>
<a href="{{EscapePound $.TreeLink}}/{{EscapePound $entry.Name}}">{{$entry.Name}}</a>
{{if $entry.IsDir}}
{{$subJumpablePathName := $entry.GetSubJumpablePathName}}
{{$subJumpablePath := SubJumpablePath $subJumpablePathName}}
<span class="octicon octicon-file-directory"></span>
<a href="{{EscapePound $.TreeLink}}/{{EscapePound $subJumpablePathName}}">
{{if eq (len $subJumpablePath) 2}}
<span class="jumpable-path">{{index $subJumpablePath 0}}</span>{{index $subJumpablePath 1}}
{{else}}
{{index $subJumpablePath 0}}
{{end}}
</a>
{{else}}
<span class="octicon octicon-file-text"></span>
<a href="{{EscapePound $.TreeLink}}/{{EscapePound $entry.Name}}">{{$entry.Name}}</a>
{{end}}
</td>
{{end}}
<td class="message collapsing has-emoji">
Expand Down
19 changes: 19 additions & 0 deletions vendor/code.gitea.io/git/tree_entry.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"ignore": "test",
"package": [
{
"checksumSHA1": "OWuUWQ8sWC8n+eTQttx+3vfES8g=",
"checksumSHA1": "mIaKLz6373W+jDLjgE/Yzt/exeo=",
"path": "code.gitea.io/git",
"revision": "634abd6a61c350a95f6b146c3a5fc323282608ae",
"revisionTime": "2016-12-22T08:49:21Z"
"revision": "3d0fa331865619d2f3a7a0fcf23670a389310954",
"revisionTime": "2016-12-28T14:57:51Z"
},
{
"checksumSHA1": "dnGaLR7sd9D5YpQZP4QUGZiEq+c=",
Expand Down