merge from master

pull/1/head
eric 2013-03-19 14:38:09 -04:00
commit 50ec6ddb06
28 changed files with 769 additions and 578 deletions

View File

@ -15,7 +15,7 @@ class SupporterWishlistFeed(Feed):
return "Latest wishbooks for %s on unglue.it" % obj.username
def link(self, obj):
return "/%s/feed/" % obj.username
return "/supporter/%s/feed/" % obj.username
def item_title(self, item):
return "%s" % item.title
@ -24,4 +24,4 @@ class SupporterWishlistFeed(Feed):
return "/work/%s" % item.id
def items(self, obj):
return obj.wishlist.works.all().order_by('-id')[:5]
return obj.wishlist.works.all().order_by('-id')[:100]

View File

@ -18,9 +18,11 @@ from django.db import models
from django.db.models import Q, get_model
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
import regluit
import regluit.core.isbn
from regluit.core.signals import successful_campaign, unsuccessful_campaign, wishlist_added
@ -534,9 +536,28 @@ class Campaign(models.Model):
@property
def success_date(self):
if self.status == 'SUCCESSFUL':
try:
return self.actions.filter(type='succeeded')[0].timestamp
except:
return ''
return ''
@property
def countdown(self):
from math import ceil
time_remaining = self.deadline - now()
countdown = ""
if time_remaining.days:
countdown = "%s days" % str(time_remaining.days + 1)
elif time_remaining.seconds > 3600:
countdown = "%s hours" % str(time_remaining.seconds/3600 + 1)
elif time_remaining.seconds > 60:
countdown = "%s minutes" % str(time_remaining.seconds/60 + 1)
else:
countdown = "Seconds"
return countdown
class Identifier(models.Model):
# olib, ltwk, goog, gdrd, thng, isbn, oclc, olwk, olib, gute, glue
@ -821,6 +842,9 @@ class Work(models.Model):
except:
return False
def get_absolute_url(self):
return reverse('work', args=[str(self.id)])
class Author(models.Model):
created = models.DateTimeField(auto_now_add=True)
name = models.CharField(max_length=500)

View File

@ -249,7 +249,7 @@ def handle_wishlist_added(supporter, work, **kwargs):
notification.send([claim[0].user], "new_wisher", {
'supporter': supporter,
'work': work,
'base_url': settings.BASE_URL,
'base_url': settings.BASE_URL_SECURE,
}, True)
from regluit.core.tasks import emit_notifications
@ -269,13 +269,13 @@ def handle_wishlist_near_deadline(campaign, **kwargs):
notification.send(pledgers, "wishlist_near_deadline", {
'campaign': campaign,
'domain': settings.BASE_URL,
'domain': settings.BASE_URL_SECURE,
'pledged': True,
}, True)
notification.send(nonpledgers, "wishlist_near_deadline", {
'campaign': campaign,
'domain': settings.BASE_URL,
'domain': settings.BASE_URL_SECURE,
'pledged': False,
}, True)

37
core/sitemaps.py Normal file
View File

@ -0,0 +1,37 @@
from django.contrib.sitemaps import Sitemap
from django.core.urlresolvers import reverse
from regluit.core.models import Work, Edition
class WorkSitemap(Sitemap):
protocol = 'https'
limit = 10000
def items(self):
return Work.objects.all()
def priority(self,work):
if work.last_campaign():
return '1.0'
if work.num_wishes>1000:
return '0.8'
if work.num_wishes>100:
return '0.6'
if work.num_wishes>10:
return '0.4'
if work.num_wishes>1:
return '0.3'
if work.num_wishes==1:
return '0.2'
if work.num_wishes==0:
return '0.1'
return '0.1'
class PublisherSitemap(Sitemap):
priority = 0.2
protocol = 'https'
def items(self):
return Edition.objects.exclude(publisher__isnull=True).exclude(publisher="").order_by('publisher').values('publisher').distinct()
def location(self, pub):
return reverse("bypub_list",args=[pub['publisher']])

View File

