Rip out CCList, replace with facets

pull/1/head
eric 2014-12-03 10:15:38 -05:00
parent 2f37d1d670
commit af83e6a8c0
4 changed files with 6 additions and 56 deletions

View File

@ -122,7 +122,7 @@ def get_facet(facet_name):
return BaseFacet
order_by_keys = {
'newest':['-created'],
'newest':['-featured', '-created'],
'oldest':['created'],
'featured':['-featured', '-num_wishes'],
'popular':['-num_wishes'],

View File

@ -14,27 +14,13 @@
<li><a href="{% url library library.user %}"><span>{{ library }}</span></a></li>
{% endfor %}
<li>
{% else %}
<li class="first">
{% endif %}
<a href="{% url campaign_list 'ending' %}"><span>Active Campaigns</span></a></li>
<li><a href="{% url free %}"><span>Free eBooks!</span></a></li>
<li><a href="{% url campaign_list 'ending' %}"><span>Active Campaigns</span></a></li>
<li><a href="{% url comment %}"><span>Latest Comments</span></a></li>
<li><a href="{% url work_list 'popular' %}"><span>Site Favorites</span></a></li>
<li><a href="{% url work_list 'new' %}"><span>Latest Favorites</span></a></li>
<!--<li><a href="{% url work_list 'recommended' %}"><span>Noteworthy</span></a></li>-->
<li><a href="{% url unglued_list '' %}"><span>Ready to Read</span></a></li>
<li class="last"><a href="{% url cc_list%}">Featured Creative Commons</a></li>
{% ifequal aspect 'cc' %}
<ul class="menu level3">
<li class="first"><a href="{% url cc_list_detail 'by' %}"><span{% ifequal facet 'by' %} style="font-weight: bold;"{% endifequal %}>CC BY</span></a></li>
<li><a href="{% url cc_list_detail 'by-nc-nd' %}"><span{% ifequal facet 'by-nc-nd' %} style="font-weight: bold;"{% endifequal %}>CC BY-NC-ND</span></a></li>
<li><a href="{% url cc_list_detail 'by-nc-sa' %}"><span{% ifequal facet 'by-nc-sa' %} style="font-weight: bold;"{% endifequal %}>CC BY-NC-SA</span></a></li>
<li><a href="{% url cc_list_detail 'by-nc' %}"><span{% ifequal facet 'by-nc' %} style="font-weight: bold;"{% endifequal %}>CC BY-NC</span></a></li>
<li><a href="{% url cc_list_detail 'by-sa' %}"><span{% ifequal facet 'by-sa' %} style="font-weight: bold;"{% endifequal %}>CC BY-SA</span></a></li>
<li><a href="{% url cc_list_detail 'by-nd' %}"><span{% ifequal facet 'by-nd' %} style="font-weight: bold;"{% endifequal %}>CC BY-ND</span></a></li>
<li><a href="{% url cc_list_detail 'cc0' %}"><span{% ifequal facet 'cc0' %} style="font-weight: bold;"{% endifequal %}>CC0</span></a></li>
</ul>
{% endifequal %}
{% if pubname %}
<li>{{ pubname }}...
<ul class="menu level3">

View File

@ -22,7 +22,6 @@ from regluit.frontend.views import (
CampaignListView,
WorkListView,
UngluedListView,
CCListView,
InfoPageView,
InfoLangView,
GiftView,
@ -84,9 +83,9 @@ urlpatterns = patterns(
url(r"^bypub/(?P<facet>\w*)/(?P<pubname>.*)$", ByPubListView.as_view(), name='bypub_list'),
url(r"^unglued/(?P<facet>\w*)$", UngluedListView.as_view(), name='unglued_list'),
url(r"^unglued/(?P<facet>\w*)/marc/$", UngluedListView.as_view(send_marc=True), name='unglued_list_marc'),
url(r"^creativecommons/$", CCListView.as_view(), name='cc_list'),
url(r"^creativecommons/(?P<facet>[\w\-]*)$", CCListView.as_view(), name='cc_list_detail'),
url(r"^creativecommons/(?P<facet>[\w\-]*)/marc/$", CCListView.as_view(send_marc=True), name='cc_list_marc'),
url(r"^creativecommons/$", FacetedView.as_view(), name='cc_list'),
url(r"^creativecommons/(?P<path>[^\s]*)/marc/$", FacetedView.as_view(send_marc=True), name='cc_list_marc'),
url(r"^creativecommons/(?P<path>[^\s]*)$", FacetedView.as_view(), name='cc_list_detail'),
url(r"^goodreads/auth/$", "goodreads_auth", name="goodreads_auth"),
url(r"^goodreads/auth_cb/$", "goodreads_cb", name="goodreads_cb"),
url(r"^goodreads/flush/$","goodreads_flush_assoc", name="goodreads_flush_assoc"),

View File

@ -917,41 +917,6 @@ class ByPubListView(ByPubView):
self.publisher_name = get_object_or_404(models.PublisherName, name=self.kwargs['pubname'])
self.set_publisher()
class CCListView(FilterableListView):
template_name = "cc_list.html"
context_object_name = "work_list"
licenses = cc.LICENSE_LIST_ALL
facets = cc.FACET_LIST
def get_queryset_all(self):
facet = self.kwargs.get('facet','')
if facet in self.facets:
ccworks = models.Work.objects.filter(
editions__ebooks__isnull=False,
editions__ebooks__rights=self.licenses[self.facets.index(facet)]
)
notyet = models.Work.objects.filter(
campaigns__status="ACTIVE",
campaigns__license=self.licenses[self.facets.index(facet)]
)
return (notyet | ccworks).distinct().order_by('-featured','-created')
else:
return models.Work.objects.filter( editions__ebooks__isnull=False,
editions__ebooks__rights__in=self.licenses
).distinct().order_by('-featured','-created')
def get_context_data(self, **kwargs):
context = super(CCListView, self).get_context_data(**kwargs)
facet = self.kwargs.get('facet','all')
qs=self.get_queryset()
context['ungluers'] = userlists.work_list_users(qs,5)
context['activetab'] = "#1"
context['tab_override'] = 'tabs-1'
context['facet'] = facet
context['aspect'] = 'cc'
context['license'] = self.licenses[self.facets.index(facet)] if facet in self.facets else ''
context['cc'] = cc.ccinfo(context['license'])
return context
class UngluedListView(FilterableListView):
template_name = "unglued_list.html"