forgejo/templates/shared/user
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
..
authorlink.tmpl
avatarlink.tmpl Use template context function for avatar rendering (#26385) 2023-08-10 11:19:39 +08:00
name.tmpl Always use whole user name as link (#27815) 2023-10-30 09:53:16 +00:00
namelink.tmpl
org_profile_avatar.tmpl Add word-break to organization name and description (#26624) 2023-10-25 10:40:39 +00:00
profile_big_avatar.tmpl Don't do a full page load when clicking the follow button (#28872) 2024-01-20 23:37:22 +01:00