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

More tweaks to repo top panel #2267

Merged
merged 4 commits into from
Aug 13, 2017
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
2 changes: 1 addition & 1 deletion integrations/pull_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func testPullCreate(t *testing.T, session *TestSession, user, repo, branch strin

// Click the little green button to create a pull
htmlDoc := NewHTMLParser(t, resp.Body)
link, exists := htmlDoc.doc.Find("button.ui.green.small.button").Parent().Attr("href")
link, exists := htmlDoc.doc.Find("button.ui.green.tiny.compact.button").Parent().Attr("href")
assert.True(t, exists, "The template has changed")
if branch != "master" {
link = strings.Replace(link, ":master", ":"+branch, 1)
Expand Down
5 changes: 4 additions & 1 deletion public/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,6 @@ footer .ui.language .menu {
margin-bottom: 20px;
}
.repository #clone-panel {
margin-top: -8px;
margin-left: 5px;
width: 350px;
}
Expand Down Expand Up @@ -1318,6 +1317,10 @@ footer .ui.language .menu {
.repository.file.list .choose.reference .header .icon {
font-size: 1.4em;
}
.repository.file.list .repo-path .section,
.repository.file.list .repo-path .divider {
display: inline;
}
.repository.file.list #file-buttons {
font-weight: normal;
}
Expand Down
8 changes: 7 additions & 1 deletion public/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
}

#clone-panel {
margin-top: -8px;
margin-left: 5px;
width: 350px;

Expand Down Expand Up @@ -167,6 +166,13 @@
font-size: 1.4em;
}
}

.repo-path {
.section, .divider {
display: inline;
}
}

#file-buttons {
font-weight: normal;
.ui.button {
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/branch_dropdown.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="fitted item choose reference">
<div class="ui floating filter dropdown" data-no-results="{{.i18n.Tr "repo.pulls.no_results"}}">
<div class="ui basic small button">
<div class="ui basic compact tiny button">
<span class="text">
<i class="octicon octicon-git-branch"></i>
{{if .IsViewBranch}}{{.i18n.Tr "repo.branch"}}{{else}}{{.i18n.Tr "repo.tree"}}{{end}}:
Expand Down
25 changes: 6 additions & 19 deletions templates/repo/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,14 @@
{{if .PullRequestCtx.Allowed}}
<div class="fitted item">
<a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch}}...{{if .SignedUser.HasForkedRepo .BaseRepo.ID }}{{.SignedUser.Name}}:{{end}}{{.BranchName}}">
<button class="ui green small button"><i class="octicon octicon-git-compare"></i></button>
<button class="ui green tiny compact button"><i class="octicon octicon-git-compare"></i></button>
</a>
</div>
{{end}}
{{template "repo/branch_dropdown" .}}
<div class="fitted item">
<span class="ui breadcrumb">
<a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchName}}">{{EllipsisString .Repository.Name 30}}</a>
{{ $n := len .TreeNames}}
{{ $l := Subtract $n 1}}
{{range $i, $v := .TreeNames}}
<span class="divider"> / </span>
{{if eq $i $l}}
<span class="active section">{{EllipsisString $v 30}}</span>
{{else}}
{{ $p := index $.Paths $i}}
<span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $p}}">{{EllipsisString $v 30}}</a></span>
{{end}}
{{end}}
</span>
</div>
{{ $n := len .TreeNames}}
{{ $l := Subtract $n 1}}
<div class="fitted item"><span class="ui breadcrumb repo-path"><a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchName}}">{{EllipsisString .Repository.Name 30}}</a>{{range $i, $v := .TreeNames}}<span class="divider">/</span>{{if eq $i $l}}<span class="active section">{{EllipsisString $v 30}}</span>{{else}}{{ $p := index $.Paths $i}}<span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $p}}">{{EllipsisString $v 30}}</a></span>{{end}}{{end}}</span></div>
Copy link
Member

Choose a reason for hiding this comment

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

This line can be break down to be more humanly readable ^^

Copy link
Member Author

@silverwind silverwind Aug 6, 2017

Choose a reason for hiding this comment

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

Unfortunately not, if we want the path to be copyable as-is. If I add any indentation to this block, a path like someproject/somefile will copy as someproject / somefile or similar to the clipboard. Even adding indentation to the wrapping <div> will result in a trailing whitespace being copied.

As mentioned, a proper fix would be to minify the HTML, maybe by precompiling the templates to a form that does not feature indendation.

<div class="right fitted item">
{{if .Repository.CanEnableEditor}}
<div id="file-buttons" class="ui tiny blue buttons">
Expand All @@ -48,9 +35,9 @@
</div>
{{end}}

<!-- Only show colne panel in repository home page -->
<!-- Only show clone panel in repository home page -->
{{if eq $n 0}}
<div class="ui action small input" id="clone-panel">
<div class="ui action tiny input" id="clone-panel">
{{if not $.DisableHTTP}}
<button class="ui basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}">
{{if UseHTTPS}}HTTPS{{else}}HTTP{{end}}
Expand Down