Merge branch 'master' of github.com:Gluejar/regluit into s3_storage
commit
3b92187315
|
@ -206,7 +206,7 @@ class Campaign(models.Model):
|
|||
target = models.DecimalField(max_digits=14, decimal_places=2, null=True, blank=False)
|
||||
license = models.CharField(max_length=255, choices = LICENSE_CHOICES, default='CC BY-NC-ND')
|
||||
left = models.DecimalField(max_digits=14, decimal_places=2, null=True, blank=False)
|
||||
deadline = models.DateTimeField()
|
||||
deadline = models.DateTimeField(db_index=True)
|
||||
activated = models.DateTimeField(null=True)
|
||||
paypal_receiver = models.CharField(max_length=100, blank=True)
|
||||
amazon_receiver = models.CharField(max_length=100, blank=True)
|
||||
|
@ -565,7 +565,7 @@ class Work(models.Model):
|
|||
title = models.CharField(max_length=1000)
|
||||
language = models.CharField(max_length=2, default="en", null=False)
|
||||
openlibrary_lookup = models.DateTimeField(null=True)
|
||||
num_wishes = models.IntegerField(default=0)
|
||||
num_wishes = models.IntegerField(default=0, db_index=True)
|
||||
description = models.TextField(default='', null=True)
|
||||
|
||||
class Meta:
|
||||
|
@ -924,7 +924,7 @@ class Ebook(models.Model):
|
|||
provider = models.CharField(max_length=255)
|
||||
|
||||
# use 'PD-US', 'CC BY', 'CC BY-NC-SA', 'CC BY-NC-ND', 'CC BY-NC', 'CC BY-ND', 'CC BY-SA', 'CC0'
|
||||
rights = models.CharField(max_length=255, null=True, choices = RIGHTS_CHOICES)
|
||||
rights = models.CharField(max_length=255, null=True, choices = RIGHTS_CHOICES, db_index=True)
|
||||
edition = models.ForeignKey('Edition', related_name='ebooks')
|
||||
user = models.ForeignKey(User, null=True)
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<p>Ungluing campaigns guarantee you income when campaigns succeed, without risk to you if they don't. Whether campaigns succeed or fail, they're a tool for you to reach out to, discover, interact with, and increase your audience while raising the profile of your work. Successful campaigns mean wider distribution of your book -- our <a href="https://unglue.it/work/81834/">first unglued ebook</a> reached #3 most-downloaded in Amazon's Kindle eBooks > Nonfiction > Social Sciences category. Your unglued book, in turn, becomes an ambassador for the rest of your work.</p>
|
||||
|
||||
<p>Rest assured that, when you unglue a book, you retain the copyright. You can choose whichever <a href="http://creativecommons.org/licenses/">Creative Commons license</a> serves your interests best, whether that's inviting your fans to remix your work or sharing it widely while reserving certain rights. You're still welcome to sell your book under the terms of your Smashwords agreement, and to separately license other editions. Ungluing isn't instead of your book's other opportunities -- it's in addition to them.</p>
|
||||
<p>Rest assured that, when you unglue a book, you retain the copyright. You can choose whichever <a href="http://creativecommons.org/licenses/">Creative Commons license</a> serves your interests best, whether that's inviting your fans to remix your work or sharing it widely while reserving certain rights. Once a book is unglued, you should set the price to zero in the Smashwords admin so as to honor the intentions of your supporters. We encourage you to develop enhanced digital editions to sell alongside the Creative Commons Licensed edition and print versions for sale. </p>
|
||||
|
||||
<h2>The Fine Print</h2>
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
{% url landing as landingurl %}
|
||||
{% url new_edition '' '' as editionurl %}
|
||||
{% url libraries as librariesurl %}
|
||||
{% url about_specific 'main' as aboutmainurl %}
|
||||
{% load truncatechars %}
|
||||
|
||||
<html>
|
||||
|
@ -153,7 +154,7 @@
|
|||
<div class="column">
|
||||
<span>About Unglue.it</span>
|
||||
<ul>
|
||||
<li><a href="/about/main/" class="hijax">Concept</a></li>
|
||||
<li><a href="{{ aboutmainurl }}" class="hijax">Concept</a></li>
|
||||
<li><a href="{{ abouturl }}">Team</a></li>
|
||||
<li><a href="http://blog.unglue.it">Blog</a></li>
|
||||
<li><a href="{{ pressurl }}">Press</a></li>
|
||||
|
@ -179,7 +180,7 @@
|
|||
<span>Help</span>
|
||||
<ul>
|
||||
<li><a href="{{ faqurl }}">General FAQ</a></li>
|
||||
<li><a href="/faq/rightsholders/">Rights Holder FAQ</a></li>
|
||||
<li><a href="{% url faq_location 'rightsholders' %}">Rights Holder FAQ</a></li>
|
||||
<li><a href="{% url api_help %}">API</a></li>
|
||||
<li><a href="mailto:support@gluejar.com">support@gluejar.com</a>
|
||||
<li><a href="{{ librariesurl }}">Unglue.it ♥ Libraries</a>
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
</div>
|
||||
{% else %}{% ifequal supporter request.user %}
|
||||
<div class="moreinfo remove-wishlist">
|
||||
<span id="p{{ workid }}">Remove This</span>
|
||||
<span id="p{{ workid }}">Un-wishlist</span>
|
||||
</div>
|
||||
{% else %}{% if work in wishlist %}
|
||||
<div class="moreinfo on-wishlist">
|
||||
|
|
|
@ -8,41 +8,42 @@
|
|||
</li>
|
||||
|
||||
<li class="parent {% if location != 'basics' %}collapse{% endif %}">
|
||||
<a href="/faq/basics/"><span>Basics</span></a>
|
||||
<a href="{% url faq_location 'basics' %}"><span>Basics</span></a>
|
||||
<ul class="menu level2">
|
||||
<li class="first"><a href="/faq/basics/howitworks"><span>How it Works</span></a></li>
|
||||
<li><a href="/faq/basics/account"><span>Your Account</span></a></li>
|
||||
<li class="last"><a href="/faq/basics/company/"><span>The Company</span></a></li>
|
||||
<li class="first"><a href="{% url faq_sublocation 'basics' 'howitworks' %}"><span>How it Works</span></a></li>
|
||||
<li><a href="{% url faq_sublocation 'basics' 'account' %}"><span>Your Account</span></a></li>
|
||||
<li class="last"><a href="{% url faq_sublocation 'basics' 'company' %}"><span>The Company</span></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="parent {% if location != 'campaigns' %}collapse{% endif %}">
|
||||
<a href="/faq/campaigns/"><span>Campaigns</span></a>
|
||||
<a href="{% url faq_location 'campaigns' %}"><span>Campaigns</span></a>
|
||||
<ul class="menu level2">
|
||||
<li class="first"><a href="/faq/campaigns/overview"><span>Overview</span></a></li>
|
||||
<li><a href="/faq/campaigns/supporting"><span>Supporting Campaigns</span></a></li>
|
||||
<li class="last"><a href="/faq/campaigns/premiums"><span>Premiums</span></a></li>
|
||||
<li class="first"><a href="{% url faq_sublocation 'campaigns' 'overview' %}"><span>Overview</span></a></li>
|
||||
<li><a href="{% url faq_sublocation 'campaigns' 'supporting' %}"><span>Supporting Campaigns</span></a></li>
|
||||
<li class="last"><a href="{% url faq_sublocation 'campaigns' 'premiums' %}"><span>Premiums</span></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="parent {% if location != 'unglued_ebooks' %}collapse{% endif %}">
|
||||
<a href="/faq/unglued_ebooks/"><span>Unglued Ebooks</span></a>
|
||||
<a href="{% url faq_location 'unglued_ebooks' %}"><span>Unglued Ebooks</span></a>
|
||||
<ul class="menu level2">
|
||||
<li class="first"><a href="/faq/unglued_ebooks/general"><span>General Questions</span></a></li>
|
||||
<li><a href="/faq/unglued_ebooks/using"><span>Using Your Unglued Ebook</span></a></li>
|
||||
<li class="last"><a href="/faq/unglued_ebooks/copyright"><span>Ungluing and Copyright</span></a></li>
|
||||
<li class="first"><a href="{% url faq_sublocation 'unglued_ebooks' 'general' %}"><span>General Questions</span></a></li>
|
||||
<li><a href="{% url faq_sublocation 'unglued_ebooks' 'using' %}"><span>Using Your Unglued Ebook</span></a></li>
|
||||
<li class="last"><a href="{% url faq_sublocation 'unglued_ebooks' 'copyright' %}"><span>Ungluing and Copyright</span></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="parent {% if location != 'rightsholders' %}collapse{% endif %}">
|
||||
<a href="/faq/rightsholders/"><span>For Rights Holders</span></a>
|
||||
<li class="parent {% if location != 'rightsholders' and 'smashwords' not in request.path %}collapse{% endif %}">
|
||||
<a href="{% url faq_location 'rightsholders' %}"><span>For Rights Holders</span></a>
|
||||
<ul class="menu level2">
|
||||
<li class="first"><a href="/faq/rightsholders/authorization"><span>Becoming Authorized</span></a></li>
|
||||
<li><a href="/faq/rightsholders/campaigns"><span>Running Campaigns</span></a></li>
|
||||
<li><a href="/faq/rightsholders/publicity"><span>Publicizing Campaigns</span></a></li>
|
||||
<li><a href="/faq/rightsholders/funding"><span>Funding</span></a></li>
|
||||
<li><a href="/faq/rightsholders/conversion"><span>Ebook Conversion</span></a></li>
|
||||
<li class="last"><a href="/faq/rightsholders/rights/"><span>Rights</span></a></li>
|
||||
<li class="first"><a href="{% url faq_sublocation 'rightsholders' 'authorization' %}"><span>Becoming Authorized</span></a></li>
|
||||
<li><a href="{% url faq_sublocation 'rightsholders' 'campaigns' %}"><span>Running Campaigns</span></a></li>
|
||||
<li><a href="{% url faq_sublocation 'rightsholders' 'publicity' %}"><span>Publicizing Campaigns</span></a></li>
|
||||
<li><a href="{% url faq_sublocation 'rightsholders' 'funding' %}"><span>Funding</span></a></li>
|
||||
<li><a href="{% url faq_sublocation 'rightsholders' 'conversion' %}"><span>Ebook Conversion</span></a></li>
|
||||
<li><a href="{% url faq_sublocation 'rightsholders' 'rights' %}"><span>Rights</span></a></li>
|
||||
<li class="last"><a href="{% url about_specific 'smashwords' %}"><span>Smashwords Authors</span></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<script type="text/javascript" src="{{ jquery_ui_home }}"></script>
|
||||
<script type="text/javascript" src="/static/js/greenpanel.js"></script>
|
||||
<script type="text/javascript" src="/static/js/toggle.js"></script>
|
||||
<script type="text/javascript" src="/static/js/hijax_unglued.js"></script>
|
||||
<script type="text/javascript" src="/static/js/tabs.js"></script>
|
||||
{% endblock %}
|
||||
{% block topsection %}
|
||||
|
@ -27,7 +28,7 @@
|
|||
<div class="js-topnews3">
|
||||
<div class="user-block">
|
||||
<div id="user-block1">
|
||||
<div id="block-intro-text"><span class="special-user-name">{% if facet %}{{ facet|capfirst }}{% else %}Ready to Read{% endif %}</span></div>
|
||||
<div id="block-intro-text"><span class="special-user-name">Ready to Read</span></div>
|
||||
</div>
|
||||
<div class="user-block2"><span class="user-short-info">These {% if pub_lang %}{{ pub_lang|ez_lang_name }} language {% endif %}ebooks are ready to read - either they're in the public domain, or they've been unglued by people like you.</span>
|
||||
</div>
|
||||
|
@ -56,7 +57,17 @@
|
|||
<div id="content-block">
|
||||
<div class="content-block-heading unglued" id="tabs">
|
||||
<ul class="tabs">
|
||||
<li class="tabs1"><a href="#">All<br />({{ work_list.count }})</a></li>
|
||||
{% if request.GET.pub_lang %}
|
||||
{% with request.GET.pub_lang as pub_lang %}
|
||||
<li class="tabs1"><a href="{% url unglued_list '' %}?pub_lang={{ pub_lang }}" class="hijax_unglued">Unglued</a></li>
|
||||
<li class="tabs2"><a href="{% url unglued_list 'cc' %}?pub_lang={{ pub_lang }}" class="hijax_unglued">Creative<br />Commons</a></li>
|
||||
<li class="tabs3"><a href="{% url unglued_list 'pd' %}?pub_lang={{ pub_lang }}" class="hijax_unglued">Public<br />Domain</a></li>
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
<li class="tabs1"><a href="{% url unglued_list '' %}" class="hijax_unglued">Unglued</a></li>
|
||||
<li class="tabs2"><a href="{% url unglued_list 'cc' %}" class="hijax_unglued">Creative<br />Commons</a></li>
|
||||
<li class="tabs3"><a href="{% url unglued_list 'pd' %}" class="hijax_unglued">Public<br />Domain</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<ul class="book-list-view">
|
||||
<li>View As:</li>
|
||||
|
@ -73,26 +84,28 @@
|
|||
</ul>
|
||||
</div>
|
||||
<div id="content-block-content">
|
||||
{% ifequal work_list.count 0 %}
|
||||
There aren't any {{ pub_lang|ez_lang_name }} works in this list. Why don't you add some?
|
||||
{% else %}
|
||||
{% lazy_paginate 20 work_list using "work_list" %}
|
||||
{% for work in work_list %}
|
||||
<div class="{% cycle 'row1' 'row2' %}">
|
||||
{% with work.last_campaign_status as status %}
|
||||
{% with work.last_campaign.deadline as deadline %}
|
||||
{% with work.googlebooks_id as googlebooks_id %}
|
||||
{% include "book_panel.html" %}
|
||||
{% endwith %}{% endwith %}{% endwith %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="pagination content-block-heading tabs-1">
|
||||
{% get_pages %}
|
||||
{% for page in pages %}
|
||||
<a href="{{ page.path }}#1" class="endless_page_link">{{ page.number }}</a>
|
||||
<div id="books-go-here">
|
||||
{% ifequal work_list.count 0 %}
|
||||
There aren't any {{ pub_lang|ez_lang_name }} works in this list. Why don't you add some?
|
||||
{% else %}
|
||||
{% lazy_paginate 20 work_list using "work_list" %}
|
||||
{% for work in work_list %}
|
||||
<div class="{% cycle 'row1' 'row2' %}">
|
||||
{% with work.last_campaign_status as status %}
|
||||
{% with work.last_campaign.deadline as deadline %}
|
||||
{% with work.googlebooks_id as googlebooks_id %}
|
||||
{% include "book_panel.html" %}
|
||||
{% endwith %}{% endwith %}{% endwith %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="pagination content-block-heading tabs-1">
|
||||
{% get_pages %}
|
||||
{% for page in pages %}
|
||||
<a href="{{ page.path }}#1" class="endless_page_link">{{ page.number }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endifequal %}
|
||||
</div>
|
||||
{% endifequal %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -33,7 +33,7 @@ urlpatterns = patterns(
|
|||
url(r"^campaign_admin/$", "campaign_admin", name="campaign_admin"),
|
||||
url(r"^faq/$", FAQView.as_view(), {'location':'faq', 'sublocation':'all'}, name="faq"),
|
||||
url(r"^faq/(?P<location>\w*)/$", FAQView.as_view(), {'sublocation':'all'}, name="faq_location"),
|
||||
url(r"^faq/(?P<location>\w*)/(?P<sublocation>\w*)/$", FAQView.as_view()),
|
||||
url(r"^faq/(?P<location>\w*)/(?P<sublocation>\w*)/$", FAQView.as_view(), name="faq_sublocation"),
|
||||
url(r"^wishlist/$", "wishlist", name="wishlist"),
|
||||
url(r"^campaigns/(?P<facet>\w*)$", CampaignListView.as_view(), name='campaign_list'),
|
||||
url(r"^lists/(?P<facet>\w*)$", WorkListView.as_view(), name='work_list'),
|
||||
|
@ -86,7 +86,7 @@ urlpatterns = patterns(
|
|||
url(r"^info/languages/(?P<template_name>[\w\.]*)$", InfoLangView.as_view()),
|
||||
url(r'^supporter/(?P<supporter>[^/]+)/feed/$', SupporterWishlistFeed()),
|
||||
url(r'^campaign_archive.js/$', "campaign_archive_js", name="campaign_archive_js"),
|
||||
url(r"^about/(?P<facet>\w*)/$", "about", name="about"),
|
||||
url(r"^about/(?P<facet>\w*)/$", "about", name="about_specific"),
|
||||
url(r"^libraries/$", TemplateView.as_view(
|
||||
template_name="libraries.html",
|
||||
get_context_data=lambda: {'site': Site.objects.get_current()}
|
||||
|
|
|
@ -520,31 +520,39 @@ class UngluedListView(FilterableListView):
|
|||
template_name = "unglued_list.html"
|
||||
context_object_name = "work_list"
|
||||
|
||||
def work_set_counts(self,work_set):
|
||||
counts={}
|
||||
counts['unglued'] = work_set.annotate(ebook_count=Count('editions__ebooks')).filter(ebook_count__gt=0).count()
|
||||
return counts
|
||||
|
||||
def get_queryset_all(self):
|
||||
facet = self.kwargs['facet']
|
||||
if (facet == 'popular'):
|
||||
return models.Work.objects.filter(editions__ebooks__isnull=False).distinct().order_by('-num_wishes')
|
||||
else:
|
||||
has_ebooks = models.Work.objects.filter(editions__ebooks__isnull=False).distinct()
|
||||
successful_campaign = models.Work.objects.filter(campaigns__status="SUCCESSFUL").distinct()
|
||||
unglued = successful_campaign | has_ebooks
|
||||
return unglued.order_by('-campaigns__status', '-campaigns__deadline', '-created')
|
||||
elif (facet == 'cc' or facet == 'creativecommons'):
|
||||
# assumes all ebooks have a PD or CC license. compare rights_badge property
|
||||
return models.Work.objects.filter(
|
||||
editions__ebooks__isnull=False,
|
||||
editions__ebooks__rights__in=['CC BY', 'CC BY-NC-SA', 'CC BY-NC-ND', 'CC BY-NC', 'CC BY-ND', 'CC BY-SA']
|
||||
).distinct().order_by('-num_wishes')
|
||||
elif (facet == 'pd' or facet == 'publicdomain'):
|
||||
return models.Work.objects.filter(
|
||||
editions__ebooks__isnull=False,
|
||||
editions__ebooks__rights__in=['PD-US', 'CC0', '']
|
||||
).distinct().order_by('-num_wishes')
|
||||
else :
|
||||
#(facet == '' or facet == 'unglued' or facet is other)
|
||||
return models.Work.objects.filter(campaigns__status="SUCCESSFUL").distinct().order_by('-campaigns__deadline')
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(UngluedListView, self).get_context_data(**kwargs)
|
||||
qs=self.get_queryset()
|
||||
context['counts'] = self.work_set_counts(qs)
|
||||
context['ungluers'] = userlists.work_list_users(qs,5)
|
||||
context['facet'] =self.kwargs['facet']
|
||||
context = super(UngluedListView, self).get_context_data(**kwargs)
|
||||
qs=self.get_queryset()
|
||||
context['ungluers'] = userlists.work_list_users(qs,5)
|
||||
facet = self.kwargs['facet']
|
||||
context['facet'] = facet
|
||||
if facet == 'cc' or facet == 'creativecommons':
|
||||
context['activetab'] = "#2"
|
||||
elif facet == 'pd' or facet == 'publicdomain':
|
||||
context['activetab'] = "#3"
|
||||
else:
|
||||
context['activetab'] = "#1"
|
||||
return context
|
||||
return context
|
||||
|
||||
|
||||
class CampaignListView(FilterableListView):
|
||||
template_name = "campaign_list.html"
|
||||
context_object_name = "campaign_list"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
var $j = jQuery.noConflict();
|
||||
|
||||
$j(document).ready(function() {
|
||||
$j("a.hijax").click(function(event) {
|
||||
$j("#js-page-wrap, #footer").on("click", "a.hijax", function(event) {
|
||||
event.preventDefault();
|
||||
$j("#lightbox").load($j(this).attr("href") + " #lightbox_content", function() {
|
||||
// centering divs of dynamic width: shockingly hard. make sure lightbox is centered on load.
|
||||
|
@ -24,9 +24,7 @@ $j(document).ready(function() {
|
|||
}
|
||||
|
||||
// fade-out rest of page elements on expand
|
||||
$j('#feedback').css({"opacity": "0.07"});
|
||||
$j('#js-page-wrap').css({"opacity": "0.07"});
|
||||
$j('#footer').css({"opacity": "0.07"});
|
||||
$j('#feedback, #js-page-wrap, #footer').css({"opacity": "0.07"});
|
||||
$j('#about_expandable').css({'position': 'absolute'});
|
||||
$j('#about_expandable').fadeTo("slow", 1);
|
||||
|
||||
|
@ -47,16 +45,9 @@ $j(document).ready(function() {
|
|||
});
|
||||
|
||||
// fade-in normal page elements on collapse
|
||||
$j('#about_collapser').click(function(){
|
||||
$j('#js-topsection').fadeTo("slow", 1);
|
||||
$j('.launch_top').fadeTo("slow", 1);
|
||||
$j('.preview').fadeTo("slow", 1);
|
||||
$j('#main-container').fadeTo("slow", 1);
|
||||
$j('#js-rightcol').fadeTo("slow", 1);
|
||||
$j('#js-header').fadeTo("slow", 1);
|
||||
$j('#about_collapser').on("click", function(){
|
||||
$j('#js-topsection, .launch_top, .preview, #main-container, #js-rightcol, #js-header, #js-page-wrap, #footer, #feedback').fadeTo("slow", 1);
|
||||
$j('#js-header a').css({"cursor": "pointer"});
|
||||
$j('#js-page-wrap').fadeTo("slow", 1);
|
||||
$j('#footer').fadeTo("slow", 1);
|
||||
$j('#about_expandable').css({"display": "none"});
|
||||
});
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// hijack a link with class "hijax" to show its content in a lightbox instead
|
||||
// allows for ajaxy presentation of things like download links in a way that
|
||||
// degrades gracefully for non-js users
|
||||
var $j = jQuery.noConflict();
|
||||
|
||||
$j(document).ready(function() {
|
||||
$j("a.hijax_unglued").click(function(event) {
|
||||
event.preventDefault();
|
||||
$j("#content-block-content").html('<img src="/static/images/loading.gif">').load($j(this).attr("href") + " #books-go-here");
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue