{% load humanize %} {% with work.first_ebook as first_ebook %} {% with work.last_campaign.supporters as supporters %} {% with work.cover_image_thumbnail as thumbnail %} {% with work.author as author %} {% with work.last_campaign as last_campaign %} {% with work.last_campaign.status as status %} {% with work.last_campaign.deadline as deadline %} {% with work.id as workid %}
{% comment %}top section: campaign info + optional action button. Varies by campaign status.{% endcomment %} {% if status == 'SUCCESSFUL' %} UNGLUED!

On: {{ deadline|date:"M d, Y" }}

Raised: {{ work.last_campaign.current_total|floatformat:0|intcomma }}

{% if first_ebook %}
Read it Now
{% else %}
Coming Soon
{% endif %} {% else %}{% if status == 'ACTIVE' %} UNGLUE IT!

${{ work.last_campaign.current_total|floatformat:0|intcomma }} raised

${{ work.last_campaign.target|floatformat:0|intcomma }} needed

by {{ deadline|date:"M d, Y" }}

Support
{% else %}{% if status == 'INITIALIZED' %}

Campaign coming soon!

{% else %}{% if status == 'SUSPENDED' %}

This campaign has been suspended.


See the FAQ for details.

{% else %}{% if status == 'WITHDRAWN' %}

This campaign has been withdrawn.


See the FAQ for details.

{% else %}{% if status == 'UNSUCCESSFUL' %}

{{ deadline }}

Watch for a new campaign.

{% else %} {% if first_ebook %} AVAILABLE!
Read it Now
{% else %}

No campaign yet.


But if lots of ungluers wishlist this book, maybe there will be!

{% endif %} {% endif %}{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}
{% comment %}link to work page{% endcomment %} {% comment %}bibliographic data{% endcomment %}

{{ work.title }}

{{ author }}

{% comment %} status of book vis-a-vis user's wishlist. Non-logged-in users should see login to add option. Logged-in users, book on wishlist: If they've pledged, that should be displayed, with no removal option. If they're on their supporter page, they should have the option to remove it (except when pledged). Elsewhere, they should see that it's on their wishlist. Everyone else should have add-to-wishlist option. (Needed ID for wishlist.js varies on search & supporter page.) {% endcomment %} {% if request.user.is_anonymous %} {% else %}{% if request.user.id in supporters %}
Pledged!
{% else %}{% ifequal supporter request.user %}
Remove This
{% else %}{% if work in request.user.wishlist.works.all %} {% else %}
{% if on_search_page %} Add to Wishlist {% else %} Add to Wishlist {% endif %}
{% endif %}{% endifequal %}{% endif %}{% endif %}
Book cover
{{ author }}
{% comment %}same logic as above{% endcomment %} {% if request.user.is_anonymous %} {% else %}{% if request.user.id in supporters %}
Pledged!
{% else %}{% ifequal supporter request.user %}
Remove This
{% else %}{% if work in request.user.wishlist.works.all %}
On Wishlist!
{% else %}
{% if on_search_page %} Add to Wishlist {% else %} Add to Wishlist {% endif %}
{% endif %}{% endifequal %}{% endif %}{% endif %}
{% ifequal status "ACTIVE" %} ${{ work.last_campaign.current_total|floatformat:0|intcomma }}/${{ work.last_campaign.target|floatformat:0|intcomma }} {% else %}{% ifequal status "INITIALIZED" %} Status: Coming soon! {% else %} {% endifequal %}{% endifequal %}
{% comment %} For status icons, we should display... If there is an ebook: options to get it If no ebook but there is an active or successful campaign: progress toward goal Otherwise: number of wishes {% endcomment %} {% if first_ebook %} {% for ebook in work.ebooks|slice:":3" %} {{ ebook.rights}}  {{ ebook.format }} at {{ebook.provider}} {% endfor %} {% else %}{% if status == 'ACTIVE' or status == 'SUCCESSFUL' %}
book list status
{{ work.percent_of_goal }}%
{% else %} Wished by {{ work.num_wishes }} {% endif %}{% endif %}
{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %}