Merge pull request #101 from Gluejar/successful_works_in_inglued_tab
Successful works in unglued tab; offset on "read it now" to be fixed.pull/1/head
commit
53a62c3764
|
@ -8,7 +8,7 @@
|
||||||
{% with work.last_campaign.status as status %}
|
{% with work.last_campaign.status as status %}
|
||||||
{% with work.last_campaign.deadline as deadline %}
|
{% with work.last_campaign.deadline as deadline %}
|
||||||
{% with work.id as workid %}
|
{% with work.id as workid %}
|
||||||
<div class="thewholebook listview tabs {% if first_ebook %}tabs-1{% else %}{% if status == 'SUCCESSFUL' or status == 'ACTIVE' %}tabs-2{% else %}tabs-3{% endif %}{% endif %}">
|
<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 book-list">
|
||||||
<div class="listview panelback side2">
|
<div class="listview panelback side2">
|
||||||
{% comment %} hover state of panel {% endcomment %}
|
{% comment %} hover state of panel {% endcomment %}
|
||||||
|
@ -154,9 +154,13 @@
|
||||||
<span class="booklist-status-text" style="width: 190px"><b>${{ work.last_campaign.current_total|floatformat:0|intcomma }}</b>/<b>${{ work.last_campaign.target|floatformat:0|intcomma }}</b></span>
|
<span class="booklist-status-text" style="width: 190px"><b>${{ work.last_campaign.current_total|floatformat:0|intcomma }}</b>/<b>${{ work.last_campaign.target|floatformat:0|intcomma }}</b></span>
|
||||||
{% else %}{% ifequal status "INITIALIZED" %}
|
{% else %}{% ifequal status "INITIALIZED" %}
|
||||||
<span class="booklist-status-label">Status: </span><span class="booklist-status-text">Coming soon!</span>
|
<span class="booklist-status-label">Status: </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 %}
|
{% else %}
|
||||||
<span class="booklist-status-label"></span>
|
<span class="booklist-status-label"></span>
|
||||||
{% endifequal %}{% endifequal %}
|
{% endif %}
|
||||||
|
{% endifequal %}{% endifequal %}{% endifequal %}
|
||||||
</div>
|
</div>
|
||||||
<div class="listview panelfront side1 icons">
|
<div class="listview panelfront side1 icons">
|
||||||
|
|
||||||
|
@ -167,11 +171,7 @@
|
||||||
Otherwise: number of wishes
|
Otherwise: number of wishes
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
{% if first_ebook %}
|
{% if first_ebook %}
|
||||||
<span class="listview boolist-ebook">
|
<a href="{% url download workid %}" class="hijax"><div class="read_itbutton"><span>Read it Now</span></div></a>
|
||||||
{% for ebook in work.ebooks|slice:":3" %}
|
|
||||||
<a href="{{ ebook.url }}"><img src="/static/images/{{ ebook.format }}32.png" height="32" alt="{{ ebook.rights}} {{ ebook.format }} at {{ebook.provider}}" title="{{ ebook.rights}} {{ ebook.format }} at {{ebook.provider}}" /></a>
|
|
||||||
{% endfor %}
|
|
||||||
</span>
|
|
||||||
{% else %}{% if status == 'ACTIVE' or status == 'SUCCESSFUL' %}
|
{% else %}{% if status == 'ACTIVE' or status == 'SUCCESSFUL' %}
|
||||||
<div class="booklist-status-img">
|
<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" />
|
<img src="/static/images/images/icon-book-37by25-{{ work.percent_unglued }}.png" title="book list status" alt="book list status" />
|
||||||
|
|
|
@ -340,7 +340,7 @@ there's no tab for seeing ALL my books, only the filters! huh.
|
||||||
{% if works_active %}
|
{% if works_active %}
|
||||||
{{ supporter }} is giving these books to you. <a href="/about/active/" class="hijax">Find out how.</a>
|
{{ supporter }} is giving these books to you. <a href="/about/active/" class="hijax">Find out how.</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ supporter }} isn't giving any books to the world right now. <a href="/about/active_empty" class="hijax">Find out how you can.</a>
|
{{ supporter }} isn't giving any new books to the world right now. <a href="/about/active_empty" class="hijax">Find out how you can.</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="tabs-3 anon_about">
|
<div class="tabs-3 anon_about">
|
||||||
|
|
|
@ -501,8 +501,9 @@ class WorkListView(FilterableListView):
|
||||||
qs=self.get_queryset()
|
qs=self.get_queryset()
|
||||||
context['ungluers'] = userlists.work_list_users(qs,5)
|
context['ungluers'] = userlists.work_list_users(qs,5)
|
||||||
context['facet'] = self.kwargs['facet']
|
context['facet'] = self.kwargs['facet']
|
||||||
context['works_unglued'] = qs.filter(editions__ebooks__isnull=False).distinct()[:20]
|
works_unglued = qs.filter(editions__ebooks__isnull=False).distinct() | qs.filter(campaigns__status='SUCCESSFUL').distinct()
|
||||||
context['works_active'] = qs.exclude(editions__ebooks__isnull=False).filter(Q(campaigns__status='ACTIVE') | Q(campaigns__status='SUCCESSFUL')).distinct()[:20]
|
context['works_unglued'] = works_unglued.order_by('-campaigns__status', 'campaigns__deadline', '-num_wishes')[:20]
|
||||||
|
context['works_active'] = qs.filter(campaigns__status='ACTIVE').distinct()[:20]
|
||||||
context['works_wished'] = qs.exclude(editions__ebooks__isnull=False).exclude(campaigns__status='ACTIVE').exclude(campaigns__status='SUCCESSFUL').distinct()[:20]
|
context['works_wished'] = qs.exclude(editions__ebooks__isnull=False).exclude(campaigns__status='ACTIVE').exclude(campaigns__status='SUCCESSFUL').distinct()[:20]
|
||||||
|
|
||||||
context['activetab'] = "#3"
|
context['activetab'] = "#3"
|
||||||
|
@ -529,8 +530,10 @@ class UngluedListView(FilterableListView):
|
||||||
if (facet == 'popular'):
|
if (facet == 'popular'):
|
||||||
return models.Work.objects.filter(editions__ebooks__isnull=False).distinct().order_by('-num_wishes')
|
return models.Work.objects.filter(editions__ebooks__isnull=False).distinct().order_by('-num_wishes')
|
||||||
else:
|
else:
|
||||||
#return models.Work.objects.annotate(ebook_count=Count('editions__ebooks')).filter(ebook_count__gt=0).order_by('-created')
|
has_ebooks = models.Work.objects.filter(editions__ebooks__isnull=False).distinct()
|
||||||
return models.Work.objects.filter(editions__ebooks__isnull=False).distinct().order_by('-created')
|
successful_campaign = models.Work.objects.filter(campaigns__status="SUCCESSFUL").distinct()
|
||||||
|
unglued = successful_campaign | has_ebooks
|
||||||
|
return unglued.order_by('-campaigns__status', '-campaigns__deadline', '-created')
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(UngluedListView, self).get_context_data(**kwargs)
|
context = super(UngluedListView, self).get_context_data(**kwargs)
|
||||||
|
@ -1366,19 +1369,21 @@ def supporter(request, supporter_username, template_name):
|
||||||
works_unglued = []
|
works_unglued = []
|
||||||
works_active = []
|
works_active = []
|
||||||
works_wished = []
|
works_wished = []
|
||||||
|
works_on_wishlist = wishlist.works.all()
|
||||||
|
|
||||||
if (wishlist.works.all()):
|
if (works_on_wishlist):
|
||||||
# querysets for tabs
|
# querysets for tabs
|
||||||
# unglued tab is anything with an existing ebook
|
# unglued tab is anything with an existing ebook or successful campaign
|
||||||
## .order_by() may clash with .distinct() and this should be fixed
|
## .order_by() may clash with .distinct() and this should be fixed
|
||||||
works_unglued = wishlist.works.all().filter(editions__ebooks__isnull=False).distinct().order_by('-num_wishes')
|
unglueit_works = works_on_wishlist.filter(campaigns__status="SUCCESSFUL").distinct()
|
||||||
|
works_otherwise_available = works_on_wishlist.filter(editions__ebooks__isnull=False).distinct()
|
||||||
|
works_unglued = unglueit_works | works_otherwise_available
|
||||||
|
works_unglued = works_unglued.order_by('-campaigns__status', 'campaigns__deadline', '-num_wishes')
|
||||||
|
|
||||||
# take the set complement of the unglued tab and filter it for active works to get middle tab
|
works_active = works_on_wishlist.filter(campaigns__status='ACTIVE').order_by('campaigns__deadline').distinct()
|
||||||
result = wishlist.works.all().exclude(pk__in=works_unglued.values_list('pk', flat=True))
|
|
||||||
works_active = result.filter(Q(campaigns__status='ACTIVE') | Q(campaigns__status='SUCCESSFUL')).order_by('-campaigns__status', 'campaigns__deadline').distinct()
|
|
||||||
|
|
||||||
# everything else goes in tab 3
|
# everything else goes in tab 3
|
||||||
works_wished = result.exclude(pk__in=works_active.values_list('pk', flat=True)).order_by('-num_wishes')
|
works_wished = works_on_wishlist.exclude(pk__in=works_active.values_list('pk', flat=True)).exclude(pk__in=works_unglued.values_list('pk', flat=True)).order_by('-num_wishes')
|
||||||
|
|
||||||
# badge counts
|
# badge counts
|
||||||
backed = works_unglued.count()
|
backed = works_unglued.count()
|
||||||
|
|
|
@ -340,6 +340,11 @@ div.panelview.side2 {
|
||||||
.read_itbutton_fail span:hover {
|
.read_itbutton_fail span:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
.panelfront.icons .read_itbutton {
|
||||||
|
margin-bottom: 7px;
|
||||||
|
height: 30px !important;
|
||||||
|
line-height: 30px !important;
|
||||||
|
}
|
||||||
.Unglue_itbutton {
|
.Unglue_itbutton {
|
||||||
width: 118px;
|
width: 118px;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
|
|
|
@ -251,6 +251,11 @@ div.panelview.side2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.panelfront.icons .read_itbutton {
|
||||||
|
margin-bottom: 7px;
|
||||||
|
.height(30px) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.Unglue_itbutton{
|
.Unglue_itbutton{
|
||||||
.readit;
|
.readit;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue