merge in master
commit
bd9a746422
|
@ -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]
|
|
@ -13,9 +13,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
|
||||
|
@ -835,6 +837,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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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']])
|
|
@ -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>
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
<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 supporter_username=comment.user.username %}">
|
||||
<div class="work_supporter_avatar">
|
||||
{% if comment.user.profile.pic_url %}
|
||||
<img class="user-avatar" src="{{ comment.user.profile.pic_url }}" height="50" width="50" alt="Picture of {{ comment.user }}" title="{{ comment.user }}" />
|
||||
{% else %}
|
||||
<img class="user-avatar" src="/static/images/header/avatar.png" height="50" width="50" alt="Generic Ungluer Avatar" title="Ungluer" />
|
||||
<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 supporter_username=comment.user.username %}">
|
||||
<div class="work_supporter_avatar">
|
||||
{% if comment.user.profile.pic_url %}
|
||||
<img class="user-avatar" src="{{ comment.user.profile.pic_url }}" height="50" width="50" alt="Picture of {{ comment.user }}" title="{{ comment.user }}" />
|
||||
{% else %}
|
||||
<img class="user-avatar" src="/static/images/header/avatar.png" height="50" width="50" alt="Generic Ungluer Avatar" title="Ungluer" />
|
||||
{% endif %}
|
||||
</div>
|
||||
<span class="comment_username">{{comment.user.username }}</span></a> <span>({{ comment.submit_date }})</span> <br /><span class="comment">{{ comment.comment|linebreaksbr }}<br /></span>
|
||||
</div>
|
||||
<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>
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -96,7 +96,7 @@ 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">
|
||||
{% if supporter.profile.pic_url %}
|
||||
|
@ -105,7 +105,7 @@ there's no tab for seeing ALL my books, only the filters! huh.
|
|||
<img class="user-avatar" src="/static/images/header/avatar.png" height="50" width="50" alt="Generic Ungluer Avatar" title="Ungluer" />
|
||||
{% endif %}
|
||||
<span class="user-name">
|
||||
<a href="#">{{ supporter.username }}</a>
|
||||
<a href="#"><span itemprop="name">{{ supporter.username }}</span></a>
|
||||
</span>
|
||||
</div>
|
||||
<span class="user-badges">
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
</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">
|
||||
|
@ -64,20 +64,19 @@
|
|||
</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>
|
||||
<div>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% ifequal status 'ACTIVE' %}
|
||||
<div class="thermometer" title="{{ work.percent_of_goal }}% of goal">
|
||||
<div class="cover" style="width: {{ cover_width }}%;">
|
||||
|
@ -154,7 +153,7 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn_wishlist" id="wishlist_actions">
|
||||
{% if request.user.is_anonymous %}
|
||||
<div class="create-account">
|
||||
|
@ -190,12 +189,12 @@
|
|||
<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 }}
|
||||
<span itemprop="description">{{ work.last_campaign.description|safe }}</span>
|
||||
{% 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 %}">
|
||||
|
@ -245,8 +244,8 @@
|
|||
{% else %}
|
||||
{% for wish in work.wishes.all reversed %}
|
||||
{% with wish.wishlist.user as supporter %}
|
||||
<div class="work_supporter_nocomment">
|
||||
<a href="{% url supporter supporter_username=supporter.username %}">
|
||||
<div class="work_supporter_nocomment" itemscope itemtype="http://schema.org/Person">
|
||||
<a itemprop="url" href="{% url supporter supporter_username=supporter.username %}">
|
||||
<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 }}" />
|
||||
|
@ -315,19 +314,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>
|
||||
<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 %}
|
||||
|
@ -356,7 +352,7 @@
|
|||
Published: {{ edition.publication_date }}<br />
|
||||
{% endif %}
|
||||
{% if edition.isbn_13 %}
|
||||
ISBN: {{ edition.isbn_13 }}<br />
|
||||
ISBN: <spam 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 />
|
||||
|
|
|
@ -904,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"
|
||||
|
@ -2032,7 +2032,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:
|
||||
|
@ -2187,7 +2187,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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Django==1.4.2
|
||||
Django==1.4.5
|
||||
Fabric==1.4.3
|
||||
MySQL-python==1.2.3
|
||||
Pillow==1.7.7
|
||||
|
@ -26,7 +26,7 @@ git+git://github.com/aladagemre/django-notification.git@2927346f4c513a217ac8ad07
|
|||
django-registration==0.8
|
||||
django-selectable==0.5.2
|
||||
django-smtp-ssl==1.0
|
||||
django-social-auth==0.7.5
|
||||
django-social-auth==0.7.20
|
||||
django-storages==1.1.6
|
||||
django-tastypie==0.9.11
|
||||
feedparser==5.1.2
|
||||
|
|
|
@ -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',
|
||||
|
@ -209,6 +210,12 @@ AUTHENTICATION_BACKENDS = (
|
|||
SOCIAL_AUTH_ENABLED_BACKENDS = ['google', 'facebook', 'twitter']
|
||||
SOCIAL_AUTH_ASSOCIATE_BY_MAIL = True
|
||||
SOCIAL_AUTH_NEW_USER_REDIRECT_URL = '/'
|
||||
# following is needed because of length limitations in a unique constrain for MySQL
|
||||
# see https://github.com/omab/django-social-auth/issues/539
|
||||
SOCIAL_AUTH_UID_LENGTH = 222
|
||||
SOCIAL_AUTH_NONCE_SERVER_URL_LENGTH = 200
|
||||
SOCIAL_AUTH_ASSOCIATION_SERVER_URL_LENGTH = 135
|
||||
SOCIAL_AUTH_ASSOCIATION_HANDLE_LENGTH = 125
|
||||
|
||||
TWITTER_EXTRA_DATA = [('profile_image_url', 'profile_image_url')]
|
||||
|
||||
|
@ -216,7 +223,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
|
@ -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;
|
||||
|
|
11
urls.py
11
urls.py
|
@ -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}),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue