Skip to content

Commit

Permalink
Improve following on default template
Browse files Browse the repository at this point in the history
  • Loading branch information
benpate committed Aug 29, 2024
1 parent c725618 commit 515d408
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
14 changes: 7 additions & 7 deletions _embed/templates/base-social/like-button.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
<span hx-target="this" hx-swap="outerHTML" hx-push-url="false">

{{- if $responses.Like -}}
<button class="turboclick bold link" hx-post="{{.BasePath}}/like-button?url={{$url}}" hx-vals='{"type":"Like", "url":"{{$url}}", "exists":false}'>{{icon "thumbs-up-fill"}} Liked</button>
<button class="turboclick bold link" hx-post="{{.BasePath}}/like-button?url={{$url}}" hx-vals='{"type":"Like", "url":"{{$url}}", "exists":false}'><span aria-hidden="true" class="margin-left-xs">{{icon "thumbs-up-fill"}}</span> Liked</button>
{{- else if $responses.Dislike -}}
<button class="turboclick bold link" hx-post="{{.BasePath}}/like-button?url={{$url}}" hx-vals='{"type":"Dislike", "url":"{{$url}}", "exists":false}'>{{icon "thumbs-down-fill"}} Disiked</button>
<button class="turboclick bold link" hx-post="{{.BasePath}}/like-button?url={{$url}}" hx-vals='{"type":"Dislike", "url":"{{$url}}", "exists":false}'><span aria-hidden="true" class="margin-left-xs">{{icon "thumbs-down-fill"}}</span> Disiked</button>
{{- else -}}
<button class="turboclick bold" hx-post="{{.BasePath}}/like-button?url={{$url}}" hx-vals='{"type":"Like", "url": "{{$url}}", "exists":true}'>{{icon "thumbs-up"}}</button>
<button class="turboclick bold" hx-post="{{.BasePath}}/like-button?url={{$url}}" hx-vals='{"type":"Dislike", "url": "{{$url}}", "exists":true}'>{{icon "thumbs-down"}}</button>
<button class="turboclick bold" hx-post="{{.BasePath}}/like-button?url={{$url}}" hx-vals='{"type":"Like", "url": "{{$url}}", "exists":true}'><span aria-hidden="true" class="margin-left-xs">{{icon "thumbs-up"}}</span> Like</button>
<button class="turboclick bold" hx-post="{{.BasePath}}/like-button?url={{$url}}" hx-vals='{"type":"Dislike", "url": "{{$url}}", "exists":true}'><span aria-hidden="true" class="margin-left-xs">{{icon "thumbs-down"}}</span> Dislike</button>
{{- end -}}

{{- if $responses.Announce -}}
<button class="turboclick bold link" hx-post="{{.BasePath}}/like-button?url={{$url}}" hx-vals='{"type":"Announce", "url":"{{$url}}", "exists":false}'>{{icon "share-fill"}} Shared</button>
<button class="turboclick bold link" hx-post="{{.BasePath}}/like-button?url={{$url}}" hx-vals='{"type":"Announce", "url":"{{$url}}", "exists":false}'><span aria-hidden="true" class="margin-left-xs">{{icon "share-fill"}}</span> Shared</button>
{{- else -}}
<button class="turboclick bold" hx-post="{{.BasePath}}/like-button?url={{$url}}" hx-vals='{"type":"Announce", "url": "{{$url}}", "exists":true}'>{{icon "share"}}</button>
<button class="turboclick bold" hx-post="{{.BasePath}}/like-button?url={{$url}}" hx-vals='{"type":"Announce", "url": "{{$url}}", "exists":true}'><span aria-hidden="true" class="margin-left-xs">{{icon "share"}}</span> Shared</button>
{{- end -}}

</span>
</span>
2 changes: 1 addition & 1 deletion _embed/templates/stream-outbox-message/template.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
templateId:"outbox-message"
templateRole:"outbox-message"
socialRole:"Note"
extends:["base-social"]
extends:["base-social", "base-intent"]
model:"stream"
icon:"message"
label:"Post"
Expand Down
25 changes: 17 additions & 8 deletions _embed/templates/stream-outbox-message/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@
</div>
</div>
</a>

<div class="flex-row margin-vertical-sm text-sm">
<div class="flex-shrink-0 width-64 margin-right"></div>
<div>
{{- if .UserCan "like-button" -}}
{{.View "like-button"}}
{{- else -}}
<button hx-get="/{{.StreamID}}/intent?intent=like&object={{.Permalink}}"><span aria-hidden="true" class="margin-left-xs">{{icon "thumbs-up"}}</span> Like</button>
<button hx-get="/{{.StreamID}}/intent?intent=dislike&object={{.Permalink}}"><span aria-hidden="true" class="margin-left-xs">{{icon "thumbs-down"}}</span> Dislike</button>
<button hx-get="/{{.StreamID}}/intent?intent=create&content={{.Label}} {{.Permalink}}"><span aria-hidden="true" class="margin-left-xs">{{icon "share"}}</span> Share</button>
<button hx-get="/{{.StreamID}}/intent" aria-label="Manage Accounts">{{icon "more-horizontal"}}</button>
{{- end -}}
</div>
</div>
</div>

{{- if .UserCan "edit" -}}
Expand All @@ -52,21 +66,16 @@

</div>

<div class="text-lg margin-vertical-lg">
{{.ContentHTML}}
</div>

{{- if ne .IconURL "" -}}
<div class="margin-vertical">
<img src="{{.IconURL}}?width=600" class="u-photo width-100%">
</div>
{{- end -}}

{{- if .UserCan "like-button" -}}
<div class="margin-vertical text-sm">
{{.View "like-button"}}
</div>
{{- end -}}
<div class="text-lg margin-vertical-lg" style="width:clamp(400px, 90%, 800px)">
{{.ContentHTML}}
</div>

{{- .View "responses-replies" -}}

Expand Down
2 changes: 1 addition & 1 deletion _embed/templates/user-outbox/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h1 class="p-name margin-none">{{.DisplayName}}</h1>
<div class="text-sm gray50 ellipsis">@{{.Username}}@{{.Hostname}}</div>
{{- if not .Myself -}}
<div class="margin-top">
<button type="button" class="primary width-100% ellipsis" hx-get="/@{{.UserID}}/follow">{{icon "add-circle"}} Follow {{.DisplayName}}</button>
<button type="button" class="primary width-100% ellipsis" hx-get="/@{{.UserID}}/intent?intent=follow&object={{.Permalink}}">{{icon "add-circle"}} Follow {{.DisplayName}}</button>
</div>
{{- end -}}

Expand Down

0 comments on commit 515d408

Please sign in to comment.