@ -2,7 +2,7 @@
{% block title %} Everything You Always Wanted to Know {% endblock %}
{% block doccontent %}
<h2>About</h2>
<p><a href="http://unglue.it">Unglue.it</a> is a service provided by <a href="http://gluejar.com">Gluejar, Inc.</a> It's a place for individuals and institutions to join together to liberate specific ebooks and other types of digital content by paying rights holders to relicense their works under <a href="http://creativecommons.org">Creative Commons</a> licenses.</p>
<p><a href="https://unglue.it">Unglue.it</a> is a service provided by <a href="http://gluejar.com">Gluejar, Inc.</a> It's a place for individuals and institutions to join together to liberate specific ebooks and other types of digital content by paying rights holders to relicense their works under <a href="http://creativecommons.org">Creative Commons</a> licenses.</p>
<p>What does this mean?</p>
<ul>

View File

@ -1,12 +1,16 @@
<div id="comments">
{% for comment in comment_list reversed %}
<div class="work_supporter {% if comment.content_object.last_campaign and comment.user in comment.content_object.last_campaign.managers.all %}official{% endif %}">
<a href="{% url supporter comment.user %}">
<div class="work_supporter_avatar">
<div itemprop="comment" itemscope itemtype="http://schema.org/UserComments" class="work_supporter {% if comment.content_object.last_campaign and comment.user in comment.content_object.last_campaign.managers.all %}official{% endif %}">
<span itemprop="creator" itemscope itemtype="http://schema.org/Person">
<a itemprop="url" href="{% url supporter comment.user %}">
<span class="work_supporter_avatar">
<img class="user-avatar" src="{{ comment.user.profile.avatar_url }}" height="50" width="50" alt="Avatar for {{ comment.user }}" title="{{ comment.user }}" />
</div>
<span class="comment_username">{{comment.user.username }}</span></a> <span>({{ comment.submit_date }})</span> <br /><span class="comment">{{ comment.comment|linebreaksbr }}<br /></span>
</span>
<span class="comment_username">{{comment.user.username }}</span>
</a>
</span>
<span itemprop="commentTime">({{ comment.submit_date }})</span> <br /><span class="comment" itemProp="commentText">{{ comment.comment|linebreaksbr }}<br /></span>
</div>
{% endfor %}
</div>

View File

