fixed unglued list tabbing

pull/1/head
eric 2012-02-29 12:34:21 -05:00
parent 1c2b1fb606
commit 5ce023d322
2 changed files with 12 additions and 11 deletions

View File

@ -8,6 +8,9 @@
<link type="text/css" rel="stylesheet" href="/static/css/book_panel.css" />
{% endblock %}
{% block extra_head %}
<script>
location.hash = "#1";
</script>
<script type="text/javascript" src="/static/js/wishlist.js"></script>
<script type="text/javascript" src={{ jquery_ui_home }}></script>
<script type="text/javascript" src="/static/js/greenpanel.js"></script>
@ -51,7 +54,7 @@
<div id="js-maincol-fr">
<div class="js-maincol-inner">
<div id="content-block">
<div class="content-block-heading ungluing" id="tabs">
<div class="content-block-heading unglued" id="tabs">
<ul class="tabs">
<li class="tabs1"><a href="#">Unglued</a></li>
</ul>
@ -77,7 +80,7 @@
{% ifequal work_list.count 0 %}
There aren't any works in this list. Why don't you add some?
{% else %}
{% paginate 20 work_list %}
{% 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 %}
@ -88,8 +91,11 @@
</div>
{% endfor %}
<br>
<div class="pagination content-block-heading">
{% show_pages %}
<div class="pagination content-block-heading tabs-1">
{% get_pages %}
{% for page in pages %}
<a href="{{ page.path }}#1">{{ page.number }}</a>
{% endfor %}
</div>
{% endifequal %}
</div>

View File

@ -743,15 +743,11 @@ def campaign_admin(request):
def supporter(request, supporter_username, template_name):
supporter = get_object_or_404(User, username=supporter_username)
wishlist = supporter.wishlist
fromsupport = 1
# querysets for tabs
# unglued tab is anything for which there has been a successful campaign OR anything with an existing ebook
# TO DO: this should be ordered but it's not clear how
# unglued tab is anything with an existing ebook
## .order_by() may clash with .distinct() and this should be fixed
## works are not guaranteed to have associated campaigns so can we sort on campaign deadline?
## works may be associated with multiple campaigns so what will happen if we sort on campaign deadline?
works_unglued = wishlist.works.all().filter(editions__ebooks__isnull=False).order_by('-num_wishes').distinct()
works_unglued = wishlist.works.all().filter(editions__ebooks__isnull=False).distinct().order_by('-num_wishes')
# take the set complement of the unglued tab and filter it for active works to get middle tab
result = wishlist.works.all().exclude(pk__in=works_unglued.values_list('pk', flat=True))
@ -817,7 +813,6 @@ def supporter(request, supporter_username, template_name):
"works_unglued": works_unglued,
"works_active": works_active,
"works_wished": works_wished,
"fromsupport": fromsupport,
"backed": backed,
"backing": backing,
"wished": wished,