{% load humanize %} {% load purchased %} {% load lib_acqs %} {% load bookpanel %} {% with work.first_ebook as first_ebook %} {% with work.last_campaign.supporters as supporters %} {% with work.cover_image_thumbnail as thumbnail %} {% with work.authors_short 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 %}{% 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 %}
{% else %}{% if borrowed %} Borrowed!

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

{% else %}{% if borrowable %}
Library has it!

{{ lib_acqs.count }}{% ifequal lib_acqs.count 1 %} copy{% else %} copies{% endifequal %}

{% else %}
{% ifequal 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 }}

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

{{ title }}

{{ author }}

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

Available in your library now!

{% else %}{% if lib_thanked %}

Supported by your library!

{% else %}

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

{% endif %}{% endif %} {% else %} {% ifequal 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" }}

{% else %}{% ifequal 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" }}

{% else %}{% ifequal 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.{% endifequal %}{% endifequal %}{% endifequal %} {% endif %}
{% 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 %}{% ifequal work.last_campaign.type 2 %} {% if in_library %} Reserve It {% else %} Purchase {% endif %} {% else %}{% ifequal work.last_campaign.type 3 %} Read it Now {% endifequal %}{% endifequal %}{% 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" %}
{% include "num_wishes.html" %}
{% endif %}{% 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 %} {% else %}{% if show_pledge %} {% else %}{% if show_purchase %} {% else %}{% if request.user.is_anonymous %} {% else %}{% if work in wishlist %} {% ifequal 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 %} {% else %}{% if borrowed %} Borrowed! ...until {% else %}{% if request.user.id in supporters %} Pledged! {% else %} Faved! {% endif %}{% endif %}{% endif %}
{% endifequal %} {% else %}
{% if on_search_page %} Fave {% else %} Fave {% endif %}
{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}
{% ifequal status "ACTIVE" %} {% ifequal work.last_campaign.type 1 %}
{{ work.percent_of_goal }}%
{% endifequal %} {% ifequal 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 %} {% endifequal %} {% ifequal work.last_campaign.type 3 %} {% include 'num_wishes.html' %} {% endifequal %} {% else %}{% ifequal status "INITIALIZED" %} Status: Coming soon! {% else %}{% ifequal status "SUCCESSFUL" %} {% if not first_ebook %} Ebook coming soon {% else %} {% include 'num_wishes.html' %} {% endif %} {% else %} {% if first_ebook %} {% include 'num_wishes.html' %} {% 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 If B2U, read, borrow, reserve, purchase Otherwise: number of wishes {% endcomment %} {% if purchased or borrowed or first_ebook %}
Read it Now
{% else %}{% if borrowable %}
Borrow It
{% else %}{% if in_library %}
Reserve It
{% else %}{% if 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 %}{% endif %}{% endif %}{% endif %}
{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %}