Usage

{% extends "site_base.html" %}

{% block messages %}{% endblock %}

{% block body %}
<section class="fragment-container">
    <h1>Pinax Likes Fragments</h1>

    <h2><div class="variation">With an instance with a get_absolute_url</div><code>_like.html</code></h2>
    <div class="like-fragement-container">
        {% include "pinax/likes/_like.html" with instance=liked_object %}
    </div>

    <h2><div class="variation">Without an get_absolute_url</div><code>_like.html</code></h2>
    <div class="like-fragement-container">
        {% include "pinax/likes/_like.html" %}
    </div>

    <h2><div class="variation">Can Like / Not Liked</div><code>_widget_brief.html</code></h2>
    <div class="like-fragement-container">
        {% include "pinax/likes/_widget_brief.html" with can_like=True like_class="not-liked" like_text="Not Liked" %}
    </div>

    <h2><div class="variation">Can Like / Liked</div><code>_widget_brief.html</code></h2>
    <div class="like-fragement-container">
        {% include "pinax/likes/_widget_brief.html" with can_like=True like_class="liked" like_text="Liked" %}
    </div>

    <h2><div class="variation">Cannot Like</div><code>_widget_brief.html</code></h2>
    <div class="like-fragement-container">
        {% include "pinax/likes/_widget_brief.html" %}
    </div>


    <h2><div class="variation">Can Like / Not Liked</div><code>_widget.html</code></h2>
    <div class="like-fragement-container">
        {% include "pinax/likes/_widget.html" with can_like=True like_class="not-liked" like_text="Not Liked" %}
    </div>

    <h2><div class="variation">Can Like / Liked</div><code>_widget.html</code></h2>
    <div class="like-fragement-container">
        {% include "pinax/likes/_widget.html" with can_like=True like_class="liked" like_text="Liked" %}
    </div>

    <h2><div class="variation">Cannot Like</div><code>_widget.html</code></h2>
    <div class="like-fragement-container">
        {% include "pinax/likes/_widget.html" %}
    </div>

    <h2><div class="variation">Cannot Like</div><code>_widget.html</code></h2>
    <div class="like-fragement-container">
        {% include "pinax/likes/_widget.html" %}
    </div>

    <h2><div class="variation">Can Like</div><code>_widget.html</code></h2>
    <div class="like-fragement-container">
        {% include "pinax/likes/_widget.html" with can_like=True %}
    </div>

    <h2><div class="variation">Cannot Like</div><code>_widget.html</code></h2>
    <div class="like-fragement-container">
        {% include "pinax/likes/_widget.html" %}
    </div>
</section>
{% endblock %}

pinax/likes/_like.html

{% if instance.get_absolute_url %}
	<a class="likes likes-{{ like.type }}" href="{{ instance.get_absolute_url }}">{{ instance }}</a>
{% else %}
	<span class="likes likes-{{ like.type }}">{{ instance }}</span>
{% endif %}

pinax/likes/_widget_brief.html

<div class="likes">
    {% if can_like %}
        <a class="like-link {{ like_class }} ajax"
           data-method="post"
           data-replace-closest=".likes"
           href="{{ like_url }}?t=b"
           title="{{ like_text }}">
           <i class="{% if like_class == "liked" %}fas{% else %}far{% endif %} fa-thumbs-up"></i>
        </a>
    {% endif %}
</div>

pinax/likes/_widget.html

<div class="likes">
    {% if can_like %}
        <a class="like-link {{ like_class }} has-text ajax"
           data-method="post"
           data-replace-closest=".likes"
           href="{{ like_url }}">
           <i class="{% if like_class == "liked" %}fas{% else %}far{% endif %} fa-thumbs-up"></i>
        </a>
    {% endif %}
    <span class="count-label">
        <span class="count">{{ like_count }}</span>
        {{ counts_text }}
    </span>
</div>