From 4d3d4d5403baf14775ca18c03997d9e4e8591ddd Mon Sep 17 00:00:00 2001 From: hiifong Date: Sat, 17 Jun 2023 15:53:23 +0800 Subject: [PATCH 1/2] Fix #25281 When viewing a file, hide the add button ![image](https://github.com/go-gitea/gitea/assets/89133723/839babaf-6b67-46e1-a103-677306fb8503) ![image](https://github.com/go-gitea/gitea/assets/89133723/32a8aeca-31f4-4ce1-a0fa-7656e16b66d3) --- templates/repo/home.tmpl | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index a983de5a48b14..e4e7276e3b93c 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -84,23 +84,25 @@ {{end}} {{if and .CanWriteCode .IsViewBranch (not .Repository.IsArchived)}} - + {{if not .IsViewFile}} + + {{end}} {{end}} {{if and (eq $n 0) (.Repository.IsTemplate)}} From db9c0367abab8b9c37626ea8b0010a2ea65a757c Mon Sep 17 00:00:00 2001 From: hiifong Date: Sat, 17 Jun 2023 16:59:01 +0800 Subject: [PATCH 2/2] fix --- templates/repo/home.tmpl | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index e4e7276e3b93c..8589574a53ecc 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -83,26 +83,24 @@ {{.locale.Tr "repo.find_file.go_to_file"}} {{end}} - {{if and .CanWriteCode .IsViewBranch (not .Repository.IsArchived)}} - {{if not .IsViewFile}} - - {{end}} + {{if and .CanWriteCode .IsViewBranch (not .Repository.IsArchived) (not .IsViewFile)}} + {{end}} {{if and (eq $n 0) (.Repository.IsTemplate)}}