Refactor "htmx" to "fetch action" (#37208)
The only remaining (hard) part is "templates/repo/editor/edit.tmpl", see the FIXME By the way: * Make "user unfollow" use basic color but not red color, indeed it is not dangerous * Fix "org folllow" layout (use block gap instead of inline gap)
This commit is contained in:
@@ -115,16 +115,19 @@
|
||||
{{end}}
|
||||
{{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}}
|
||||
{{if not .UserBlocking}}
|
||||
<li class="follow" hx-target="#profile-avatar-card" hx-indicator="#profile-avatar-card">
|
||||
{{if $.IsFollowing}}
|
||||
<button hx-post="{{.ContextUser.HomeLink}}?action=unfollow" class="ui basic red button">
|
||||
<li class="follow">
|
||||
{{$buttonExtraClass := Iif $.IsFollowing "" "primary"}}
|
||||
{{$followAction := Iif $.IsFollowing "unfollow" "follow"}}
|
||||
<button class="ui basic {{$buttonExtraClass}} button"
|
||||
data-fetch-method="post" data-fetch-url="{{.ContextUser.HomeLink}}?action={{$followAction}}"
|
||||
data-fetch-sync="$body #profile-avatar-card"
|
||||
>
|
||||
{{if $.IsFollowing}}
|
||||
{{svg "octicon-person"}} {{ctx.Locale.Tr "user.unfollow"}}
|
||||
</button>
|
||||
{{else}}
|
||||
<button hx-post="{{.ContextUser.HomeLink}}?action=follow" class="ui basic primary button">
|
||||
{{else}}
|
||||
{{svg "octicon-person"}} {{ctx.Locale.Tr "user.follow"}}
|
||||
</button>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</button>
|
||||
</li>
|
||||
{{end}}
|
||||
<li>
|
||||
|
||||
Reference in New Issue
Block a user