aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2024-02-05 13:08:23 +0000
committerr <r@freesoftwareextremist.com>2024-02-05 13:08:23 +0000
commit11ea3b4d47a732fe1c6abc39ce452f899f70859f (patch)
tree80a8fbba346c4bc6e9fe695620911c9749e8ae46 /templates
parentce0195a8104f34ff18f831754c428aec904c0f89 (diff)
downloadbloat-11ea3b4d47a732fe1c6abc39ce452f899f70859f.tar.gz
bloat-11ea3b4d47a732fe1c6abc39ce452f899f70859f.zip
Add inline follow/unfollow buttons on follow list page
Diffstat (limited to 'templates')
-rw-r--r--templates/user.tmpl10
-rw-r--r--templates/userlistfollow.tmpl30
2 files changed, 35 insertions, 5 deletions
diff --git a/templates/user.tmpl b/templates/user.tmpl
index 8f47929..f34a9df 100644
--- a/templates/user.tmpl
+++ b/templates/user.tmpl
@@ -16,7 +16,7 @@
source
</a>
</div>
- {{if not .IsCurrent}}
+ {{if (ne $.Ctx.UserID .User.ID)}}
<div>
<span> {{if .User.Pleroma.Relationship.FollowedBy}} follows you - {{end}} </span>
{{if .User.Pleroma.Relationship.BlockedBy}} blocks you - {{end}}
@@ -104,7 +104,7 @@
<a href="/user/{{.User.ID}}/followers">followers ({{.User.FollowersCount}})</a> -
<a href="/user/{{.User.ID}}/media">media</a>
</div>
- {{if .IsCurrent}}
+ {{if (eq $.Ctx.UserID .User.ID)}}
<div>
<a href="/user/{{.User.ID}}/bookmarks">bookmarks</a>
- <a href="/user/{{.User.ID}}/likes">likes</a>
@@ -115,7 +115,7 @@
{{end}}
<div>
<a href="/usersearch/{{.User.ID}}">search statuses</a>
- {{if .IsCurrent}} - <a href="/filters">filters</a> {{end}}
+ {{if (eq $.Ctx.UserID .User.ID)}} - <a href="/filters">filters</a> {{end}}
</div>
</div>
<div class="user-profile-description">
@@ -140,11 +140,11 @@
{{else if eq .Type "following"}}
<h1>Following</h1>
-{{template "userlist.tmpl" (WithContext .Users $.Ctx)}}
+{{template "userlistfollow.tmpl" (WithContext .Users $.Ctx)}}
{{else if eq .Type "followers"}}
<h1>Followers</h1>
-{{template "userlist.tmpl" (WithContext .Users $.Ctx)}}
+{{template "userlistfollow.tmpl" (WithContext .Users $.Ctx)}}
{{else if eq .Type "media"}}
<h1>Statuses with media</h1>
diff --git a/templates/userlistfollow.tmpl b/templates/userlistfollow.tmpl
new file mode 100644
index 0000000..298142f
--- /dev/null
+++ b/templates/userlistfollow.tmpl
@@ -0,0 +1,30 @@
+{{with .Data}}
+{{if .}}
+<table>
+{{range .}}
+ <tr>
+ <td> {{template "userlistitem.tmpl" (WithContext . $.Ctx)}} </td>
+ <td>
+ {{if (ne $.Ctx.UserID .ID)}}
+ {{if .Pleroma.Relationship.Following}}
+ <form class="user-list-action" action="/unfollow/{{.ID}}" method="POST">
+ <input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
+ <input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
+ <button type="submit">Unfollow</button>
+ </form>
+ {{else}}
+ <form class="user-list-action" action="/follow/{{.ID}}" method="POST">
+ <input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
+ <input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
+ <button type="submit">Follow</button>
+ </form>
+ {{end}}
+ {{end}}
+ </td>
+ </tr>
+{{end}}
+</table>
+{{else}}
+<p>No data found</p>
+{{end}}
+{{end}}