From 2f9797e53437da8b68032392225a593865c7d157 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 24 Mar 2023 10:40:17 +0800 Subject: [PATCH 1/2] fix --- templates/repo/diff/options_dropdown.tmpl | 2 +- templates/repo/diff/whitespace_dropdown.tmpl | 2 +- templates/repo/settings/webhook/history.tmpl | 2 +- web_src/js/features/common-global.js | 13 ++++++++----- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/templates/repo/diff/options_dropdown.tmpl b/templates/repo/diff/options_dropdown.tmpl index 2cb5abcb36d4f..bf36022cab719 100644 --- a/templates/repo/diff/options_dropdown.tmpl +++ b/templates/repo/diff/options_dropdown.tmpl @@ -1,7 +1,7 @@ -{{if .IsSplitStyle}}{{svg "gitea-join"}}{{else}}{{svg "gitea-split"}}{{end}} +{{if .IsSplitStyle}}{{svg "gitea-join"}}{{else}}{{svg "gitea-split"}}{{end}} diff --git a/templates/repo/settings/webhook/history.tmpl b/templates/repo/settings/webhook/history.tmpl index f76cdb147d7cc..8d72329bb0794 100644 --- a/templates/repo/settings/webhook/history.tmpl +++ b/templates/repo/settings/webhook/history.tmpl @@ -18,7 +18,7 @@ {{else}} {{svg "octicon-alert"}} {{end}} - {{.UUID}} + {{.UUID}}
{{.DeliveredString}} diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js index d533877c27e0e..931fe9376037c 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -120,10 +120,6 @@ export function initGlobalCommon() { $('.tabular.menu .item').tab(); $('.tabable.menu .item').tab(); - $('.toggle.button').on('click', function () { - toggleElem($($(this).data('target'))); - }); - // make table and elements clickable like a link $('tr[data-href], td[data-href]').on('click', function (e) { const href = $(this).data('href'); @@ -327,8 +323,15 @@ export function initGlobalButtons() { }); $('.show-panel.button').on('click', function (e) { + // a '.show-panel.button' can show a panel, by `data-panel="selector"` + // if the button is a "toggle" button, it toggles the panel e.preventDefault(); - showElem($(this).data('panel')); + const sel = $(this).attr('data-panel'); + if (this.classList.contains('toggle')) { + toggleElem(sel); + } else { + showElem(sel); + } }); $('.hide-panel.button').on('click', function (e) { From 654e7bb9dfe2259b1e2a4e191c4d10a946c5ff4e Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 24 Mar 2023 22:24:21 +0800 Subject: [PATCH 2/2] fix merge --- templates/repo/diff/whitespace_dropdown.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/diff/whitespace_dropdown.tmpl b/templates/repo/diff/whitespace_dropdown.tmpl index 790bcfef5ad79..4d9b00cb5512e 100644 --- a/templates/repo/diff/whitespace_dropdown.tmpl +++ b/templates/repo/diff/whitespace_dropdown.tmpl @@ -28,4 +28,4 @@
-{{if .IsSplitStyle}}{{svg "gitea-join"}}{{else}}{{svg "gitea-split"}}{{end}} +{{if .IsSplitStyle}}{{svg "gitea-join"}}{{else}}{{svg "gitea-split"}}{{end}}