Browse Source

Move breadcrumbs, simplify commit info in file list

master
Gerben 6 years ago
parent
commit
7d8ab0a85f
5 changed files with 78 additions and 68 deletions
  1. +31
    -0
      public/custom-style.css
  2. +10
    -0
      templates/repo/branch_dropdown.tmpl
  3. +2
    -22
      templates/repo/home.tmpl
  4. +2
    -0
      templates/repo/view_file.tmpl
  5. +33
    -46
      templates/repo/view_list.tmpl

+ 31
- 0
public/custom-style.css View File

@@ -37,10 +37,41 @@
float: unset;
}

.message.clone-menu {
text-align: left;
}
kbd {
}
.clone-grid {
margin-top: 0.5em;
display: grid;
grid-template-columns: 0fr 1fr;
grid-column-gap: 1em;
align-items: center;
text-align: right;
}

/* cancel some semantic-ui styles (maybe we should not be using this class..) */
.ui.sub.header {
text-transform: unset;
vertical-align: baseline;
}
.ui.attached.header .right {
margin-top: unset;
}

#repo-files-table {
margin-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}

.ui.top.attached.header {
margin-top: 2em;
margin-bottom: -1px;
background: #F9FAFB;
}

.ui.left.attached.button {
margin-right: 1px;
}

+ 10
- 0
templates/repo/branch_dropdown.tmpl View File

@@ -1,3 +1,13 @@
{{/*
{{if and .PullRequestCtx.Allowed .IsViewBranch}}
<div class="">
<a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch}}...{{.Repository.Owner.Name}}:{{.BranchName}}">
<button class="ui green tiny compact button"><i class="octicon octicon-git-compare"></i></button>
</a>
</div>
{{end}}
*/}}

<div class="fitted item choose reference">
{{ $showCommitCount := and (.Repository.UnitEnabled $.UnitTypeCode) (not .IsBareRepo)}}
<div class="ui floating filter dropdown custom" data-can-create-branch="{{.CanCreateBranch}}" data-no-results="{{.i18n.Tr "repo.pulls.no_results"}}">


+ 2
- 22
templates/repo/home.tmpl View File

@@ -23,13 +23,12 @@
</div>
{{end}}

{{ $n := len .TreeNames}}
{{ $l := Subtract $n 1}}
<div class="column right aligned">
<div class="ui dropdown">
<button class="ui basic left attached labeled icon button"><i class="clone icon"></i>Clone</button>
<div class="menu">
<div class="message">
<div class="message clone-menu">
Run: <kbd class="ui label">$ git clone <i>url</i></kbd>
<div class="clone-grid">
{{if not $.DisableHTTP}}
<div>
@@ -67,25 +66,6 @@
</div>
</div>
</div>

<div><span class="ui breadcrumb repo-path"><a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchNameSubURL}}">{{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>

<div id="file-buttons">
{{if .Repository.CanEnableEditor}}
<div class="ui tiny blue buttons">
{{if .CanAddFile}}
<a href="{{.RepoLink}}/_new/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui button">
{{.i18n.Tr "repo.editor.new_file"}}
</a>
{{end}}
{{if .CanUploadFile}}
<a href="{{.RepoLink}}/_upload/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui button">
{{.i18n.Tr "repo.editor.upload_file"}}
</a>
{{end}}
</div>
{{end}}
</div>
</div>
{{if .IsViewFile}}
{{template "repo/view_file" .}}


+ 2
- 0
templates/repo/view_file.tmpl View File

@@ -2,6 +2,8 @@
<h4 class="ui top attached header" id="{{if .ReadmeExist}}repo-readme{{else}}repo-read-file{{end}}">
<div class="ui stackable grid">
<div class="ten wide column">
{{ $l := Subtract (len .TreeNames) 1}}
<span class="ui breadcrumb repo-path"><a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchNameSubURL}}">{{EllipsisString .Repository.Name 30}}</a>{{range $i, $v := .TreeNames}}<span class="divider">/</span>{{if ne $i $l}}{{ $p := index $.Paths $i}}<span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $p}}">{{EllipsisString $v 30}}</a></span>{{end}}{{end}}</span>
{{if .ReadmeExist}}
<i class="book icon ui left"></i>
{{if .ReadmeInList}}


+ 33
- 46
templates/repo/view_list.tmpl View File

