summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-28 04:56:41 -0700
committerUnknwon <u@gogs.io>2016-08-28 04:56:41 -0700
commit579e5e4fee59f01f8a438e7ef977f34fa5dba72c (patch)
treeeb949bc9c4a8024067ca1a81f47f1f2c8c48d002 /templates
parentba27d71abea437af2f0612a8960eea651ec2df59 (diff)
downloadgitea-579e5e4fee59f01f8a438e7ef977f34fa5dba72c.tar.gz
gitea-579e5e4fee59f01f8a438e7ef977f34fa5dba72c.zip
Web editor: disallow edit mirror repository
Diffstat (limited to 'templates')
-rw-r--r--templates/.VERSION2
-rw-r--r--templates/repo/home.tmpl28
-rw-r--r--templates/repo/view_file.tmpl20
3 files changed, 28 insertions, 22 deletions
diff --git a/templates/.VERSION b/templates/.VERSION
index 0bbb321a1f..721eb5bc11 100644
--- a/templates/.VERSION
+++ b/templates/.VERSION
@@ -1 +1 @@
-0.9.91.0828 \ No newline at end of file
+0.9.92.0828 \ No newline at end of file
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl
index 5c6a536c2c..7ef75277e6 100644
--- a/templates/repo/home.tmpl
+++ b/templates/repo/home.tmpl
@@ -33,18 +33,22 @@
</div>
</div>
<div class="right fitted item">
- <div id="file-buttons" class="ui tiny buttons">
- {{if .CanAddFile}}
- <a href="{{.RepoLink}}/_new/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui button">
- {{.i18n.Tr "repo.editor.new_file"}}
- </a>
- {{end}}
- {{if .UploadFileLink}}
- <!-- <a href="{{EscapePound .UploadFileLink}}" class="ui button nowrap">
- <i class="upload icon"></i> {{.i18n.Tr "repo.upload_file"}}
- </a> -->
- {{end}}
- </div>
+ {{if .Repository.CanEnableEditor}}
+ <div id="file-buttons" class="ui tiny buttons">
+ {{if .CanAddFile}}
+ <a href="{{.RepoLink}}/_new/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui button">
+ {{.i18n.Tr "repo.editor.new_file"}}
+ </a>
+ {{end}}
+ {{if .UploadFileLink}}
+ <!-- <a href="{{EscapePound .UploadFileLink}}" class="ui button nowrap">
+ <i class="upload icon"></i> {{.i18n.Tr "repo.upload_file"}}
+ </a> -->
+ {{end}}
+ </div>
+ {{end}}
+
+ <!-- Only show colne panel in repository home page -->
{{if eq $n 0}}
<div class="ui action small input" id="clone-panel">
<button class="ui basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}">
diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl
index 5e1faf36ec..d0b793b0e7 100644
--- a/templates/repo/view_file.tmpl
+++ b/templates/repo/view_file.tmpl
@@ -20,15 +20,17 @@
<a class="ui button" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.file_history"}}</a>
<a class="ui button" href="{{EscapePound .FileLink}}">{{.i18n.Tr "repo.file_raw"}}</a>
</div>
- {{if .CanEditFile}}
- <a href="{{.RepoLink}}/_edit/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}"><i class="octicon octicon-pencil btn-octicon poping up" data-content="{{.EditFileTooltip}}" data-position="bottom center" data-variation="tiny inverted"></i></a>
- {{else}}
- <i class="octicon octicon-pencil btn-octicon poping up disabled" data-content="{{.EditFileTooltip}}" data-position="bottom center" data-variation="tiny inverted"></i>
- {{end}}
- {{if .CanDeleteFile}}
- <a href="{{.RepoLink}}/_delete/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}"><i class="octicon octicon-trashcan btn-octicon btn-octicon-danger poping up" data-content="{{.DeleteFileTooltip}}" data-position="bottom center" data-variation="tiny inverted"></i></a>
- {{else}}
- <i class="octicon octicon-trashcan btn-octicon poping up disabled" data-content="{{.DeleteFileTooltip}}" data-position="bottom center" data-variation="tiny inverted"></i>
+ {{if .Repository.CanEnableEditor}}
+ {{if .CanEditFile}}
+ <a href="{{.RepoLink}}/_edit/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}"><i class="octicon octicon-pencil btn-octicon poping up" data-content="{{.EditFileTooltip}}" data-position="bottom center" data-variation="tiny inverted"></i></a>
+ {{else}}
+ <i class="octicon octicon-pencil btn-octicon poping up disabled" data-content="{{.EditFileTooltip}}" data-position="bottom center" data-variation="tiny inverted"></i>
+ {{end}}
+ {{if .CanDeleteFile}}
+ <a href="{{.RepoLink}}/_delete/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}"><i class="octicon octicon-trashcan btn-octicon btn-octicon-danger poping up" data-content="{{.DeleteFileTooltip}}" data-position="bottom center" data-variation="tiny inverted"></i></a>
+ {{else}}
+ <i class="octicon octicon-trashcan btn-octicon poping up disabled" data-content="{{.DeleteFileTooltip}}" data-position="bottom center" data-variation="tiny inverted"></i>
+ {{end}}
{{end}}
</div>
{{end}}