{% load humanize %} {% load purchased %} {% 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.title as title %} {% 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 %} {% with request.user.wishlist.works.all as wishlist %} {% purchased %}
{% comment %} hover state of panel {% endcomment %}
{% if last_campaign %} {% comment %}top section: campaign info + optional action button. Varies by campaign status.{% endcomment %} {% if status == 'SUCCESSFUL' %}
{% comment %}bibliographic data{% endcomment %}

{{ title }}

{{ author }}

{% comment %}link to work page{% endcomment %}
UNGLUED!

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

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

{% include "book_panel_addbutton.html" %}
{% if first_ebook %} Read it Now {% else %} Coming Soon {% endif %}
{% else %}{% if status == 'ACTIVE' %}
{% comment %}bibliographic data{% endcomment %}

{{ title }}

{{ author }}

{% comment %}link to work page{% endcomment %}
UNGLUE IT! {% ifequal work.last_campaign.type 1 %}

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

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

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

{% else %}

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

now ungluing on

{{ work.last_campaign.cc_date|naturalday:"M d, Y" }}

{% endifequal %}
{% if request.user.id in supporters %}
{% include "book_panel_addbutton.html" %}
{% else %}
{% include "book_panel_addbutton.html" %}
{% ifequal work.last_campaign.type 1 %} Pledge {% else %} {% if purchased %} Download {% else %} Purchase {% endif %} {% endifequal %}
{% endif %} {% else %}
{% comment %}bibliographic data{% endcomment %}

{{ title }}

{{ author }}

{% comment %}link to work page{% endcomment %}
{% 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.

{% endif %}{% endif %}{% endif %}{% endif %}
{% include "book_panel_addbutton.html" %}
{% endif %}{% endif %} {% else %}
{% comment %}bibliographic data{% endcomment %}

{{ title }}

{{ author }}

{% comment %}link to work page{% endcomment %}
{% if first_ebook %} AVAILABLE!
{% include "book_panel_addbutton.html" %}
{% else %}

No campaign yet.


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

{% endif %}
{% if first_ebook %} Read it Now {% else %} {% include "book_panel_addbutton.html" %} {% 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 %} {% comment %} used only on your own supporter page. {% endcomment %} {% ifequal status "ACTIVE" %}
{% ifequal work.last_campaign.type 1 %} Pledge {% else %} {% if purchased %} Download {% else %} Purchase {% endif %} {% endifequal %}
{% else %}
Un-list
{% endifequal %} {% else %}{% ifequal status "ACTIVE" %}
{% ifequal work.last_campaign.type 1 %} Pledge {% else %} {% if purchased %} Download {% else %} Purchase {% endif %} {% endifequal %}
{% else %}{% if work in wishlist %}
On My List!
{% else %}
{% if on_search_page %} Add to My List {% else %} Add to My List {% endif %}
{% endif %}{% endifequal %}{% endifequal %}{% endif %}{% endif %}
{% ifequal status "ACTIVE" %} {% ifequal work.last_campaign.type 1 %} ${{ work.last_campaign.current_total|floatformat:0|intcomma }}/${{ work.last_campaign.target|floatformat:0|intcomma }} {% else %} ${{ work.last_campaign.left|floatformat:0|intcomma }} to go {% endifequal %} {% else %}{% ifequal status "INITIALIZED" %} Status: Coming soon! {% else %}{% ifequal status "SUCCESSFUL" %} {% if not first_ebook %} Ebook coming soon {% else %} {% endif %} {% endifequal %}{% 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 %}
Read it Now
{% else %}{% if status == 'ACTIVE' or status == 'SUCCESSFUL' %}
book list status
{{ work.percent_of_goal }}%
{% else %} {% if work.num_wishes %} Listed by {{ work.num_wishes }} {% else %} Listed by 0 {% endif %} {% endif %}{% endif %}
{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %}