Browse Source

Merge pull request '#497 增加readme文件修改的快捷入口' (#729) from fix-497 into V20211115

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/729
tags/v1.21.12.1
A00老虎 4 years ago
parent
commit
c1c3df92d1
2 changed files with 20 additions and 0 deletions
  1. +5
    -0
      routers/repo/view.go
  2. +15
    -0
      templates/repo/view_file.tmpl

+ 5
- 0
routers/repo/view.go View File

@@ -243,6 +243,11 @@ func renderDirectory(ctx *context.Context, treeLink string) {
ctx.Data["ReadmeInList"] = true
ctx.Data["ReadmeExist"] = true
ctx.Data["FileIsSymlink"] = readmeFile.isSymlink
ctx.Data["ReadmeName"] = readmeFile.name

if ctx.Repo.CanEnableEditor() {
ctx.Data["CanEditFile"] = true
}

dataRc, err := readmeFile.blob.DataAsync()
if err != nil {


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

@@ -34,6 +34,21 @@
</div>
{{end}}
</div>

{{if .ReadmeInList}}
<div class="file-header-right">
<div class="ui right file-actions">
{{if .Repository.CanEnableEditor}}
{{if .CanEditFile}}
<a href="{{.RepoLink}}/_edit/{{EscapePound .BranchName}}/{{EscapePound .ReadmeName}}"><span class="btn-octicon poping up" data-content="{{.EditFileTooltip}}" data-position="bottom center" data-variation="tiny inverted">{{svg "octicon-pencil" 16}}</span></a>
{{else}}
<span class="btn-octicon poping up disabled" data-content="{{.EditFileTooltip}}" data-position="bottom center" data-variation="tiny inverted">{{svg "octicon-pencil" 16}}</span>
{{end}}
{{end}}
</div>
</div>
{{end}}
{{if not .ReadmeInList}}
<div class="file-header-right">
<div class="ui right file-actions">


Loading…
Cancel
Save