Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/729tags/v1.21.12.1
| @@ -243,6 +243,11 @@ func renderDirectory(ctx *context.Context, treeLink string) { | |||||
| ctx.Data["ReadmeInList"] = true | ctx.Data["ReadmeInList"] = true | ||||
| ctx.Data["ReadmeExist"] = true | ctx.Data["ReadmeExist"] = true | ||||
| ctx.Data["FileIsSymlink"] = readmeFile.isSymlink | ctx.Data["FileIsSymlink"] = readmeFile.isSymlink | ||||
| ctx.Data["ReadmeName"] = readmeFile.name | |||||
| if ctx.Repo.CanEnableEditor() { | |||||
| ctx.Data["CanEditFile"] = true | |||||
| } | |||||
| dataRc, err := readmeFile.blob.DataAsync() | dataRc, err := readmeFile.blob.DataAsync() | ||||
| if err != nil { | if err != nil { | ||||
| @@ -34,6 +34,21 @@ | |||||
| </div> | </div> | ||||
| {{end}} | {{end}} | ||||
| </div> | </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}} | {{if not .ReadmeInList}} | ||||
| <div class="file-header-right"> | <div class="file-header-right"> | ||||
| <div class="ui right file-actions"> | <div class="ui right file-actions"> | ||||