1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-04 08:17:24 -05:00
gitea/templates/shared
Yarden Shoham 1df06e3f39
Don't do a full page load when clicking the follow button (#28872)
- Use htmx to perform the button request
- `hx-headers='{"x-csrf-token": "{{.CsrfToken}}"}'` to authenticate (we
should probably learn to reuse this)
- `hx-post="{{.ContextUser.HomeLink}}?action=follow"` to send a POST
request to follow the user
- `hx-target="#profile-avatar-card"` to target the card div for
replacement
- `hx-swap="outerHTML"` to replace the card (as opposed to its inner
content) with the new card that shows the new follower count and button
color
- Change the backend response to return a `<div>` tag (the card) instead
of a redirect to the user page

# Before

![before](https://github.com/go-gitea/gitea/assets/20454870/86899d15-41c9-42ed-bd85-253b9caac7f8)

# After

![after](https://github.com/go-gitea/gitea/assets/20454870/59455d96-548c-4a81-a5b0-fab1dc1e87ef)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
2024-01-20 23:37:22 +01:00
..
actions Remove autofocus in search box (#28033) 2023-11-20 08:57:46 +00:00
secrets Always use ctx.Locale.Tr inside templates (#27231) 2023-09-25 08:56:50 +00:00
user Don't do a full page load when clicking the follow button (#28872) 2024-01-20 23:37:22 +01:00
variables Fix tooltip of variable edit button (#28681) 2024-01-03 06:25:19 +00:00
webhook Use shared template for webhook icons (#26242) 2023-07-31 08:00:52 +00:00
combomarkdowneditor.tmpl cleanup locale function usage (#27227) 2023-09-24 20:31:58 +00:00
issueicon.tmpl Penultimate round of db.DefaultContext refactor (#27414) 2023-10-11 04:24:07 +00:00
issuelist.tmpl Refactor timeutil package (#28623) 2023-12-28 10:09:57 +00:00
searchbottom.tmpl Fix more "locale" usages (#27259) 2023-09-25 20:42:40 +08:00
searchinput.tmpl Remove autofocus in search box (#28033) 2023-11-20 08:57:46 +00:00