diff options
-rw-r--r-- | package-lock.json | 6 | ||||
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | routers/web/repo/issue_watch.go | 9 | ||||
-rw-r--r-- | routers/web/user/profile.go | 11 | ||||
-rw-r--r-- | templates/repo/issue/view_content/sidebar.tmpl | 14 | ||||
-rw-r--r-- | templates/repo/issue/view_content/watching.tmpl | 13 | ||||
-rw-r--r-- | templates/shared/user/profile_big_avatar.tmpl | 8 | ||||
-rw-r--r-- | web_src/js/features/common-global.js | 1 | ||||
-rw-r--r-- | webpack.config.js | 1 |
9 files changed, 20 insertions, 44 deletions
diff --git a/package-lock.json b/package-lock.json index d73fc5df5a..b299967eba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,6 @@ "esbuild-loader": "4.0.2", "escape-goat": "4.0.0", "fast-glob": "3.3.2", - "htmx.org": "1.9.10", "jquery": "3.7.1", "katex": "0.16.9", "license-checker-webpack-plugin": "0.2.1", @@ -6159,11 +6158,6 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, - "node_modules/htmx.org": { - "version": "1.9.10", - "resolved": "https://registry.npmjs.org/htmx.org/-/htmx.org-1.9.10.tgz", - "integrity": "sha512-UgchasltTCrTuU2DQLom3ohHrBvwr7OqpwyAVJ9VxtNBng4XKkVsqrv0Qr3srqvM9ZNI3f1MmvVQQqK7KW/bTA==" - }, "node_modules/http-proxy-agent": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", diff --git a/package.json b/package.json index 5c6de1dd62..801e85db83 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "esbuild-loader": "4.0.2", "escape-goat": "4.0.0", "fast-glob": "3.3.2", - "htmx.org": "1.9.10", "jquery": "3.7.1", "katex": "0.16.9", "license-checker-webpack-plugin": "0.2.1", diff --git a/routers/web/repo/issue_watch.go b/routers/web/repo/issue_watch.go index 1f51ceba5e..1cb5cc7162 100644 --- a/routers/web/repo/issue_watch.go +++ b/routers/web/repo/issue_watch.go @@ -8,15 +8,10 @@ import ( "strconv" issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/log" ) -const ( - tplWatching base.TplName = "repo/issue/view_content/watching" -) - // IssueWatch sets issue watching func IssueWatch(ctx *context.Context) { issue := GetActionIssue(ctx) @@ -57,7 +52,5 @@ func IssueWatch(ctx *context.Context) { return } - ctx.Data["Issue"] = issue - ctx.Data["IssueWatch"] = &issues_model.IssueWatch{IsWatching: watch} - ctx.HTML(http.StatusOK, tplWatching) + ctx.Redirect(issue.Link()) } diff --git a/routers/web/user/profile.go b/routers/web/user/profile.go index 73ab93caed..c5305ebcd9 100644 --- a/routers/web/user/profile.go +++ b/routers/web/user/profile.go @@ -14,7 +14,6 @@ import ( "code.gitea.io/gitea/models/db" repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" @@ -27,10 +26,6 @@ import ( shared_user "code.gitea.io/gitea/routers/web/shared/user" ) -const ( - tplProfileBigAvatar base.TplName = "shared/user/profile_big_avatar" -) - // OwnerProfile render profile page for a user or a organization (aka, repo owner) func OwnerProfile(ctx *context.Context) { if strings.Contains(ctx.Req.Header.Get("Accept"), "application/rss+xml") { @@ -314,10 +309,8 @@ func Action(ctx *context.Context) { if err != nil { log.Error("Failed to apply action %q: %v", ctx.FormString("action"), err) - ctx.Error(http.StatusBadRequest, fmt.Sprintf("Action %q failed", ctx.FormString("action"))) + ctx.JSONError(fmt.Sprintf("Action %q failed", ctx.FormString("action"))) return } - - shared_user.PrepareContextForProfileBigAvatar(ctx) - ctx.HTML(http.StatusOK, tplProfileBigAvatar) + ctx.JSONOK() } diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 6c13eef023..4334e4bcbd 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -270,7 +270,19 @@ <div class="ui watching"> <span class="text"><strong>{{ctx.Locale.Tr "notification.notifications"}}</strong></span> <div class="gt-mt-3"> - {{template "repo/issue/view_content/watching" .}} + <form method="post" action="{{.Issue.Link}}/watch"> + <input type="hidden" name="watch" value="{{if $.IssueWatch.IsWatching}}0{{else}}1{{end}}"> + {{$.CsrfTokenHtml}} + <button class="fluid ui button"> + {{if $.IssueWatch.IsWatching}} + {{svg "octicon-mute" 16 "gt-mr-3"}} + {{ctx.Locale.Tr "repo.issues.unsubscribe"}} + {{else}} + {{svg "octicon-unmute" 16 "gt-mr-3"}} + {{ctx.Locale.Tr "repo.issues.subscribe"}} + {{end}} + </button> + </form> </div> </div> {{end}} diff --git a/templates/repo/issue/view_content/watching.tmpl b/templates/repo/issue/view_content/watching.tmpl deleted file mode 100644 index 06b9d9af33..0000000000 --- a/templates/repo/issue/view_content/watching.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -<form hx-boost="true" hx-sync="this:replace" hx-target="this" hx-push-url="false" hx-swap="show:no-scroll" method="post" action="{{.Issue.Link}}/watch"> - <input type="hidden" name="watch" value="{{if $.IssueWatch.IsWatching}}0{{else}}1{{end}}"> - {{$.CsrfTokenHtml}} - <button class="fluid ui button"> - {{if $.IssueWatch.IsWatching}} - {{svg "octicon-mute" 16 "gt-mr-3"}} - {{ctx.Locale.Tr "repo.issues.unsubscribe"}} - {{else}} - {{svg "octicon-unmute" 16 "gt-mr-3"}} - {{ctx.Locale.Tr "repo.issues.subscribe"}} - {{end}} - </button> -</form> diff --git a/templates/shared/user/profile_big_avatar.tmpl b/templates/shared/user/profile_big_avatar.tmpl index 7afc852d1b..a637a9a5f9 100644 --- a/templates/shared/user/profile_big_avatar.tmpl +++ b/templates/shared/user/profile_big_avatar.tmpl @@ -1,4 +1,4 @@ -<div id="profile-avatar-card" class="ui card"> +<div class="ui card"> <div id="profile-avatar" class="content gt-df"> {{if eq .SignedUserID .ContextUser.ID}} <a class="image" href="{{AppSubUrl}}/user/settings" data-tooltip-content="{{ctx.Locale.Tr "user.change_avatar"}}"> @@ -110,13 +110,13 @@ </li> {{end}} {{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}} - <li class="follow" hx-headers='{"x-csrf-token": "{{.CsrfToken}}"}' hx-target="#profile-avatar-card" hx-swap="outerHTML"> + <li class="follow"> {{if $.IsFollowing}} - <button hx-post="{{.ContextUser.HomeLink}}?action=unfollow" class="ui basic red button"> + <button class="ui basic red button link-action" data-url="{{.ContextUser.HomeLink}}?action=unfollow"> {{svg "octicon-person"}} {{ctx.Locale.Tr "user.unfollow"}} </button> {{else}} - <button hx-post="{{.ContextUser.HomeLink}}?action=follow" class="ui basic primary button"> + <button class="ui basic primary button link-action" data-url="{{.ContextUser.HomeLink}}?action=follow"> {{svg "octicon-person"}} {{ctx.Locale.Tr "user.follow"}} </button> {{end}} diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js index ffa0434cff..0b00eb8e8e 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -12,7 +12,6 @@ import {showTemporaryTooltip} from '../modules/tippy.js'; import {confirmModal} from './comp/ConfirmModal.js'; import {showErrorToast} from '../modules/toast.js'; import {request, POST} from '../modules/fetch.js'; -import 'htmx.org'; const {appUrl, appSubUrl, csrfToken, i18n} = window.config; diff --git a/webpack.config.js b/webpack.config.js index 0d8418938f..448dc64003 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -214,7 +214,6 @@ export default { }, override: { 'khroma@*': {licenseName: 'MIT'}, // https://github.com/fabiospampinato/khroma/pull/33 - 'htmx.org@1.9.10': {licenseName: 'BSD-2-Clause'}, // "BSD 2-Clause" -> "BSD-2-Clause" }, emitError: true, allow: '(Apache-2.0 OR BSD-2-Clause OR BSD-3-Clause OR MIT OR ISC OR CPAL-1.0 OR Unlicense OR EPL-1.0 OR EPL-2.0)', |