Skip to content

Commit c7c3fdd

Browse files
committed
Also fix default branch
1 parent 1fb92e3 commit c7c3fdd

File tree

1 file changed

+103
-96
lines changed

1 file changed

+103
-96
lines changed

templates/repo/branch/list.tmpl

Lines changed: 103 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -15,58 +15,65 @@
1515
</h4>
1616

1717
<div class="ui attached table segment">
18-
<table class="ui very basic striped fixed table single line">
19-
<tbody>
20-
<tr>
21-
<td>
22-
<div class="flex-text-block">
23-
<a class="gt-ellipsis branch-name" href="{{.RepoLink}}/src/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}">{{.DefaultBranchBranch.DBBranch.Name}}</a>
24-
{{if .DefaultBranchBranch.IsProtected}}
25-
<span data-tooltip-content="{{ctx.Locale.Tr "repo.settings.protected_branch"}}">{{svg "octicon-shield-lock"}}</span>
26-
{{end}}
27-
<button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DefaultBranchBranch.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button>
28-
{{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DefaultBranchBranch.DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DefaultBranchBranch.DBBranch.CommitID)}}
29-
</div>
30-
<p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a> · <span class="commit-message">{{ctx.RenderUtils.RenderCommitMessage .DefaultBranchBranch.DBBranch.CommitMessage .Repository}}</span> · {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DefaultBranchBranch.DBBranch.CommitTime}}{{if .DefaultBranchBranch.DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p>
31-
</td>
32-
{{/* FIXME: here and below, the tw-overflow-visible is not quite right but it is still needed the moment: to show the important buttons when the width is narrow */}}
33-
<td class="tw-text-right tw-overflow-visible">
34-
{{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted)}}
35-
<button class="btn interact-bg show-create-branch-modal tw-p-2"
36-
data-modal="#create-branch-modal"
37-
data-branch-from="{{$.DefaultBranchBranch.DBBranch.Name}}"
38-
data-branch-from-urlcomponent="{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}"
39-
data-tooltip-content="{{ctx.Locale.Tr "repo.branch.new_branch_from" ($.DefaultBranchBranch.DBBranch.Name)}}"
40-
>
41-
{{svg "octicon-git-branch"}}
42-
</button>
18+
<div class="flex-list">
19+
<div class="flex-item tw-p-2 tw-items-center tw-flex-wrap">
20+
<div class="flex-item-main">
21+
<div class="flex-item-title">
22+
<a class="text primary" href="{{.RepoLink}}/src/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}">{{.DefaultBranchBranch.DBBranch.Name}}</a>
23+
{{if .DefaultBranchBranch.IsProtected}}
24+
<span data-tooltip-content="{{ctx.Locale.Tr "repo.settings.protected_branch"}}">{{svg "octicon-shield-lock"}}</span>
4325
{{end}}
44-
{{if .EnableFeed}}
45-
<a role="button" class="btn interact-bg tw-p-2" href="{{$.RepoLink}}/rss/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss"}}</a>
26+
<button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DefaultBranchBranch.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button>
27+
<a class="ui sha label" href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a>
28+
{{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DefaultBranchBranch.DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DefaultBranchBranch.DBBranch.CommitID)}}
29+
</div>
30+
<div class="flex-item-body">
31+
<span class="commit-message">{{ctx.RenderUtils.RenderCommitMessage .DefaultBranchBranch.DBBranch.CommitMessage .Repository}}</span> ·
32+
{{if and .DefaultBranchBranch.DBBranch.Pusher (gt .DefaultBranchBranch.DBBranch.Pusher.ID 0)}}
33+
<a class="flex-text-inline" href="{{.DefaultBranchBranch.DBBranch.Pusher.HomeLink}}">
34+
{{ctx.AvatarUtils.Avatar .DefaultBranchBranch.DBBranch.Pusher 20}}
35+
{{.DefaultBranchBranch.DBBranch.Pusher.GetDisplayName}}
36+
</a>
4637
{{end}}
47-
{{if not $.DisableDownloadSourceArchives}}
48-
<div class="ui dropdown btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.download" ($.DefaultBranchBranch.DBBranch.Name)}}">
49-
{{svg "octicon-download"}}
50-
<div class="menu">
51-
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}.zip" rel="nofollow">{{svg "octicon-file-zip"}}&nbsp;ZIP</a>
52-
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}}&nbsp;TAR.GZ</a>
53-
</div>
38+
{{DateUtils.TimeSince .DefaultBranchBranch.DBBranch.CommitTime}}
39+
</div>
40+
</div>
41+
<div class="flex-item-trailing tw-ml-auto">
42+
{{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted)}}
43+
<button class="btn interact-bg show-create-branch-modal tw-p-2"
44+
data-modal="#create-branch-modal"
45+
data-branch-from="{{$.DefaultBranchBranch.DBBranch.Name}}"
46+
data-branch-from-urlcomponent="{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}"
47+
data-tooltip-content="{{ctx.Locale.Tr "repo.branch.new_branch_from" ($.DefaultBranchBranch.DBBranch.Name)}}"
48+
>
49+
{{svg "octicon-git-branch"}}
50+
</button>
51+
{{end}}
52+
{{if .EnableFeed}}
53+
<a role="button" class="btn interact-bg tw-p-2" href="{{$.RepoLink}}/rss/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss"}}</a>
54+
{{end}}
55+
{{if not $.DisableDownloadSourceArchives}}
56+
<div class="ui dropdown btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.download" ($.DefaultBranchBranch.DBBranch.Name)}}">
57+
{{svg "octicon-download"}}
58+
<div class="menu">
59+
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}.zip" rel="nofollow">{{svg "octicon-file-zip"}}&nbsp;ZIP</a>
60+
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}}&nbsp;TAR.GZ</a>
5461
</div>
55-
{{end}}
56-
{{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted) (not $.IsMirror)}}
57-
<button class="btn interact-bg tw-p-2 show-modal show-rename-branch-modal"
58-
data-is-default-branch="true"
59-
data-modal="#rename-branch-modal"
60-
data-old-branch-name="{{$.DefaultBranchBranch.DBBranch.Name}}"
61-
data-tooltip-content="{{ctx.Locale.Tr "repo.branch.rename" ($.DefaultBranchBranch.DBBranch.Name)}}"
62-
>
63-
{{svg "octicon-pencil"}}
64-
</button>
65-
{{end}}
66-
</td>
67-
</tr>
68-
</tbody>
69-
</table>
62+
</div>
63+
{{end}}
64+
{{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted) (not $.IsMirror)}}
65+
<button class="btn interact-bg tw-p-2 show-modal show-rename-branch-modal"
66+
data-is-default-branch="true"
67+
data-modal="#rename-branch-modal"
68+
data-old-branch-name="{{$.DefaultBranchBranch.DBBranch.Name}}"
69+
data-tooltip-content="{{ctx.Locale.Tr "repo.branch.rename" ($.DefaultBranchBranch.DBBranch.Name)}}"
70+
>
71+
{{svg "octicon-pencil"}}
72+
</button>
73+
{{end}}
74+
</div>
75+
</div>
76+
</div>
7077
</div>
7178
{{end}}
7279

