Skip to content

Commit ccacb8a

Browse files
committed
Add buttons on empty repository page
1 parent aafb8b0 commit ccacb8a

File tree

2 files changed

+26
-17
lines changed

2 files changed

+26
-17
lines changed

routers/web/repo/view.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,15 @@ func renderCode(ctx *context.Context) {
826826
ctx.Data["PageIsViewCode"] = true
827827

828828
if ctx.Repo.Repository.IsEmpty {
829+
<<<<<<< HEAD:routers/web/repo/view.go
829830
ctx.HTML(http.StatusOK, tplRepoEMPTY)
831+
=======
832+
if ctx.Repo.CanWrite(models.UnitTypeCode) {
833+
ctx.Data["CanAddFile"] = true
834+
ctx.Data["CanUploadFile"] = setting.Repository.Upload.Enabled
835+
}
836+
ctx.HTML(200, tplRepoEMPTY)
837+
>>>>>>> 7d4422307 (Add buttons on empty repository page):routers/repo/view.go
830838
return
831839
}
832840

templates/repo/empty.tmpl

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,28 @@
1515
{{.i18n.Tr "repo.quick_guide"}}
1616
</h4>
1717
<div class="ui attached guide table segment">
18-
1918
<div class="item">
2019
<h3>{{.i18n.Tr "repo.clone_this_repo"}} <small>{{.i18n.Tr "repo.clone_helper" "http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository" | Str2html}}</small></h3>
21-
<div class="ui action small input">
22-
<div class="right fitted item mr-0" id="file-buttons">
23-
<div class="ui tiny primary buttons">
24-
{{if .Repository.CanEnableEditor}}
25-
{{if .CanAddFile}}
26-
<a href="{{.RepoLink}}/_new/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui button">
27-
{{.i18n.Tr "repo.editor.new_file"}}
28-
</a>
29-
{{end}}
30-
{{if .CanUploadFile}}
31-
<a href="{{.RepoLink}}/_upload/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui button">
32-
{{.i18n.Tr "repo.editor.upload_file"}}
33-
</a>
34-
{{end}}
20+
<div class="left fitted item mr-0 dib" id="file-buttons">
21+
<div class="ui primary buttons">
22+
{{if .Repository.CanEnableEditor}}
23+
{{if .CanAddFile}}
24+
<a href="{{.RepoLink}}/_new/{{EscapePound .BranchName}}/" class="ui basic clone button no-transition">
25+
{{.i18n.Tr "repo.editor.new_file"}}
26+
</a>
3527
{{end}}
36-
</div>
28+
{{if .CanUploadFile}}
29+
<a href="{{.RepoLink}}/_upload/{{EscapePound .BranchName}}/" class="ui basic clone button no-transition">
30+
{{.i18n.Tr "repo.editor.upload_file"}}
31+
</a>
32+
{{end}}
33+
{{end}}
34+
</div>
35+
</div>
36+
<div class="fitted item dib">
37+
<div class="ui action small input">
38+
{{template "repo/clone_buttons" .}}
3739
</div>
38-
{{template "repo/clone_buttons" .}}
3940
</div>
4041
</div>
4142

0 commit comments

Comments
 (0)