Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<div class="flex flex-row items-center my-6">
<span class="mr-4">{{ likes | count }} likes</span>
{{ if logged_in }}
{{ user }}
{{ if (likes | to_json | contains:id) }}
<form class="inline-block mr-4" action="/!/likes/dislike/{{ page:id }}" method="post">
{{ csrf_field }}
<button class="font-semibold text-red-600">Dislike</button>
</form>
{{ else }}
<form class="inline-block mr-4" action="/!/likes/like/{{ page:id }}" method="post">
{{ csrf_field }}
<button class="font-semibold text-green-600">Like</button>
</form>
{{ /if }}
{{ /user }}
{{ /if }}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment