{% load humanize %} {% load purchased %} {% load lib_acqs %} {% load bookpanel %} {% with first_ebook=work.first_ebook supporters=work.last_campaign.supporters thumbnail=work.cover_image_thumbnail author=work.authors_short title=work.title last_campaign=work.last_campaign status=work.last_campaign.status deadline=work.last_campaign.deadline workid=work.id wishlist=request.user.wishlist.works.all %} {% purchased %}{% lib_acqs %}{% bookpanel %}
{% 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' or license_is_active or borrowable %}
{% comment %}bibliographic data{% endcomment %}

{{ title }}

{{ author }}

{% comment %}link to work page{% endcomment %} {% if purchased %}
{% if purchased.gifts.all.count %}A gift to you!{% else %}Purchased!{% endif %}
{% elif borrowed %} Borrowed!

until {{ borrowed.expires|date:"M d, Y" }}

{% elif borrowable %}
Library has it!

{{ lib_acqs.count }}{% if lib_acqs.count == 1 %} copy{% else %} copies{% endif %}

{% else %}
{% if work.last_campaign.type == 3 %} THANKED!

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

from {{ work.last_campaign.supporters_count }} ungluers

and {{ work.last_campaign.anon_count }} others

{% else %} UNGLUED!

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

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

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

{{ title }}

{{ author }}

{% comment %}link to work page{% endcomment %}
{% if in_library %} {% if borrowable %}

Available in your library now!

{% elif lib_thanked %}

Supported by your library!

{% else %}

Available in your library on
{{ next_acq.refreshes|date:"M j, Y" }}

{% endif %} {% else %} {% if work.last_campaign.type == 1 %} UNGLUE IT!

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

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

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

{% elif work.last_campaign.type == 2 %} UNGLUE IT!

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

will unglue on

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

{% elif work.last_campaign.type == 3 %} SAY THANKS!

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

from {{ work.last_campaign.supporters_count }} ungluers

and {{ work.last_campaign.anon_count }} others

{% else %} Never. {% endif %} {% endif %}
{% if request.user.id in supporters %}
{% include "book_panel_addbutton.html" %}
{% else %}
{% include "book_panel_addbutton.html" %}
{% if work.last_campaign.type == 1 %} Pledge {% elif work.last_campaign.type == 2 %} {% if in_library %} Reserve It {% else %} Purchase {% endif %} {% elif work.last_campaign.type == 3 %} Read it Now {% endif %}
{% endif %} {% else %}
{% comment %}bibliographic data{% endcomment %}

{{ title }}

{{ author }}

{% comment %}link to work page{% endcomment %}
{% if status == 'INITIALIZED' %}

Campaign coming soon!

{% elif status == 'SUSPENDED' %}

This campaign has been suspended.


See the FAQ for details.

{% elif status == 'WITHDRAWN' %}

This campaign has been withdrawn.


See the FAQ for details.

{% elif status == 'UNSUCCESSFUL' %}

{{ deadline }}

Watch for a new campaign.

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

{{ title }}

{{ author }}

{% comment %}link to work page{% endcomment %}
{% if first_ebook %} AVAILABLE! {% else %}

No campaign yet.


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

{% endif %}
{% include "book_panel_addbutton.html" %}
{% if first_ebook %} Read it Now {% else %} {% include "num_wishes.html" %} {% endif %}
{% endif %}
Book cover
{{ author }}
{% comment %}same logic as above{% endcomment %} {% if setkw %} {% if setkw in work.subjects.all %}
Unset {{setkw}}
{% else %}
Set {{setkw}}
{% endif %} {% elif show_pledge %} {% elif show_purchase %} {% elif request.user.is_anonymous %} {% elif work in wishlist %} {% if supporter == request.user %} {% comment %} used only on your own supporter page. {% endcomment %}
Un-Fave
{% else %}
{% if purchased %} {% if purchased.gifts.all.count %}A gift to you!{% else %}Purchased!{% endif %} {% elif borrowed %} Borrowed! ...until {% elif request.user.id in supporters %} Pledged! {% else %} Faved! {% endif %}
{% endif %} {% else %}
{% if on_search_page %} Fave {% else %} Fave {% endif %}
{% endif %}
{% if status == "ACTIVE" %} {% if work.last_campaign.type == 1 %}
{{ work.percent_of_goal }}%
{% endif %} {% if work.last_campaign.type == 2 %} {% if in_library %} {% if borrowed %} {{ borrowed.expires|date:"M j, Y" }} {% else %} available
{% if next_acq.refreshes %} {{ next_acq.refreshes|date:"M j, Y" }} {% else %} now {% endif %}
{% endif %} {% else %}
${{ work.last_campaign.individual_offer.price|floatformat:2|intcomma }}
{% endif %} {% endif %} {% if work.last_campaign.type == 3 %} {% include 'num_wishes.html' %} {% endif %} {% elif status == "INITIALIZED" %} Status: Coming soon! {% elif status == "SUCCESSFUL" %} {% if not first_ebook %} Ebook coming soon {% else %} {% include 'num_wishes.html' %} {% endif %} {% else %} {% if first_ebook %} {% include 'num_wishes.html' %} {% endif %} {% endif %}
{% 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 If B2U, read, borrow, reserve, purchase Otherwise: number of wishes {% endcomment %} {% if purchased or borrowed or first_ebook %}
Read it Now
{% elif borrowable %}
Borrow It
{% elif in_library %}
Reserve It
{% elif status == 'ACTIVE' or status == 'SUCCESSFUL' %} {% if not library or not in_library %}
book list status
{{ work.percent_of_goal }}%
{% endif %} {% else %} {% include "num_wishes.html" %} {% endif %}
{% endwith %}