From 4b8f0d09726a49439c74efefe70045e419ce9130 Mon Sep 17 00:00:00 2001 From: Otto Richter <git@otto.splvs.net> Date: Sun, 28 Apr 2024 12:48:17 +0200 Subject: [PATCH 1/2] Revert "Unify watching template" This reverts commit 47ef51d51ee46976171bab80314baa3798e45d13. --- .../repo/issue/view_content/sidebar/watch.tmpl | 13 +------------ templates/repo/issue/view_content/watching.tmpl | 12 ++++++++++++ 2 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 templates/repo/issue/view_content/watching.tmpl diff --git a/templates/repo/issue/view_content/sidebar/watch.tmpl b/templates/repo/issue/view_content/sidebar/watch.tmpl index 6c74b140c8..852738a706 100644 --- a/templates/repo/issue/view_content/sidebar/watch.tmpl +++ b/templates/repo/issue/view_content/sidebar/watch.tmpl @@ -1,17 +1,6 @@ <div class="ui watching"> <span class="text"><strong>{{ctx.Locale.Tr "notification.notifications"}}</strong></span> <div class="tw-mt-2"> - <form hx-boost="true" hx-sync="this:replace" hx-target="this" method="post" action="{{.Issue.Link}}/watch"> - <input type="hidden" name="watch" value="{{if $.IssueWatch.IsWatching}}0{{else}}1{{end}}"> - <button class="fluid ui button"> - {{if $.IssueWatch.IsWatching}} - {{svg "octicon-mute" 16 "tw-mr-2"}} - {{ctx.Locale.Tr "repo.issues.unsubscribe"}} - {{else}} - {{svg "octicon-unmute" 16 "tw-mr-2"}} - {{ctx.Locale.Tr "repo.issues.subscribe"}} - {{end}} - </button> - </form> + {{template "repo/issue/view_content/watching" .}} </div> </div> diff --git a/templates/repo/issue/view_content/watching.tmpl b/templates/repo/issue/view_content/watching.tmpl new file mode 100644 index 0000000000..05936d090b --- /dev/null +++ b/templates/repo/issue/view_content/watching.tmpl @@ -0,0 +1,12 @@ +<form hx-boost="true" hx-sync="this:replace" hx-target="this" method="post" action="{{.Issue.Link}}/watch"> + <input type="hidden" name="watch" value="{{if $.IssueWatch.IsWatching}}0{{else}}1{{end}}"> + <button class="fluid ui button"> + {{if $.IssueWatch.IsWatching}} + {{svg "octicon-mute" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.unsubscribe"}} + {{else}} + {{svg "octicon-unmute" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.subscribe"}} + {{end}} + </button> +</form> From bc8860ce32a8f83b32630d38904843f1ff9453c0 Mon Sep 17 00:00:00 2001 From: Otto Richter <git@otto.splvs.net> Date: Sun, 28 Apr 2024 12:56:28 +0200 Subject: [PATCH 2/2] Move watching sub-template to sidebar folder --- routers/web/repo/issue_watch.go | 2 +- templates/repo/issue/view_content/sidebar/watch.tmpl | 2 +- templates/repo/issue/view_content/{ => sidebar}/watching.tmpl | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename templates/repo/issue/view_content/{ => sidebar}/watching.tmpl (100%) diff --git a/routers/web/repo/issue_watch.go b/routers/web/repo/issue_watch.go index 8b033f3b17..c8d7187b8e 100644 --- a/routers/web/repo/issue_watch.go +++ b/routers/web/repo/issue_watch.go @@ -14,7 +14,7 @@ import ( ) const ( - tplWatching base.TplName = "repo/issue/view_content/watching" + tplWatching base.TplName = "repo/issue/view_content/sidebar/watching" ) // IssueWatch sets issue watching diff --git a/templates/repo/issue/view_content/sidebar/watch.tmpl b/templates/repo/issue/view_content/sidebar/watch.tmpl index 852738a706..ee14168070 100644 --- a/templates/repo/issue/view_content/sidebar/watch.tmpl +++ b/templates/repo/issue/view_content/sidebar/watch.tmpl @@ -1,6 +1,6 @@ <div class="ui watching"> <span class="text"><strong>{{ctx.Locale.Tr "notification.notifications"}}</strong></span> <div class="tw-mt-2"> - {{template "repo/issue/view_content/watching" .}} + {{template "repo/issue/view_content/sidebar/watching" .}} </div> </div> diff --git a/templates/repo/issue/view_content/watching.tmpl b/templates/repo/issue/view_content/sidebar/watching.tmpl similarity index 100% rename from templates/repo/issue/view_content/watching.tmpl rename to templates/repo/issue/view_content/sidebar/watching.tmpl