regluit/frontend/templates/work.html

389 lines
23 KiB
HTML

{% extends "base.html" %}
{% load comments %}
{% block title %}— {% if work.last_campaign_status == 'ACTIVE' %}Campaign to unglue {% endif %}{{ work.title }}{% endblock %}
{% block extra_css %}
<link type="text/css" rel="stylesheet" href="/static/css/campaign.css" />
{% endblock %}
{% block base_js %}
<script type="text/javascript" src="{{ jquery_home }}"></script>
<script type="text/javascript" src="{{ jquery_ui_home }}"></script>
<script type="text/javascript" src="/static/js/wishlist.js"></script>
<script type="text/javascript" src="/static/js/tabs4.js"></script>
<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
<script type="text/javascript" src="/static/js/counter.js"></script>
<script type="text/javascript" src="/static/js/embed.js"></script>
<script>
var $j = jQuery.noConflict();
$j(document).ready(function(){
$j('.show_more_edition').click(function(){
if ($j(this).html() == 'less...') {
$j(this).html('more...')
} else {
$j(this).html('less...')
}
$j(this).next().toggle();
});
});
$j(document).ready(function(){
$j('.show_more_ebooks').click(function(){
if ($j(this).html() == '<br>hide downloads') {
$j(this).html('<br>more downloads...')
} else {
$j(this).html('<br>hide downloads')
}
$j(this).next().toggle();
});
});
$j(document).ready(function(){
var img = $j('#book-detail-img');
var googimg = $j('#find-google img');
img.mouseover(function(){
googimg.css({"background": "#8dc63f"}).animate(
{backgroundColor: "white"}, 1500
);
});
});
</script>
{% endblock %}
{% block content %}
{% with work.last_campaign_status as status %}
<div id="main-container">
<div class="js-main">
<div id="js-leftcol">
<div class="jsmodule rounded">
<div class="jsmod-content{% if status == 'ACTIVE' %} active{{ work.percent_unglued}}{% endif %}">
<span>
{% if work.first_ebook %}
AVAILABLE!
{% else %}{% if work.last_campaign %}
{% if status == 'ACTIVE' %}
Campaign in Progress: <br />${{ work.last_campaign.current_total }}/${{ work.last_campaign.target }}
{% else %}
{% if status == 'SUCCESSFUL' %}
Unglued on {{ work.last_campaign.deadline|date:"M j, Y"}}! <br />${{ work.last_campaign.current_total }} raised of ${{ work.last_campaign.target }} goal
{% else %}{% if status == 'INITIALIZED' %}
Campaign starting soon
{% else %}{% if status == 'SUSPENDED' %}
Campaign suspended. <br />See <a href="/faq">FAQ</a>.
{% else %}{% if status == 'WITHDRAWN' %}
Campaign withdrawn. <br />See <a href="/faq">FAQ</a>.
{% else %}{% if wishers == 1 %}
<span class="findtheungluers">{{ wishers }} Ungluer is WISHING</span>
{% else %}
<span class="findtheungluers">{{ wishers }} Ungluers are WISHING</span>
{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}
{% endif %}
{% else %}
<span class="findtheungluers">
{% if wishers == 1 %}
{{ wishers }} Ungluer is WISHING
{% else %}
{{ wishers }} Ungluers are WISHING
{% endif %}
</span>
{% endif %}{% endif %}
</span>
<span class="spacer">&nbsp;<br />&nbsp;</span>
</div>
</div>
{% include "explore.html" %}
</div>
<div id="js-maincol">
<div class="js-maincol-inner">
<div id="content-block">
<div class="book-detail">
<div id="book-detail-img"><a href="{{ work.googlebooks_url }}">
<img src="{{ work.cover_image_thumbnail }}" alt="Find {{ work.title }} at Google Books" title="Find {{ work.title }} at Google Books" width="131" height="192" /></a>
</div>
<div class="book-detail-info">
<div class="layout">
<h2 class="book-name">{{ work.title }}</h2>
<div>
<div class="pubinfo">
<h3 class="book-author">{{ work.author }}</h3>
<h3 class="book-year">{{ pubdate }}</h3>
</div>
{% if status == 'ACTIVE' %}
{% if pledged %}
<div class="btn_support modify"><form action="{% url pledge_modify work_id=work.id %}" method="get"><input type="submit" value="Modify Pledge" /></form></div>
{% else %}
<div class="btn_support"><form action="{% url pledge work_id=work.id %}" method="get"><input type="submit" value="Support" /></form></div>
{% endif %}
{% endif %}
</div>
</div>
{% if work.first_ebook %}
<div class="get-book">
<label>Get it:</label>
<span class="find-link">
{% for ebook in work.ebooks %}
{% if forloop.first %}
<span class="first_ebook">
{% endif %}
{% if forloop.counter == 2 %}
</span>
<span class="show_more_ebooks"><br />More downloads...</span>
<span class="more_ebooks">
{% endif %}
{% if not forloop.first %}
<br />
{% endif %}
<a href="{{ ebook.url }}"><img src="/static/images/{{ ebook.format }}32.png" height="32" alt=" {{ ebook.format }} at {{ebook.provider}}" title=" {{ ebook.format }} at {{ebook.provider}}" /><img src="{{ebook.rights_badge}}" height="31" width="88" alt="{{ebook.rights}}" title="{{ebook.rights}}" /></a>
{% if forloop.last %}
</span>
{% endif %}
{% endfor %}
</span>
</div>
{% endif %}
<div class="find-book">
<label>Find it:</label>
<div class="find-link">
<a id="find-google" href="{{ work.googlebooks_url }}"><img src="/static/images/supporter_icons/googlebooks_square.png" title="Find on Google Books" alt="Find on Google Books" /></a>
<a rel="nofollow" class="find-openlibrary" href="{% url work_openlibrary work.id %}"><img src="/static/images/supporter_icons/openlibrary_square.png" title="Find on OpenLibrary" alt="Find on OpenLibrary" /></a>
{% if not request.user.is_anonymous %}
{% if request.user.profile.goodreads_user_link %}
<a rel="nofollow" class="find-goodreads" href="{% url work_goodreads work.id %}"><img src="/static/images/supporter_icons/goodreads_square.png" title="Find on GoodReads" alt="Find on GoodReads" /></a>
{% endif %}
{% if request.user.profile.librarything_id %}
<a rel="nofollow" class="find-librarything" href="{% url work_librarything work.id %}"><img src="/static/images/supporter_icons/librarything_square.png" title="Find on LibraryThing" alt="Find on LibraryThing" /></a>
{% endif %}
{% endif %}
</div>
</div>
<div class="pledged-info"><div class="pledged-group">
{% if work.first_ebook %}
{% if wishers == 1 %}
1 Ungluer is
{% else %}
{{ wishers }} Ungluers are
{% endif %} enjoying this Work
{% else %}{% if status == 'ACTIVE' %}
{% if work.last_campaign.supporters.count == 1 %}
One Ungluer has
{% else %}
{{ work.last_campaign.supporters.count }} Ungluers have
{% endif %}
pledged ${{ work.last_campaign.current_total }}<br />toward a ${{ work.last_campaign.target }} goal
{% else %}
{% if wishers == 1 %}
1 Ungluer has
{% else %}
{{ wishers }} Ungluers have
{% endif %} wished for this Work
{% endif %}{% endif %}
</div>
<div class="status"><img src="/static/images/images/icon-book-37by25-{% if work.first_ebook %}6{%else%}{{ work.percent_unglued }}{%endif%}.png" title="book list status" alt="book list status" /></div>
</div>
<div class="btn_wishlist" id="wishlist_actions">
{% if request.user.is_anonymous %}
<div class="create-account">
<span title="{% url work work.id %}">Login to Add</span>
</div>
{% else %}{% if request.user.id in work.last_campaign.supporters %}
<div class="add-wishlist">
<span class="on-wishlist">Pledged!</span>
</div>
{% else %}{% if work in request.user.wishlist.works.all %}
<div class="remove-wishlist-workpage">
<span id="w{{ work.id }}">Remove This</span>
</div>
{% else %}
<div class="add-wishlist">
<span id="w{{ work.googlebooks_id }}">Add to Wishlist</span>
</div>
{% endif %}{% endif %}{% endif %}
</div>
</div>
</div>
{% get_comment_count for work as comment_count %}
<div class="content-block-heading" id="tabs">
<ul class="tabs">
<li class="tabs1 {% if activetab == '1' %}active{% endif %}"><a href="#">{% if status == 'ACTIVE' %}Campaign{% else %}Description{% endif %}</a></li>
<li class="tabs2 {% if activetab == '2' %}active{% endif %}"><a href="#">Comments {% if comment_count > 0 %}({{ comment_count }}){% endif %}</a></li>
<li class="tabs3 {% if activetab == '3' %}active{% endif %}" id="supporters"><a href="#">Ungluers {% if wishers > 0 %}({{ wishers }}){% endif %}</a></li>
<li class="tabs4 {% if activetab == '4' %}active{% endif %}"><a href="#">Rights</a></li>
</ul>
</div>
<div id="content-block-content">
<div id="tabs-1" class="tabs {% if activetab == '1' %}active{% endif %}">
<div class="tabs-content">
{% if status == 'ACTIVE' %}
<h3 class="tabcontent-title">A campaign is running to unglue <i>{{work.title}}</i>!</h3>
<p>The rights holder, {% for claim in work.claim.all %}
{% if claim.status == 'active' %}
{{ claim.rights_holder.rights_holder_name }}
{% endif %}
{% endfor %}
, has agreed to release <i>{{work.title}}</i> to the world as a Creative Commons licensed ebook ({{ work.last_campaign.license }}) if ungluers can join together to raise ${{ work.last_campaign.target }} by {{ work.last_campaign.deadline }}.
You can help!</p>
{{ work.last_campaign.description|safe }}
{% else %}
<h3 class="tabcontent-title">{{work.title}}</h3>
<p>{{ work.longest_description|safe }}
{% endif %}
</p>
</div>
</div>
<div id="tabs-2" class="tabs {% if activetab == '2' %}active{% endif %}">
<h3>Why unglue this? Have your say.</h3>
<div class="tabs-content">
{% render_comment_list for work %}
{% if user.is_authenticated %}
{% render_comment_form for work %}
{% else %}
<p>You must be <a href="{% url auth_login %}?next={{ request.path }}">logged in</a> to comment.</p>
{% endif %}
</div>
</div>
<div id="tabs-3" class="tabs {% if activetab == '3' %}active{% endif %}">
<div class="tabs-content">
{% for supporter in work.wished_by %}
<div class="work_supporter_nocomment">
<a href="/supporter/{{supporter}}">
<div class="work_supporter_avatar">
{% if supporter.profile.pic_url %}
<img class="user-avatar" src="{{ supporter.profile.pic_url }}" height="50" width="50" alt="Picture of {{ supporter }}" title="{{ supporter }}" />
{% else %}
<img class="user-avatar" src="/static/images/header/avatar.png" height="50" width="50" alt="Generic Ungluer Avatar" title="Ungluer" />
{% endif %}
</div>
<div class="work_supporter_name">{{ supporter }}</div>
</a>
</div>
{% endfor %}
</div>
</div>
<div id="tabs-4" class="tabs {% if activetab == '4' %}active{% endif %}">
<div class="tabs-content">
{% if status == 'ACTIVE' %}
<h4>Last campaign details</h4>
{{ work.last_campaign.details|safe }}
{% endif %}
<h4> Rights Information </h4>
{% if claimstatus == 'one_active' %}
<p>This work has been claimed by {{ rights_holder_name }}.</p>
{% else %}
{% if claimstatus == 'disputed' %}
<p>Rights claims are pending.</p>
{% else %}
{% if claimstatus == 'one_pending' %}
<p>A claim for this work by {{ rights_holder_name }} is pending.</p>
{% else %}
{% if request.user.rights_holder.all.count %}
Is this work yours? Claim it: <br /><br />
<form method="GET" action="{% url claim %}">
{% csrf_token %}
{{ claimform.user }}
{{ claimform.work }}
{{ claimform.rights_holder }}
<input type="submit" name="submit" value="Claim">
</form><br />
{% endif %}
{% endif %}
{% endif %}
{% endif %}
<p>If you'd like to contact us regarding rights for this work, please email <a href="mailto:rights@gluejar.com">rights@gluejar.com</a>.</p>
{% if work.subjects.all.count > 0 %}
<h4>Subjects</h4>
<ul>
{% for subject in work.subjects.all %}
<li>{{ subject.name }}</li>
{% endfor %}
</ul>
{% endif %}
<h4>Editions</h4>
{% if alert %}<div class="alert"><b>Ebook Contribution:</b><br />{{ alert }}</div>{% endif %}
{% for edition in editions %}
<div class="editions"><div class="image"><img src="{{ edition.cover_image_small }}" title="edition cover" alt="edition cover" /></div>
<div class="metadata" id="edition_{{edition.id}}">Publisher: {{edition.publisher}}<br />
Published: {{edition.publication_date}}<br />
{% with edition.isbn_13 as isbn %}
{% if isbn %}
ISBN: {{ isbn }}<br />
{% else %}
No ISBN available<br />
{% endif %}
{% endwith %}
See <a href="https://encrypted.google.com/books?id={{ edition.googlebooks_id }}">this edition on Google Books</a></div>
</div>{{work.last_campaign_status}}
{% if edition.ebook_form %}{% ifnotequal status 'ACTIVE' %}
{% if edition.hide_details %}<div class="show_more_edition" >more...</div>{% endif %}
<div {% if edition.hide_details %} class="more_edition" {% endif %}>
{% if edition.ebooks.count %}
<h5>eBooks for this Edition</h5>
{% for ebook in edition.ebooks.all %}
<a href="{{ebook.url}}">{{ ebook.format }}</a> {{ebook.rights}} at {{ebook.provider}}<br />
{% endfor %}
{% endif %}
<h5>Add an eBook for this Edition:</h5>
<span>If you know that this edition is available as a public domain or Creative Commons ebook, you can enter the link here and "unglue" it. Right now, we're only accepting URLs that point to Internet Archive, Wikisources, Hathitrust, Project Gutenberg, or Google Books.</span>
<form method="POST" action="#edition_{{edition.id}}">
{% csrf_token %}{{ edition.ebook_form.edition.errors }}{{ edition.ebook_form.edition }}{{ edition.ebook_form.user.errors }}{{ edition.ebook_form.user }}{{ edition.ebook_form.provider.errors }}{{ edition.ebook_form.provider }}
{{ edition.ebook_form.url.errors }}<span>URL: {{ edition.ebook_form.url }}</span><br />
{{ edition.ebook_form.format.errors }}<span>File Format: {{ edition.ebook_form.format }}</span>&nbsp;&nbsp;&nbsp;
{{ edition.ebook_form.rights.errors }}<span>License: {{ edition.ebook_form.rights }}</span><br />
<input type="submit" name="add_ebook" value="add ebook" />
</form>
</div>
{% endifnotequal %}{% endif %}
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</div>
<div id="js-rightcol">
<div class="js-rightcol-pad rounded">
<div class="jsmodule">
<h3 class="jsmod-title"><span>Share</span></h3>
<div class="jsmod-content">
<ul class="social menu">
<a href="https://www.facebook.com/sharer.php?u={{request.build_absolute_uri|urlencode:"" }}"><li class="facebook first"><span>Facebook</span></li></a>
<a href="https://twitter.com/intent/tweet?url={{request.build_absolute_uri|urlencode:"" }}&amp;text=I%27m%20ungluing%20{{ work.title|urlencode }}%20at%20%40unglueit.%20Join%20me%21"><li class="twitter"><span>Twitter</span></li></a>
{% if request.user.is_authenticated %}<a href="{% url emailshare %}?next={{request.build_absolute_uri|urlencode:""}}"><li class="email"><span>Email</span></li></a>{% endif %}
<a href="#" id="embed"><li class="embed"><span>Embed</span></li></a>
</ul>
<div id="widgetcode">Copy/paste this into your site:<br /><textarea rows="7" cols="22">&lt;iframe src="https://{{request.META.HTTP_HOST}}/api/widget/{{work.first_isbn_13}}/" width="152" height="325" frameborder="0"&gt;&lt;/iframe&gt;</textarea></div>
</div>
</div>
{% if status == 'ACTIVE' %}
<div class="jsmodule">
<h3 class="jsmod-title"><span>Support</span></h3>
<div class="jsmod-content">
<ul class="support menu">
{% for premium in premiums %}
{% if premium.limit == 0 or premium.limit > premium.premium_count %}
<li class="{% if forloop.first %}first{% else %}{% if forloop.last %}last{% endif %}{% endif %}">
<a href="{% url pledge work_id=work.id %}?premium_id={{premium.id}}">
<span class="menu-item-price">${{ premium.amount }}</span>
<span class="menu-item-desc">{{ premium.description }}</span>
{% ifnotequal premium.limit 0 %}<br /> Only {{ premium.premium_remaining }} remaining! {% endifnotequal %}
</a></li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
{% endif %}
</div>
</div>
</div>
</div>
{% endwith %}
{% endblock %}