@@ -1,48 +1,38 @@
<table id="repo-files-table" class="ui fixed single line table">
<thead>
<tr class="commit-list">
<th class="four wide">
{{if .LatestCommitUser}}
<img class="ui avatar image img-12" src="{{.LatestCommitUser.RelAvatarLink}}" />
{{if .LatestCommitUser.FullName}}
<a href="{{AppSubUrl}}/{{.LatestCommitUser.Name}}"><strong>{{.LatestCommitUser.FullName}}</strong></a>
{{else}}
<a href="{{AppSubUrl}}/{{.LatestCommitUser.Name}}"><strong>{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}</strong></a>
{{end}}
{{else}}
{{if .LatestCommit.Author}}
<img class="ui avatar image img-12" src="{{AvatarLink .LatestCommit.Author.Email}}" />
<strong>{{.LatestCommit.Author.Name}}</strong>
{{end}}
{{end}}
<a rel="nofollow" class="ui sha label {{if .LatestCommit.Signature}} isSigned {{if .LatestCommitVerification.Verified }} isVerified {{end}}{{end}}" href="{{.RepoLink}}/commit/{{.LatestCommit.ID}}">
{{ShortSha .LatestCommit.ID.String}}
{{if .LatestCommit.Signature}}
<div class="ui detail icon button">
{{if .LatestCommitVerification.Verified}}
<i title="{{.LatestCommitVerification.Reason}}" class="lock green icon"></i>
{{else}}
<i title="{{$.i18n.Tr .LatestCommitVerification.Reason}}" class="unlock icon"></i>
{{end}}
</div>
{{end}}
</a>
<span class="grey has-emoji">{{RenderCommitMessage .LatestCommit.Summary .RepoLink $.Repository.ComposeMetas}}
{{if IsMultilineCommitMessage .LatestCommit.Message}}
<button class="basic compact mini ui icon button commit-button"><i class="ellipsis horizontal icon"></i></button>
<pre class="commit-body" style="display: none;">{{RenderCommitBody .LatestCommit.Message $.RepoLink $.Repository.ComposeMetas}}</pre>
{{end}}
{{template "repo/commit_status" .LatestCommitStatus}}</span>
</th>
<th class="nine wide">
</th>
<th class="three wide text grey right age">{{if .LatestCommit.Author}}{{TimeSince .LatestCommit.Author.When $.Lang}}{{end}}</th>
</tr>
</thead>
{{/*
{{if .LatestCommit.Author}}{{TimeSince .LatestCommit.Author.When $.Lang}}{{end}}

<td class="message collapsing has-emoji">
{{RenderCommitMessageLink $commit.Summary $.RepoLink (print $.RepoLink "/commit/" $commit.ID) $.Repository.ComposeMetas}}
</td>
*/}}

<h4 class="ui top attached header">
{{ $n := len .TreeNames}}
{{ $l := Subtract $n 1}}
<span class="ui breadcrumb repo-path"><a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchNameSubURL}}">{{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 class="ui right sub header">
Latest commit:
<a rel="nofollow" href="{{.RepoLink}}/commit/{{.LatestCommit.ID}}">
<span class="grey has-emoji">
{{RenderCommitMessage .LatestCommit.Summary .RepoLink $.Repository.ComposeMetas}}
{{if IsMultilineCommitMessage .LatestCommit.Message}}
<button class="basic compact mini ui icon button commit-button"><i class="ellipsis horizontal icon"></i></button>
<pre class="commit-body" style="display: none;">{{RenderCommitBody .LatestCommit.Message $.RepoLink $.Repository.ComposeMetas}}</pre>
{{end}}
{{template "repo/commit_status" .LatestCommitStatus}}
</span>
</a>
<span style="margin-left: 1em;">
{{if .LatestCommit.Author}}{{TimeSince .LatestCommit.Author.When $.Lang}}{{end}}
</span>
</div>
</h4>
<table id="repo-files-table" class="ui fixed single line attached table">
<tbody>
{{if .HasParentPath}}
<tr class="has-parent">
<td colspan="3"><i class="octicon octicon-mail-reply"></i><a href="{{EscapePound .BranchLink}}{{.ParentPath}}">..</a></td>
<td colspan="2"><a href="{{EscapePound .BranchLink}}{{.ParentPath}}"><i class="octicon octicon-mail-reply"></i> ..</a></td>
</tr>
{{end}}
{{range $item := .Files}}
@@ -78,9 +68,6 @@
{{end}}
</td>
{{end}}
<td class="message collapsing has-emoji">
{{RenderCommitMessageLink $commit.Summary $.RepoLink (print $.RepoLink "/commit/" $commit.ID) $.Repository.ComposeMetas}}
</td>
<td class="text grey right age">{{TimeSince $commit.Committer.When $.Lang}}</td>
</tr>
{{end}}
@@ -88,4 +75,4 @@
</table>
{{if .ReadmeExist}}
{{template "repo/view_file" .}}
{{end}}
{{end}}

Loading…
Cancel
Save