From ff2f479a4b23484f3717e1efaa24819f9b0e5e60 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 7 Apr 2023 15:31:41 +0800 Subject: Clean template/helper.go (#23922) The first step of #23328 This PR cleans: 1. Dead function like `SubStr` 2. Unnecessary function like `UseHTTPS`, it should be provided by `window.origin` 3. Duplicate function like `IsShowFullName`, there was already a `DeafultShowFullName` I have searched these removed functions globally, no use in code. --- templates/admin/config.tmpl | 2 +- templates/repo/clone_buttons.tmpl | 2 +- templates/repo/clone_script.tmpl | 5 ++++- templates/repo/search_name.tmpl | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) (limited to 'templates') diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index cc0580cc19..14281c70c0 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -11,7 +11,7 @@
{{.locale.Tr "admin.config.app_name"}}
{{AppName}}
{{.locale.Tr "admin.config.app_ver"}}
-
{{AppVer}}{{AppBuiltWith}}
+
{{AppVer}}{{.AppBuiltWith}}
{{.locale.Tr "admin.config.custom_conf"}}
{{.CustomConf}}
{{.locale.Tr "admin.config.app_url"}}
diff --git a/templates/repo/clone_buttons.tmpl b/templates/repo/clone_buttons.tmpl index 278ae3a925..656a487915 100644 --- a/templates/repo/clone_buttons.tmpl +++ b/templates/repo/clone_buttons.tmpl @@ -1,7 +1,7 @@ {{if $.CloneButtonShowHTTPS}} {{end}} {{if $.CloneButtonShowSSH}} diff --git a/templates/repo/clone_script.tmpl b/templates/repo/clone_script.tmpl index 88a67d8235..21e78727ff 100644 --- a/templates/repo/clone_script.tmpl +++ b/templates/repo/clone_script.tmpl @@ -11,7 +11,10 @@ const value = localStorage.getItem('repo-clone-protocol') || 'https'; const isSSH = value === 'ssh' && sshBtn || value !== 'ssh' && !httpsBtn; - if (httpsBtn) httpsBtn.classList[!isSSH ? 'add' : 'remove']('primary'); + if (httpsBtn) { + httpsBtn.textContent = window.origin.split(':')[0].toUpperCase(); + httpsBtn.classList[!isSSH ? 'add' : 'remove']('primary'); + } if (sshBtn) sshBtn.classList[isSSH ? 'add' : 'remove']('primary'); const btn = isSSH ? sshBtn : httpsBtn; diff --git a/templates/repo/search_name.tmpl b/templates/repo/search_name.tmpl index 5a481761cc..951f168866 100644 --- a/templates/repo/search_name.tmpl +++ b/templates/repo/search_name.tmpl @@ -1 +1 @@ -{{.Name}}{{if IsShowFullName}} {{.FullName}}{{end}} +{{.Name}}{{if DefaultShowFullName}} {{.FullName}}{{end}} -- cgit v1.2.3