Skip to content

Commit 49d7663

Browse files
authored
Revert adding htmx until we finaly decide to add it (#28879)
1 parent 1df06e3 commit 49d7663

File tree

9 files changed

+20
-44
lines changed

9 files changed

+20
-44
lines changed

package-lock.json

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"esbuild-loader": "4.0.2",
2626
"escape-goat": "4.0.0",
2727
"fast-glob": "3.3.2",
28-
"htmx.org": "1.9.10",
2928
"jquery": "3.7.1",
3029
"katex": "0.16.9",
3130
"license-checker-webpack-plugin": "0.2.1",

routers/web/repo/issue_watch.go

+1-8
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@ import (
88
"strconv"
99

1010
issues_model "code.gitea.io/gitea/models/issues"
11-
"code.gitea.io/gitea/modules/base"
1211
"code.gitea.io/gitea/modules/context"
1312
"code.gitea.io/gitea/modules/log"
1413
)
1514

16-
const (
17-
tplWatching base.TplName = "repo/issue/view_content/watching"
18-
)
19-
2015
// IssueWatch sets issue watching
2116
func IssueWatch(ctx *context.Context) {
2217
issue := GetActionIssue(ctx)
@@ -57,7 +52,5 @@ func IssueWatch(ctx *context.Context) {
5752
return
5853
}
5954

60-
ctx.Data["Issue"] = issue
61-
ctx.Data["IssueWatch"] = &issues_model.IssueWatch{IsWatching: watch}
62-
ctx.HTML(http.StatusOK, tplWatching)
55+
ctx.Redirect(issue.Link())
6356
}

routers/web/user/profile.go

+2-9
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"code.gitea.io/gitea/models/db"
1515
repo_model "code.gitea.io/gitea/models/repo"
1616
user_model "code.gitea.io/gitea/models/user"
17-
"code.gitea.io/gitea/modules/base"
1817
"code.gitea.io/gitea/modules/context"
1918
"code.gitea.io/gitea/modules/git"
2019
"code.gitea.io/gitea/modules/log"
@@ -27,10 +26,6 @@ import (
2726
shared_user "code.gitea.io/gitea/routers/web/shared/user"
2827
)
2928

30-
const (
31-
tplProfileBigAvatar base.TplName = "shared/user/profile_big_avatar"
32-
)
33-
3429
// OwnerProfile render profile page for a user or a organization (aka, repo owner)
3530
func OwnerProfile(ctx *context.Context) {
3631
if strings.Contains(ctx.Req.Header.Get("Accept"), "application/rss+xml") {
@@ -314,10 +309,8 @@ func Action(ctx *context.Context) {
314309

315310
if err != nil {
316311
log.Error("Failed to apply action %q: %v", ctx.FormString("action"), err)
317-
ctx.Error(http.StatusBadRequest, fmt.Sprintf("Action %q failed", ctx.FormString("action")))
312+
ctx.JSONError(fmt.Sprintf("Action %q failed", ctx.FormString("action")))
318313
return
319314
}
320-
321-
shared_user.PrepareContextForProfileBigAvatar(ctx)
322-
ctx.HTML(http.StatusOK, tplProfileBigAvatar)
315+
ctx.JSONOK()
323316
}

templates/repo/issue/view_content/sidebar.tmpl

+13-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,19 @@
270270
<div class="ui watching">
271271
<span class="text"><strong>{{ctx.Locale.Tr "notification.notifications"}}</strong></span>
272272
<div class="gt-mt-3">
273-
{{template "repo/issue/view_content/watching" .}}
273+
<form method="post" action="{{.Issue.Link}}/watch">
274+
<input type="hidden" name="watch" value="{{if $.IssueWatch.IsWatching}}0{{else}}1{{end}}">
275+
{{$.CsrfTokenHtml}}
276+
<button class="fluid ui button">
277+
{{if $.IssueWatch.IsWatching}}
278+
{{svg "octicon-mute" 16 "gt-mr-3"}}
279+
{{ctx.Locale.Tr "repo.issues.unsubscribe"}}
280+
{{else}}
281+
{{svg "octicon-unmute" 16 "gt-mr-3"}}
282+
{{ctx.Locale.Tr "repo.issues.subscribe"}}
283+
{{end}}
284+
</button>
285+
</form>
274286
</div>
275287
</div>
276288
{{end}}

templates/repo/issue/view_content/watching.tmpl

-13
This file was deleted.

templates/shared/user/profile_big_avatar.tmpl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div id="profile-avatar-card" class="ui card">
1+
<div class="ui card">
22
<div id="profile-avatar" class="content gt-df">
33
{{if eq .SignedUserID .ContextUser.ID}}
44
<a class="image" href="{{AppSubUrl}}/user/settings" data-tooltip-content="{{ctx.Locale.Tr "user.change_avatar"}}">
@@ -110,13 +110,13 @@
110110
</li>
111111
{{end}}
112112
{{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}}
113-
<li class="follow" hx-headers='{"x-csrf-token": "{{.CsrfToken}}"}' hx-target="#profile-avatar-card" hx-swap="outerHTML">
113+
<li class="follow">
114114
{{if $.IsFollowing}}
115-
<button hx-post="{{.ContextUser.HomeLink}}?action=unfollow" class="ui basic red button">
115+
<button class="ui basic red button link-action" data-url="{{.ContextUser.HomeLink}}?action=unfollow">
116116
{{svg "octicon-person"}} {{ctx.Locale.Tr "user.unfollow"}}
117117
</button>
118118
{{else}}
119-
<button hx-post="{{.ContextUser.HomeLink}}?action=follow" class="ui basic primary button">
119+
<button class="ui basic primary button link-action" data-url="{{.ContextUser.HomeLink}}?action=follow">
120120
{{svg "octicon-person"}} {{ctx.Locale.Tr "user.follow"}}
121121
</button>
122122
{{end}}

web_src/js/features/common-global.js

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {showTemporaryTooltip} from '../modules/tippy.js';
1212
import {confirmModal} from './comp/ConfirmModal.js';
1313
import {showErrorToast} from '../modules/toast.js';
1414
import {request, POST} from '../modules/fetch.js';
15-
import 'htmx.org';
1615

1716
const {appUrl, appSubUrl, csrfToken, i18n} = window.config;
1817

webpack.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ export default {
214214
},
215215
override: {
216216
'khroma@*': {licenseName: 'MIT'}, // https://github.com/fabiospampinato/khroma/pull/33
217-
'[email protected]': {licenseName: 'BSD-2-Clause'}, // "BSD 2-Clause" -> "BSD-2-Clause"
218217
},
219218
emitError: true,
220219
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)',

0 commit comments

Comments
 (0)