@ -21,10 +21,13 @@
<h1>{% trans "Preview your comment" %}</h1>
<div class="work_supporter {% if content_object.last_campaign and user in content_object.last_campaign.managers.all %}official{% endif %}">
<a href="{% url supporter user %}">
<div class="work_supporter_avatar">
<span class="work_supporter_avatar">
<img class="user-avatar" src="{{ user.profile.avatar_url }}" height="50" width="50" alt="Avatar for {{ user }}" title="{{ user }}" />
</div>
<span class="comment_username">{{user.username }}</span></a> <span>( [today's date] )</span> <br /><span class="comment">{{ comment|linebreaksbr }}<br /></span>
</span>
<span class="comment_username">{{user.username }}</span>
</a>
<span>( [today's date] )</span> <br />
<span class="comment">{{ comment|linebreaksbr }}<br /></span>
</div>
<br /><br /><br />
<p>

View File

@ -140,7 +140,7 @@ $j(document).ready(function() {
</div>
<div class="form-row clearfix cvc">
<label>CVC:</label>
<input id="card_CVC" type="text" size="4" autocomplete="off" class="card-cvc" /> <span id="cvc_help">(what is this?)</span>
<input id="card_CVC" type="password" size="4" autocomplete="off" class="card-cvc" /> <span id="cvc_help">(what is this?)</span>
<div id="cvc_answer"><img src="/static/images/cvcimage.jpeg" alt="a typical credit card with CVC">For most cards, this is a 3-digit number at the end of the signature strip on the back. For American Express, it's a four-digit number in small print on the front.</div>
</div>
<div class="form-row clearfix initial_values">

View File

@ -32,19 +32,29 @@
</div>
</div>
<div class="jsmodule rounded pledge">
<div class="jsmod-content">
${{ work.last_campaign.target|floatformat:0|intcomma }} needed by<br />
{{ work.last_campaign.deadline }}
<div>
<div class="thermometer">
<div class="cover" style="width: {{ cover_width }}%;">
</div>
<span>{{ work.percent_of_goal }}% of goal</span>
</div>
<div class="pledged-info">
<div class="pledged-group">
{{ work.last_campaign.supporters_count }} Ungluers have pledged ${{ work.last_campaign.current_total|intcomma }}
<div class="pledged-info noborder">
<div class="campaign-status-info">
<span>${{ work.last_campaign.current_total|floatformat:0|intcomma }}</span> pledged
</div>
<div class="campaign-status-info">
<span>${{ work.last_campaign.target|floatformat:0|intcomma }}</span> goal
</div>
<div class="campaign-status-info">
{% if work.last_campaign.supporters_count == 1 %}
<span>1</span> ungluer
{% else %}
<span> {{ work.last_campaign.supporters_count }}</span> ungluers
{% endif %}
</div>
<div class="campaign-status-info">
<span>{{ work.last_campaign.countdown }}</span> to go
</div>
<div class="status">
<img src="/static/images/images/icon-book-37by25-{{ work.percent_unglued }}.png" title="book list status" alt="book list status" />
</div>
</div>
</div>

View File

@ -52,6 +52,8 @@ function stripeResponseHandler(status, response) {
if (response.error) {
// re-enable the submit button
$j('.submit-button').removeAttr("disabled");
// stop the spinny thing
$j('.submit-button').removeClass("show-loading");
// show the errors on the form
$j(".payment-errors").html(response.error.message).show();
} else {

View File

@ -96,12 +96,12 @@ there's no tab for seeing ALL my books, only the filters! huh.
<div class="js-topnews1">
<div class="js-topnews2">
<div class="js-topnews3">
<div class="user-block">
<div class="user-block" itemscope itemtype="http://schema.org/Person">
<div id="user-block1">
<div class="block-inner">
<img class="user-avatar" src="{{ supporter.profile.avatar_url }}" height="50" width="50" alt="Avatar for {{ supporter }}" title="Avatar" />
<span class="user-name">
<a href="#">{{ supporter.username }}</a>
<a href="#"><span itemprop="name">{{ supporter.username }}</span></a>
</span>
</div>
<span class="user-badges">

View File

@ -51,106 +51,89 @@
<div id="main-container">
<div class="js-main">
<div id="js-leftcol">
<div class="jsmodule rounded">
<div class="jsmod-content {{ status }}">
{% if work.first_ebook %}
AVAILABLE! <br />
{% if wishers == 1 %}
1 Ungluer is
{% else %}
{{ wishers }} Ungluers are
{% endif %} enjoying this book
{% else %}{% if work.last_campaign %}
{% if status == 'ACTIVE' %}
Unglue it! <br />
${{ work.last_campaign.current_total|floatformat:0|intcomma }}/${{ work.last_campaign.target|floatformat:0|intcomma }} <br />
Ending {{ countdown }}
{% else %}
{% if status == 'SUCCESSFUL' %}
Unglued on {{ work.last_campaign.success_date|date:"M j, Y"}}! <br />
${{ work.last_campaign.current_total|floatformat:0|intcomma }} raised of ${{ work.last_campaign.target|floatformat:0|intcomma }} goal<br />
Ebook in progress
{% 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 == 0 %}
<span class="findtheungluers">No ungluers are wishing yet.</span>
<br />
Be the first!
{% else %}{% if wishers == 1 %}
<span class="findtheungluers">{{ wishers }} Ungluer is wishing</span>
<br />
You can too!
{% else %}
<span class="findtheungluers">{{ wishers }} Ungluers are wishing</span>
<br />
You can too!
{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}
{% endif %}
{% else %}
{% if wishers == 0 %}
<span class="findtheungluers">
No ungluers are wishing yet.
</span>
<br />
Be the first!
{% else %}{% if wishers == 1 %}
<span class="findtheungluers">
{{ wishers }} Ungluer is wishing
</span>
<br />
You can too!
{% else %}
<span class="findtheungluers">
{{ wishers }} Ungluers are wishing
</span>
<br />
You can too!
{% endif %}{% endif %}
{% endif %}{% endif %}
</div>
</div>
{% include "explore.html" %}
</div>
<div id="js-maincol">
<div class="js-maincol-inner">
<div id="content-block">
<div id="content-block" itemscope itemtype="http://schema.org/Book">
<div class="book-detail">
{% if work.googlebooks_id %}
<div id="book-detail-img"><a href="{{ work.googlebooks_url }}">
<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>
{% else %}
<div id="book-detail-img">
<img src="{% if work.cover_image_thumbnail %}{{ work.cover_image_thumbnail }}{% else %}/static/images/generic_cover_larger.png{% endif %}" alt="{{ work.title }}" title="{{ work.title }}" width="131" height="192" />
<img itemprop="image" src="{% if work.cover_image_thumbnail %}{{ work.cover_image_thumbnail }}{% else %}/static/images/generic_cover_larger.png{% endif %}" alt="{{ work.title }}" title="{{ work.title }}" width="131" height="192" />
</div>
{% endif %}
<div class="book-detail-info">
<div class="layout">
<h2 class="book-name">{{ work.title }}</h2>
<h2 class="book-name" itemprop="name">{{ work.title }}</h2>
<div>
<div class="pubinfo">
<h3 class="book-author">{{ work.author }}</h3>
<h3 class="book-year">{{ work.publication_date_year }}</h3>
<h3 class="book-author" itemprop="author">{{ work.author }}</h3>
<h3 class="book-year" itemprop="datePublished">{{ work.publication_date_year }}</h3>
</div>
{% if status == 'ACTIVE' %}
{% if pledged %}
<div class="btn_support modify"><form action="{% url pledge_modify work_id %}" method="get"><input type="submit" value="Modify Pledge" /></form></div>
</div>
</div>
{% ifequal status 'ACTIVE' %}
<div class="thermometer" title="{{ work.percent_of_goal }}% of goal">
<div class="cover" style="width: {{ cover_width }}%;">
</div>
<span>{{ work.percent_of_goal }}% of goal</span>
</div>
<div class="pledged-info noborder">
<div class="campaign-status-info">
<span>${{ work.last_campaign.current_total|floatformat:0|intcomma }}</span> pledged
</div>
<div class="campaign-status-info">
<span>${{ work.last_campaign.target|floatformat:0|intcomma }}</span> goal
</div>
<div class="campaign-status-info">
{% if work.last_campaign.supporters_count == 1 %}
<span>1</span> ungluer
{% else %}
<div class="btn_support"><form action="{% url pledge work_id %}" method="get"><input type="submit" value="Pledge" /></form></div>
<span>{{ work.last_campaign.supporters_count }}</span> ungluers
{% endif %}
</div>
<div class="campaign-status-info">
<span>{{ work.last_campaign.countdown }}</span> to go
</div>
</div>
{% else %}
{% if work.first_ebook %}
<div class="btn_support">
<a href="{% url download work_id %}" class="fakeinput hijax">Download</a>
{% ifequal status 'SUCCESSFUL' %}
<div class="thermometer successful">
This campaign succeeded on {{ work.last_campaign.success_date|date:"M j, Y" }}.
</div>
{% endif %}
<div class="pledged-info noborder">
<div class="campaign-status-info">
{% if work.last_campaign.supporters_count == 1 %}
<span>1</span> ungluer
{% else %}
<span>{{ work.last_campaign.supporters_count }}</span> ungluers
{% endif %}
</div>
<div class="campaign-status-info">
<span>${{ work.last_campaign.current_total|floatformat:0|intcomma }}</span> pledged
</div>
<div class="campaign-status-info">
<span>${{ work.last_campaign.target|floatformat:0|intcomma }}</span> goal
</div>
<div class="campaign-status-info">
<span>Unglued!</span>
</div>
</div>
{% endifequal %}
<div class="pledged-info">
{% if wishers == 1 %}
1 Ungluer has
{% else %}
{{ wishers }} Ungluers have
{% endif %} wished for this Work
</div>
{% endifequal %}
<div class="find-book">
<label>Learn more at...</label>
<div class="find-link">
@ -171,26 +154,6 @@
{% endif %}
</div>
</div>
{% if not work.first_ebook %}
<div class="pledged-info"><div class="pledged-group">
{% 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|floatformat:0|intcomma }}<br />toward a ${{ work.last_campaign.target|floatformat:0|intcomma }} goal
{% else %}
{% if wishers == 1 %}
1 Ungluer has
{% else %}
{{ wishers }} Ungluers have
{% endif %} wished for this Work
{% endif %}
</div>
<div class="status">{% if status == 'ACTIVE' %}{{ work.percent_of_goal }}%&nbsp;{% endif %}<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>
{% endif %}
<div class="btn_wishlist" id="wishlist_actions">
{% if request.user.is_anonymous %}
<div class="create-account">
@ -220,19 +183,18 @@
<li class="tabs3 {% if activetab == '3' %}active{% endif %}" id="supporters"><a href="#">Ungluers {% if wishers > 0 %}<br />({{ 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' or status == 'SUCCESSFUL' %}
{{ work.last_campaign.description|safe }}
<div itemprop="description">{{ work.last_campaign.description|safe }}</div>
{% else %}
<h3 class="tabcontent-title">{{work.title}}</h3>
<p>{{ work.description|safe }}
{% endif %}
<p itemprop="description">{{ work.description|safe }}
</p>
{% endif %}
</div>
</div>
<div id="tabs-2" class="tabs {% if activetab == '2' %}active{% endif %}">
@ -256,9 +218,9 @@
{% with wish.wishlist.user as supporter %}
<div class="work_supporter_wide">
<a href="{% url supporter supporter %}">
<div class="work_supporter_avatar">
<span class="work_supporter_avatar">
<img class="user-avatar" src="{{ supporter.profile.avatar_url }}" height="50" width="50" alt="Avatar for {{ supporter }}" title="{{ supporter }}" />
</div>
</span>
</a>
<div class="show_supporter_contact_form" >
<img src="/static/images/icons/email.png" title="contact supporter" />
@ -278,12 +240,12 @@
{% else %}
{% for wish in work.wishes.all reversed %}
{% with wish.wishlist.user as supporter %}
<div class="work_supporter_nocomment">
<a href="{% url supporter supporter %}">
<div class="work_supporter_avatar">
<div class="work_supporter_nocomment" itemscope itemtype="http://schema.org/Person">
<a itemprop="url" href="{% url supporter supporter %}">
<span class="work_supporter_avatar">
<img class="user-avatar" src="{{ supporter.profile.avatar_url }}" height="50" width="50" alt="Avatar for {{ supporter }}" title="{{ supporter }}" />
</div>
<div class="work_supporter_name">{{ supporter }}</div>
</span>
<span class="work_supporter_name">{{ supporter }}</span>
</a>
</div>
{% endwith %}
@ -344,17 +306,16 @@
{% 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 user.is_staff %}<h4>Related Works</h4>
{% if user.is_staff %}
<h4>Related Works</h4>
<a href="{% url merge work_id %}">Merge other works into this one</a><br />
{% endif %}
{% if work.subjects.all.count > 0 %}
<h4>Subjects</h4>
<ul>
{% for subject in work.subjects.all %}
<li>{{ subject.name }}</li>
<li itemprop="keywords">{{ subject.name }}</li>
{% endfor %}
</ul>
{% endif %}
@ -364,7 +325,9 @@
<div><a href="{% url new_edition work_id edition.id %}">Create a new edition for this work</a><br /><br /></div>
{% endif %}
{% if alert %}<div class="alert"><b>Ebook Contribution:</b><br />{{ alert }}</div>{% endif %}
{% if alert %}
<div class="alert"><b>Ebook Contribution:</b><br />{{ alert }}</div>
{% endif %}
{% for edition in editions %}
<div class="clearfix">
<div class="editions">
@ -373,10 +336,15 @@
<img src="{{ edition.cover_image_small }}" title="edition cover" alt="edition cover" />
</div>
{% endif %}
<div class="metadata" id="edition_{{edition.id}}">{% if edition.publisher %}Publisher: <a href="{% url bypub_list edition.publisher %}">{{edition.publisher}}</a><br />{% endif %}
{% if edition.publication_date %}Published: {{edition.publication_date}}<br />{% endif %}
<div class="metadata" id="edition_{{edition.id}}">
{% if edition.publisher %}
Publisher: <a href="{% url bypub_list edition.publisher %}">{{edition.publisher}}</a><br />
{% endif %}
{% if edition.publication_date %}
Published: {{ edition.publication_date }}<br />
{% endif %}
{% if edition.isbn_13 %}
ISBN: {{ edition.isbn_13 }}<br />
ISBN: <span itemprop="isbn">{{ edition.isbn_13 }}</span><br />
{% endif %}
{% if edition.oclc %}
OCLC: <a href="http://www.worldcat.org/oclc/{{ edition.oclc }}">{{ edition.oclc }}</a><br />
@ -389,9 +357,12 @@
{% endif %}
</div>
</div>
{% if edition.ebook_form %}{% ifnotequal status 'ACTIVE' %}
{% if edition.ebook_form %}
{% ifnotequal status 'ACTIVE' %}
{% if edition.hide_details %}
<div class="show_more_edition" >more...</div>
<div class="show_more_edition" >
more...
</div>
{% endif %}
<div {% if edition.hide_details %} class="more_edition" {% endif %}>
{% if edition.ebooks.count %}
@ -400,8 +371,11 @@
<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 />
@ -410,7 +384,8 @@
<input type="submit" name="add_ebook" value="add ebook" />
</form>
</div>
{% endifnotequal %}{% endif %}
{% endifnotequal %}
{% endif %}
</div>
{% endfor %}
</div>
@ -420,8 +395,23 @@
</div>
</div>
<div id="js-rightcol">
<div class="clearfix">
{% if status == 'ACTIVE' %}
{% if pledged %}
<div class="btn_support modify"><form action="{% url pledge_modify work_id %}" method="get"><input type="submit" value="Modify Pledge" /></form></div>
{% else %}
<div class="btn_support"><form action="{% url pledge work_id %}" method="get"><input type="submit" value="Pledge" /></form></div>
{% endif %}
{% else %}
{% if work.first_ebook %}
<div class="btn_support">
<a href="{% url download work_id %}" class="hijax"><span>Download</span></a>
</div>
{% endif %}
{% endif %}
</div>
<br />
<div class="js-rightcol-pad rounded">
<div class="jsmodule">
<h3 class="jsmod-title"><span>Share</span></h3>
<div class="jsmod-content">
@ -439,7 +429,8 @@
{% 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 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' %}

View File

@ -116,6 +116,14 @@ def safe_get_work(work_id):
raise Http404
return work
def cover_width(work):
if work.percent_of_goal() < 100:
cover_width = 100 - work.percent_of_goal()
else:
cover_width = 0
return cover_width
def home(request, landing=False):
if request.user.is_authenticated() and landing == False:
return HttpResponseRedirect(reverse('supporter',
@ -161,7 +169,8 @@ def work(request, work_id, action='display'):
except:
pledged = None
countdown = ""
logger.info("pledged: {0}".format(pledged))
cover_width_number = 0
try:
assert not (work.last_campaign_status() == 'ACTIVE' and work.first_ebook())
@ -169,25 +178,7 @@ def work(request, work_id, action='display'):
logger.warning("Campaign running for %s when ebooks are already available: why?" % work.title )
if work.last_campaign_status() == 'ACTIVE':
from math import ceil
time_remaining = campaign.deadline - now()
'''
we want to round up on all of these; if it's the 3rd and the
campaign ends the 8th, users expect to see 5 days remaining,
not 4 (as an artifact of 4 days 11 hours or whatever)
time_remaining.whatever is an int, so just adding 1 will do
that for us (except in the case where .days exists and both other
fields are 0, which is unlikely enough I'm not defending against it)
'''
if time_remaining.days:
countdown = "in %s days" % str(time_remaining.days + 1)
elif time_remaining.seconds > 3600:
countdown = "in %s hours" % str(time_remaining.seconds/3600 + 1)
elif time_remaining.seconds > 60:
countdown = "in %s minutes" % str(time_remaining.seconds/60 + 1)
else:
countdown = "right now"
cover_width_number = cover_width(work)
if action == 'preview':
work.last_campaign_status = 'ACTIVE'
@ -250,7 +241,7 @@ def work(request, work_id, action='display'):
'alert': alert,
'claimstatus': claimstatus,
'rights_holder_name': rights_holder_name,
'countdown': countdown,
'cover_width': cover_width_number
})
def new_edition(request, work_id, edition_id, by=None):
@ -763,6 +754,7 @@ class PledgeView(FormView):
'faqmenu': 'modify' if self.transaction else 'pledge',
'transaction': self.transaction,
'tid': self.transaction.id if self.transaction else None,
'cover_width': cover_width(self.work)
})
return context
@ -912,7 +904,7 @@ class NonprofitCampaign(FormView):
forward['amount']= int(amount)
forward['sent']= Sent.objects.create(user=username,amount=form.cleaned_data['preapproval_amount']).pk
token=signing.dumps(forward)
return HttpResponseRedirect(settings.BASE_URL + reverse('donation_credit',kwargs={'token':token}))
return HttpResponseRedirect(settings.BASE_URL_SECURE + reverse('donation_credit',kwargs={'token':token}))
class DonationCredit(TemplateView):
template_name="donation_credit.html"
@ -2044,7 +2036,7 @@ def emailshare(request, action):
next = form.cleaned_data['next']
except:
# if we totally failed to have a next value, we should still redirect somewhere useful
next = 'http://unglue.it'
next = 'https://unglue.it'
return HttpResponseRedirect(next)
else:
@ -2199,7 +2191,7 @@ def download(request, work_id):
'unglued_ebooks': unglued_ebooks,
'other_ebooks': other_ebooks,
'readmill_epub_url': readmill_epub_url,
'base_url': settings.BASE_URL
'base_url': settings.BASE_URL_SECURE
})
return render(request, "download.html", context)

View File

@ -565,7 +565,7 @@ class PaymentManager( object ):
if return_url is None:
return_path = "{0}?{1}".format(reverse('pledge_complete'),
urllib.urlencode({'tid':transaction.id}))
return_url = urlparse.urljoin(settings.BASE_URL, return_path)
return_url = urlparse.urljoin(settings.BASE_URL_SECURE, return_path)
p = transaction.get_payment_class().Preapproval(transaction, transaction.max_amount, expiry, return_url=return_url, paymentReason=paymentReason)
@ -657,7 +657,7 @@ class PaymentManager( object ):
credit.pledge_transaction(t,user,amount)
return_path = "{0}?{1}".format(reverse('pledge_complete'),
urllib.urlencode({'tid':t.id}))
return_url = urlparse.urljoin(settings.BASE_URL, return_path)
return_url = urlparse.urljoin(settings.BASE_URL_SECURE, return_path)
pledge_created.send(sender=self, transaction=t)
return t, return_url
else:
@ -762,7 +762,7 @@ class PaymentManager( object ):
credit.pledge_transaction(transaction,transaction.user,amount)
return_path = "{0}?{1}".format(reverse('pledge_complete'),
urllib.urlencode({'tid':transaction.id}))
return_url = urlparse.urljoin(settings.BASE_URL, return_path)
return_url = urlparse.urljoin(settings.BASE_URL_SECURE, return_path)
logger.info("Updated amount of transaction to %f" % amount)
pledge_modified.send(sender=self, transaction=transaction,up_or_down=up_or_down)

View File

@ -119,6 +119,7 @@ INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.sitemaps',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.comments',
@ -234,7 +235,7 @@ LOGIN_URL = "/accounts/login/"
LOGIN_REDIRECT_URL = "/"
LOGOUT_URL = "/accounts/logout/"
USER_AGENT = "unglue.it.bot v0.0.1 <http://unglue.it>"
USER_AGENT = "unglue.it.bot v0.0.1 <https://unglue.it>"
SOUTH_TESTS_MIGRATE = True

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -59,36 +59,16 @@
width: auto;
padding-bottom: 7px;
}
div.btn_support {
float: right;
margin-top: 9px;
input {
font-size: @font-size-larger;
}
&.modify input {
background:@blue-grey;
font-size: @font-size-default;
border: double white;
line-height: 17px;
}
}
}
.btn_wishlist span {
text-align: right;
}
.find-book {
margin-top:15px;
label {
.find-book label {
float:left;
line-height:31px;
}
}
.find-link {
float:right;
@ -100,13 +80,80 @@
}
.pledged-info {
padding:0;
padding:10px 0;
position: relative;
&.noborder {
border-top: none;
padding-top: 0;
}
.pledged-group {
padding:10px 40px 10px 0;
.campaign-status-info {
float: left;
width: 50%;
margin-top: @font-size-default;
span {
font-size: @font-size-larger;
color: @medium-blue;
font-weight: bold;
}
}
}
.thermometer {
.one-border-radius(10px);
border: solid 2px @blue-grey;
width: 291px;
padding: 7px;
position: relative;
overflow: visible;
/* looks better if we start the gradient a little closer to the success color */
@greener-than-alert: #CF6944;
background: -webkit-gradient(linear, left top, right top, from(@call-to-action), to(@greener-than-alert));
background: -webkit-linear-gradient(left, @greener-than-alert, @call-to-action);
background: -moz-linear-gradient(left, @greener-than-alert, @call-to-action);
background: -ms-linear-gradient(left, @greener-than-alert, @call-to-action);
background: -o-linear-gradient(left, @greener-than-alert, @call-to-action);
background: linear-gradient(left, @greener-than-alert, @call-to-action);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='@alert', endColorstr='@call-to-action'); /* IE6 & IE7 */
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='@alert', endColorstr='@call-to-action')"; /* IE8+ */
&.successful {
border-color: @bright-blue;
background: @pale-blue;
}
.cover {
position: absolute;
right: 0;
.border-radius(0, 10px, 10px, 0);
width: 50px;
height: 14px;
margin-top: -7px;
background: lighten(@blue-grey, 10%);
}
span {
display: none;
}
&:hover span {
display: block;
position: absolute;
z-index: 200;
right: 0;
top:-7px;
font-size: @font-size-header;
color: @medium-blue;
background: white;
border: 2px solid @blue-grey;
.one-border-radius(10px);
padding: 5px;
}
}
.status {

View File

@ -298,6 +298,18 @@ div#content-block-content {
}
/* Right column */
/* Right - add/remove actions below big green button */
#js-rightcol {
.add-wishlist, .on-wishlist, .create-account {
float: none;
}
.on-wishlist {
margin-left: 20px;
}
}
#js-rightcol, #pledge-rightcol {
float:right;
width:235px;
@ -347,6 +359,57 @@ div#content-block-content {
padding:10px;
}
.btn_support {
margin: 10px;
width: 215px;
a, form input, > span {
font-size: @font-size-shout;
border: 4px solid @blue-grey;
.one-border-radius(10px);
display: block;
text-align: center;
padding-top: @font-size-header*.75;
padding-bottom: @font-size-header*.75;
background-color: @call-to-action;
span {
color: white !important;
font-weight: bold;
padding-left: 0;
margin-left: 0 !important;
background: none;
}
}
&.create-account span {
padding: 0;
margin: 0;
background: none;
}
a:hover, form input:hover {
background-color: darken(@call-to-action, 7%);
text-decoration: none;
}
a {
width: 207px;
}
form input {
width: 215px;
}
&.modify a, &.modify form input {
background-color: @medium-blue-grey;
&:hover {
background-color: darken(@medium-blue-grey, 7%);
}
}
}
/* Right column - support tiers */
ul.support li {
border-bottom:1px solid @blue-grey;

View File

@ -201,7 +201,7 @@ span.menu-item-price {
padding: 10px;
div.innards {
input[type="text"] {
input[type="text"],input[type="password"] {
font-size: @font-size-larger;
line-height: @font-size-larger*1.5;
border-width: 2px;

View File

@ -28,6 +28,11 @@
border-color: @blue-grey;
font-size: @font-size-default;
}
&.alert {
border-color: @alert;
font-size: @font-size-default;
}
}
.preview_content {

View File

@ -19,6 +19,7 @@
@font-size-default: 13px;
@font-size-larger: 15px;
@font-size-header: 19px;
@font-size-shout: 22px;
@link-color: #6994a3;
.header-text {

11
urls.py
View File

@ -3,6 +3,12 @@ from frontend.forms import ProfileForm
from django.views.generic.simple import direct_to_template
from regluit.admin import admin_site
import notification.urls
from regluit.core.sitemaps import WorkSitemap, PublisherSitemap
sitemaps = {
'works': WorkSitemap,
'publishers': PublisherSitemap,
}
urlpatterns = patterns('',
url(r'^accounts/activate/complete/$','django.contrib.auth.views.login',
@ -23,3 +29,8 @@ urlpatterns = patterns('',
(r'^notification/', include(notification.urls)),
(r'^ckeditor/', include('ckeditor.urls')),
)
urlpatterns += patterns('django.contrib.sitemaps.views',
(r'^sitemap\.xml$', 'index', {'sitemaps': sitemaps}),
(r'^sitemap-(?P<section>.+)\.xml$', 'sitemap', {'sitemaps': sitemaps}),
)