From 005807d552c2e69f9c11c4849b394c9e474cc3d3 Mon Sep 17 00:00:00 2001 From: neonn <78957398+neonn@users.noreply.github.com> Date: Wed, 4 May 2022 14:06:19 +0100 Subject: [PATCH 1/7] Add "Reference" section to Issue view sidebar --- models/issue.go | 4 ++++ templates/repo/issue/view_content/sidebar.tmpl | 8 ++++++++ web_src/less/_repository.less | 18 ++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/models/issue.go b/models/issue.go index 98e64adafd226..5d019a6927221 100644 --- a/models/issue.go +++ b/models/issue.go @@ -430,6 +430,10 @@ func (issue *Issue) PatchURL() string { return "" } +func (issue *Issue) ReferenceLink() string { + return fmt.Sprintf("%s#%d", issue.Repo.FullName(), issue.Index) +} + // State returns string representation of issue status. func (issue *Issue) State() api.StateType { if issue.IsClosed { diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 9e9bc670a0d7a..f4a4703102a2a 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -568,6 +568,14 @@ {{end}} {{end}} +
+
+ References: {{.Issue.ReferenceLink}} + + {{svg "octicon-copy"}} + +
+ {{if and .IsRepoAdmin (not .Repository.IsArchived)}}
diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 13f9384ba0635..7603c95623557 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -1201,6 +1201,24 @@ } } } + + .ui.reference { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + + .text { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + padding-right: 1rem; + } + + .copy-button { + cursor: pointer; + } + } } .comment.form { From 172b5d19ad8ebbc4b64f93f3e8e9154891b6d082 Mon Sep 17 00:00:00 2001 From: neonn <78957398+neonn@users.noreply.github.com> Date: Wed, 4 May 2022 21:41:18 +0100 Subject: [PATCH 2/7] Removed unneeded tailored CSS, added Fomantic UI classes --- templates/repo/issue/view_content/sidebar.tmpl | 12 +++++++----- web_src/less/_repository.less | 5 ----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index f4a4703102a2a..1ce1deacaa2c0 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -569,11 +569,13 @@ {{end}}
-
- References: {{.Issue.ReferenceLink}} - - {{svg "octicon-copy"}} - +
+
+ References: {{.Issue.ReferenceLink}} + + {{svg "octicon-copy"}} + +
{{if and .IsRepoAdmin (not .Repository.IsArchived)}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 7603c95623557..cbc295f445f2d 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -1203,11 +1203,6 @@ } .ui.reference { - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: center; - .text { white-space: nowrap; overflow: hidden; From 061cb11761fc0093e844d28cf2698a72601caf67 Mon Sep 17 00:00:00 2001 From: neonn <78957398+neonn@users.noreply.github.com> Date: Thu, 5 May 2022 00:43:36 +0100 Subject: [PATCH 3/7] Removed tailored CSS in favour of HTML-only approach Kindly provided by @Gusted --- templates/repo/issue/view_content/sidebar.tmpl | 10 ++++------ web_src/less/_repository.less | 13 ------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 1ce1deacaa2c0..834ea810ad0e2 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -569,12 +569,10 @@ {{end}}
-
-
- References: {{.Issue.ReferenceLink}} - - {{svg "octicon-copy"}} - +
+
+ {{.i18n.Tr "repo.issues.reference_link" .Issue.ReferenceLink}} +
diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index cbc295f445f2d..13f9384ba0635 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -1201,19 +1201,6 @@ } } } - - .ui.reference { - .text { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - padding-right: 1rem; - } - - .copy-button { - cursor: pointer; - } - } } .comment.form { From fd138927ef36c5f23b450563089eda61b7f90a1d Mon Sep 17 00:00:00 2001 From: neonn <78957398+neonn@users.noreply.github.com> Date: Thu, 5 May 2022 00:45:02 +0100 Subject: [PATCH 4/7] Added i18 translation key for reference link string --- options/locale/locale_en-US.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 0175c8bfc8b00..3fd4d5cd7ce86 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1480,6 +1480,7 @@ issues.content_history.created = created issues.content_history.delete_from_history = Delete from history issues.content_history.delete_from_history_confirm = Delete from history? issues.content_history.options = Options +issues.reference_link = References: %s compare.compare_base = base compare.compare_head = compare From f2aee4e565f2f074be1322a5ee20b468eb8584ec Mon Sep 17 00:00:00 2001 From: neonn <78957398+neonn@users.noreply.github.com> Date: Thu, 5 May 2022 19:19:25 +0100 Subject: [PATCH 5/7] Corrected spelling of "References:" to "Reference:" for reference link text --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 3fd4d5cd7ce86..c040386ca70c4 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1480,7 +1480,7 @@ issues.content_history.created = created issues.content_history.delete_from_history = Delete from history issues.content_history.delete_from_history_confirm = Delete from history? issues.content_history.options = Options -issues.reference_link = References: %s +issues.reference_link = Reference: %s compare.compare_base = base compare.compare_head = compare From c3f7c4c0467e4f29d447128a5983c14963955afa Mon Sep 17 00:00:00 2001 From: neonn <78957398+neonn@users.noreply.github.com> Date: Thu, 5 May 2022 19:23:56 +0100 Subject: [PATCH 6/7] Removed `Issue.ReferenceLink` in favour of a local template variable --- models/issue.go | 4 ---- templates/repo/issue/view_content/sidebar.tmpl | 5 +++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/models/issue.go b/models/issue.go index 5d019a6927221..98e64adafd226 100644 --- a/models/issue.go +++ b/models/issue.go @@ -430,10 +430,6 @@ func (issue *Issue) PatchURL() string { return "" } -func (issue *Issue) ReferenceLink() string { - return fmt.Sprintf("%s#%d", issue.Repo.FullName(), issue.Index) -} - // State returns string representation of issue status. func (issue *Issue) State() api.StateType { if issue.IsClosed { diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 834ea810ad0e2..ffc46bfedee75 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -571,8 +571,9 @@
- {{.i18n.Tr "repo.issues.reference_link" .Issue.ReferenceLink}} - + {{$issueReferenceLink := printf "%s#%d" .Issue.Repo.FullName .Issue.Index}} + {{.i18n.Tr "repo.issues.reference_link" $issueReferenceLink}} +
From 13a6282fc717ba1093050597584a8f8c353154d3 Mon Sep 17 00:00:00 2001 From: neonn <78957398+neonn@users.noreply.github.com> Date: Fri, 9 Sep 2022 18:20:27 +0100 Subject: [PATCH 7/7] Corrected layout of WebAuthN page to center-align content --- templates/user/auth/webauthn.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/user/auth/webauthn.tmpl b/templates/user/auth/webauthn.tmpl index 8e82c12fc03bb..304d199da21aa 100644 --- a/templates/user/auth/webauthn.tmpl +++ b/templates/user/auth/webauthn.tmpl @@ -1,7 +1,7 @@ {{template "base/head" .}}