@@ -163,53 +170,53 @@
163170
</div>
164171
</div>
165172
<div class="flex-item-trailing tw-ml-auto">
166-
{{if and $.IsWriter (not $.Repository.IsArchived) (not .DBBranch.IsDeleted)}}
167-
<button class="btn interact-bg tw-p-2 show-modal show-create-branch-modal"
168-
data-branch-from="{{.DBBranch.Name}}"
169-
data-branch-from-urlcomponent="{{PathEscapeSegments .DBBranch.Name}}"
170-
data-tooltip-content="{{ctx.Locale.Tr "repo.branch.new_branch_from" .DBBranch.Name}}"
171-
data-modal="#create-branch-modal" data-name="{{.DBBranch.Name}}"
172-
>
173-
{{svg "octicon-git-branch"}}
174-
</button>
175-
{{end}}
176-
{{if $.EnableFeed}}
177-
<a role="button" class="btn interact-bg tw-p-2" href="{{$.RepoLink}}/rss/branch/{{PathEscapeSegments .DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">
178-
{{svg "octicon-rss"}}
179-
</a>
180-
{{end}}
181-
{{if and (not .DBBranch.IsDeleted) (not $.DisableDownloadSourceArchives)}}
182-
<div class="ui dropdown btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.download" (.DBBranch.Name)}}">
183-
{{svg "octicon-download"}}
184-
<div class="menu">
185-
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments .DBBranch.Name}}.zip" rel="nofollow">{{svg "octicon-file-zip"}}&nbsp;ZIP</a>
186-
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments .DBBranch.Name}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}}&nbsp;TAR.GZ</a>
187-
</div>
188-
</div>
189-
{{end}}
190-
{{if and $.IsWriter (not $.Repository.IsArchived) (not .DBBranch.IsDeleted) (not $.IsMirror)}}
191-
<button class="btn interact-bg tw-p-2 show-modal show-rename-branch-modal"
192-
data-is-default-branch="false"
193-
data-old-branch-name="{{.DBBranch.Name}}"
194-
data-modal="#rename-branch-modal"
195-
data-tooltip-content="{{ctx.Locale.Tr "repo.branch.rename" (.DBBranch.Name)}}"
196-
>
197-
{{svg "octicon-pencil"}}
198-
</button>
199-
{{end}}
200-
{{if and $.IsWriter (not $.IsMirror) (not $.Repository.IsArchived) (not .IsProtected)}}
201-
{{if .DBBranch.IsDeleted}}
202-
<button class="btn interact-bg tw-p-2 link-action restore-branch-button" data-url="{{$.Link}}/restore?branch_id={{.DBBranch.ID}}&name={{.DBBranch.Name}}&page={{$.Page.Paginater.Current}}" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.restore" (.DBBranch.Name)}}">
203-
<span class="text blue">
204-
{{svg "octicon-reply"}}
205-
</span>
206-
</button>
207-
{{else}}
208-
<button class="btn interact-bg tw-p-2 delete-button delete-branch-button" data-url="{{$.Link}}/delete?name={{.DBBranch.Name}}&page={{$.Page.Paginater.Current}}" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.delete" (.DBBranch.Name)}}" data-name="{{.DBBranch.Name}}">
209-
{{svg "octicon-trash"}}
210-
</button>
211-
{{end}}
212-
{{end}}
173+
{{if and $.IsWriter (not $.Repository.IsArchived) (not .DBBranch.IsDeleted)}}
174+
<button class="btn interact-bg tw-p-2 show-modal show-create-branch-modal"
175+
data-branch-from="{{.DBBranch.Name}}"
176+
data-branch-from-urlcomponent="{{PathEscapeSegments .DBBranch.Name}}"
177+
data-tooltip-content="{{ctx.Locale.Tr "repo.branch.new_branch_from" .DBBranch.Name}}"
178+
data-modal="#create-branch-modal" data-name="{{.DBBranch.Name}}"
179+
>
180+
{{svg "octicon-git-branch"}}
181+
</button>
182+
{{end}}
183+
{{if $.EnableFeed}}
184+
<a role="button" class="btn interact-bg tw-p-2" href="{{$.RepoLink}}/rss/branch/{{PathEscapeSegments .DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">
185+
{{svg "octicon-rss"}}
186+
</a>
187+
{{end}}
188+
{{if and (not .DBBranch.IsDeleted) (not $.DisableDownloadSourceArchives)}}
189+
<div class="ui dropdown btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.download" (.DBBranch.Name)}}">
190+
{{svg "octicon-download"}}
191+
<div class="menu">
192+
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments .DBBranch.Name}}.zip" rel="nofollow">{{svg "octicon-file-zip"}}&nbsp;ZIP</a>
193+
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments .DBBranch.Name}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}}&nbsp;TAR.GZ</a>
194+
</div>
195+
</div>
196+
{{end}}
197+
{{if and $.IsWriter (not $.Repository.IsArchived) (not .DBBranch.IsDeleted) (not $.IsMirror)}}
198+
<button class="btn interact-bg tw-p-2 show-modal show-rename-branch-modal"
199+
data-is-default-branch="false"
200+
data-old-branch-name="{{.DBBranch.Name}}"
201+
data-modal="#rename-branch-modal"
202+
data-tooltip-content="{{ctx.Locale.Tr "repo.branch.rename" (.DBBranch.Name)}}"
203+
>
204+
{{svg "octicon-pencil"}}
205+
</button>
206+
{{end}}
207+
{{if and $.IsWriter (not $.IsMirror) (not $.Repository.IsArchived) (not .IsProtected)}}
208+
{{if .DBBranch.IsDeleted}}
209+
<button class="btn interact-bg tw-p-2 link-action restore-branch-button" data-url="{{$.Link}}/restore?branch_id={{.DBBranch.ID}}&name={{.DBBranch.Name}}&page={{$.Page.Paginater.Current}}" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.restore" (.DBBranch.Name)}}">
210+
<span class="text blue">
211+
{{svg "octicon-reply"}}
212+
</span>
213+
</button>
214+
{{else}}
215+
<button class="btn interact-bg tw-p-2 delete-button delete-branch-button" data-url="{{$.Link}}/delete?name={{.DBBranch.Name}}&page={{$.Page.Paginater.Current}}" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.delete" (.DBBranch.Name)}}" data-name="{{.DBBranch.Name}}">
216+
{{svg "octicon-trash"}}
217+
</button>
218+
{{end}}
219+
{{end}}
213220
</div>
214221
</div>
215222
{{end}}

0 commit comments

Comments
 (0)