regluit/frontend/templates/book_panel.html

201 lines
8.9 KiB
HTML
Raw Normal View History

{% load humanize %}
2012-03-09 13:56:59 +00:00
{% 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 %}
2012-05-31 17:33:16 +00:00
{% with work.title as title %}
{% with work.last_campaign as last_campaign %}
{% with work.last_campaign.status as status %}
2012-05-24 16:35:58 +00:00
{% with work.last_campaign.deadline as deadline %}
{% with work.id as workid %}
<div class="thewholebook listview tabs {% if first_ebook or status == 'SUCCESSFUL' %}tabs-1{% else %}{% if status == 'ACTIVE' %}tabs-2{% else %}tabs-3{% endif %}{% endif %}">
<div class="listview book-list">
<div class="listview panelback side2">
2012-05-31 17:29:41 +00:00
{% comment %} hover state of panel {% endcomment %}
<div class="greenpanel2">
<div class="greenpanel_top">
<div class="unglued_white">
2012-05-31 17:29:41 +00:00
{% comment %}top section: campaign info + optional action button. Varies by campaign status.{% endcomment %}
{% if status == 'SUCCESSFUL' %}
<b>UNGLUED!</b>
<p><b>On:</b> {{ deadline|date:"M d, Y" }}</p>
<p><b>Raised:</b> {{ work.last_campaign.current_total|floatformat:0|intcomma }}</p>
{% if first_ebook %}
<a href="{% url download workid %}" class="hijax"><span class="read_itbutton"><span>Read it Now</span></span></a>
2012-05-31 17:29:41 +00:00
{% else %}
<span class="read_itbutton"><span>Coming Soon</span></span>
2012-05-31 17:29:41 +00:00
{% endif %}
{% else %}{% if status == 'ACTIVE' %}
<b>UNGLUE IT!</b>
<p><b>${{ work.last_campaign.current_total|floatformat:0|intcomma }}</b> raised</p>
<p><b>${{ work.last_campaign.target|floatformat:0|intcomma }}</b> needed</p>
<p>by {{ deadline|naturalday:"M d, Y" }}</p>
<a href="{% url pledge work_id=workid %}"><span class="read_itbutton pledge"><span>Pledge</span></span></a>
2012-05-31 17:29:41 +00:00
{% else %}{% if status == 'INITIALIZED' %}
<p>Campaign coming soon!</p>
{% else %}{% if status == 'SUSPENDED' %}
<p>This campaign has been suspended.</p><br /><p>See the <a href="{{faqurl}}">FAQ</a> for details.</p>
{% else %}{% if status == 'WITHDRAWN' %}
<p>This campaign has been withdrawn.</p><br /><p>See the <a href="{{faqurl}}">FAQ</a> for details.</p>
{% else %}{% if status == 'UNSUCCESSFUL' %}
<p>{{ deadline }}</p>
<p>Watch for a new campaign.</p>
{% else %}
{% if first_ebook %}
<b>AVAILABLE!</b>
<a href="{{ work.ebooks.0.url }}"><span class="read_itbutton"><span>Read it Now</span></span></a>
2012-05-31 17:29:41 +00:00
{% else %}
<p>No campaign yet.</p><br /><p>But if lots of ungluers wishlist this book, maybe there will be!</p>
{% endif %}
{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}
</div>
</div>
2012-05-31 17:29:41 +00:00
{% comment %}link to work page{% endcomment %}
<div class="moreinfo">
<a href="{% if workid %}{% url work workid %}{% else %}{% url googlebooks googlebooks_id %}{% endif %}" target="_top">More Info</a>
</div>
2012-05-01 13:56:19 +00:00
2012-05-31 17:29:41 +00:00
{% comment %}bibliographic data{% endcomment %}
<div class="white_text">
2012-05-31 17:33:16 +00:00
<p><a href="{% if workid %}{% url work workid %}{% else %}{% url googlebooks googlebooks_id %}{% endif %}">{{ title }}</a></p>
2012-05-31 17:29:41 +00:00
<p>{{ author }}</p>
</div>
2012-05-31 17:29:41 +00:00
{% 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 %}
<div class="moreinfo create-account">
<span title="{% if workid %}{% url work workid %}{% else %}{% url googlebooks googlebooks_id %}{% endif %}">Login to Add</span>
</div>
{% else %}{% if request.user.id in supporters %}
<div class="moreinfo on-wishlist">
<span>Pledged!</span>
</div>
{% else %}{% ifequal supporter request.user %}
<div class="moreinfo remove-wishlist">
<span id="p{{ workid }}">Remove This</span>
</div>
{% else %}{% if work in wishlist %}
2012-05-31 17:29:41 +00:00
<div class="moreinfo on-wishlist">
<a href="#">On Wishlist!</a>
</div>
{% else %}
<div class="moreinfo add-wishlist">
{% if on_search_page %}
<span class="gb_id" id="p{{ googlebooks_id }}">Add&nbsp;to&nbsp;Wishlist</span>
{% else %}
2012-05-31 17:29:41 +00:00
<span class="work_id" id="p{{ workid }}">Add&nbsp;to&nbsp;Wishlist</span>
{% endif %}
</div>
{% endif %}{% endifequal %}{% endif %}{% endif %}
</div>
</div>
<div class="listview panelfront side1 book-thumb">
<a href="{% if workid %}{% url work workid %}{% else %}{% url googlebooks googlebooks_id %}{% endif %}" target="_top"><img src="{% if thumbnail %}{{ thumbnail }}{% else %}/static/images/generic_cover_larger.png{% endif %}" alt="Book cover" title="book cover" /></a>
</div>
<div class="listview panelfront side1 book-name">
<div class="title">
2012-05-31 17:33:16 +00:00
<a href="{% if workid %}{% url work workid %}{% else %}{% url googlebooks googlebooks_id %}{% endif %}">{{ title }}</a>
</div>
2012-03-09 13:56:59 +00:00
<div class="listview author {{ author }}">{{ author }}</div>
</div>
{% comment %}same logic as above{% endcomment %}
{% if request.user.is_anonymous %}
<div class="listview panelfront side1 create-account">
<span title="{% if workid %}{% url work workid %}{% else %}{% url googlebooks googlebooks_id %}{% endif %}">Login to Add</span>
</div>
{% else %}{% if request.user.id in supporters %}
<div class="listview panelfront side1 on-wishlist">
<span>Pledged!</span>
</div>
{% else %}{% ifequal supporter request.user %}
<div class="listview panelfront side1 remove-wishlist">
<span id="l{{ workid }}">Un-wishlist</span>
</div>
{% else %}{% if work in wishlist %}
<div class="listview panelfront side1 on-wishlist">
2012-02-14 16:36:12 +00:00
<span>On Wishlist!</span>
</div>
{% else %}
<div class="listview panelfront side1 add-wishlist">
{% ifequal status "ACTIVE" %}
<span class="booklist_pledge"><a href="{% url pledge work_id=workid %}" class="fakeinput">Pledge</a></span>
{% else %}
{% if on_search_page %}
<span class="gb_id" id="l{{ googlebooks_id }}">Add to Wishlist</span>
{% else %}
<span class="work_id" id="l{{ workid }}">Add to Wishlist</span>
{% endif %}
{% endifequal %}
</div>
{% endif %}{% endifequal %}{% endif %}{% endif %}
<div class="listview panelfront side1 booklist-status">
{% ifequal status "ACTIVE" %}
<span class="booklist-status-text"><b>${{ work.last_campaign.current_total|floatformat:0|intcomma }}</b>/<b>${{ work.last_campaign.target|floatformat:0|intcomma }}</b></span>
{% else %}{% ifequal status "INITIALIZED" %}
<span class="booklist-status-label">Status:&nbsp;</span><span class="booklist-status-text">Coming soon!</span>
{% else %}{% ifequal status "SUCCESSFUL" %}
{% if not first_ebook %}
<span class="booklist-status-text" style="width: 190px">Ebook coming soon</span>
{% else %}
<span class="booklist-status-label"></span>
{% endif %}
{% endifequal %}{% endifequal %}{% endifequal %}
</div>
<div class="listview panelfront side1 icons">
{% 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 %}
<a href="{% url download workid %}" class="hijax"><div class="read_itbutton"><span>Read it Now</span></div></a>
{% else %}{% if status == 'ACTIVE' or status == 'SUCCESSFUL' %}
<div class="booklist-status-img">
<img src="/static/images/images/icon-book-37by25-{{ work.percent_unglued }}.png" title="book list status" alt="book list status" />
</div>
<div class="booklist-status-label panel">{{ work.percent_of_goal }}%</div>
2012-01-16 17:10:38 +00:00
{% else %}
{% if work.num_wishes %}
<a href="{% if workid %}{% url work workid %}{% else %}{% url googlebooks googlebooks_id %}{% endif %}?tab=3" class="nobold"><span class="rounded"><span class="grey"><span class="panelnope">Wished by&nbsp;</span>{{ work.num_wishes }}</span></span></a>
{% else %}
<a href="{% if workid %}{% url work workid %}{% else %}{% url googlebooks googlebooks_id %}{% endif %}?tab=3" class="nobold"><span class="rounded"><span class="grey"><span class="panelnope">Wished by&nbsp;</span>0</span></span></a>
{% endif %}
{% endif %}{% endif %}
2012-01-16 17:10:38 +00:00
</div>
<div class="listview panelfront side1 ebooks">
</div>
</div>
2012-03-09 13:56:59 +00:00
</div>
{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}
2012-05-24 16:35:58 +00:00
{% endwith %}
{% endwith %}
2012-05-31 17:33:16 +00:00
{% endwith %}
{% endwith %}