Add featured book to landing page
parent
8c4f580d00
commit
bf61227429
|
@ -23,7 +23,7 @@
|
|||
<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%}">Latest Creative Commons</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>
|
||||
|
|
|
@ -41,6 +41,47 @@ function put_un_in_cookie2(){
|
|||
<div class="js-main" id="content-block">
|
||||
<div id="js-maincol-fl">
|
||||
<div id="js-main-container">
|
||||
<h3 class="featured_books">Today's Featured Free eBook</h3>
|
||||
{% with featured as work %}
|
||||
<div class="book-detail">
|
||||
<div id="book-detail-img" style="float:left;padding-right:10px">
|
||||
<a href="{% url work featured.id %}">
|
||||
{% if work.googlebooks_id %}
|
||||
<img src="{{ work.cover_image_thumbnail }}" alt="Find {{ work.title }} at Google Books" title="Find {{ work.title }} at Google Books" width="131" height="192" />
|
||||
{% else %}
|
||||
<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" />
|
||||
{% endif %}
|
||||
</a>
|
||||
<div class="quicktour" style=" padding-top: 10px;padding-left: 5px;">
|
||||
<div class="panelview panelfront side1">
|
||||
<a href="{% url download work.id %}" title="Download featured ebook" class="qtbutton qtreadittext hijax"><div class="read_itbutton qtreadit"><span>Read it Now</span></div></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="book-detail-info" style="float:left;">
|
||||
<div style="width: 520px;float: left;">
|
||||
<div class="book-name" style="font-size:larger; margin-bottom:10px"><a href="{% url work featured.id %}">{{ work.title }}</a></div>
|
||||
<div>
|
||||
<div class="pubinfo">
|
||||
<div class="book-author">
|
||||
<span>{{ work.authors.0.name }}</span>{% ifequal work.authors.count 2 %}
|
||||
and <span>{{ work.authors.1.name }}</span>
|
||||
{% endifequal %}{% if work.authors.count > 2 %}{% for author in work.authors %}{% if not forloop.first %}, <span>{{ author.name }}</span>{% endif %}{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="book-year">
|
||||
{% if work.last_campaign.publisher %}
|
||||
<span><a href="{% url bypubname_list work.last_campaign.publisher.name.id %}">{{ work.last_campaign.publisher }}</a></span>
|
||||
{% endif %}
|
||||
<span>{{ work.publication_date_year }}</span>
|
||||
</div>
|
||||
<div class="book-description" style="max-height:200px;overflow:scroll"> {{ work.description|safe }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endwith %}
|
||||
</div>
|
||||
{% if top_pledge %}
|
||||
<h3 class="featured_books">Pledge to Make These eBooks Free</h3>
|
||||
<div>
|
||||
|
|
|
@ -221,16 +221,20 @@ def home(request, landing=False):
|
|||
use campaigns instead of works so that we can order by amount left,
|
||||
drive interest toward most-nearly-successful
|
||||
"""
|
||||
try:
|
||||
featured = models.Work.objects.filter(featured__isnull=False).distinct().order_by('-featured')[0]
|
||||
except:
|
||||
#shouldn't occur except in tests
|
||||
featured = models.Work.objects.all()[0]
|
||||
top_pledge = models.Campaign.objects.filter(status="ACTIVE",type=REWARDS).order_by('left')[:4]
|
||||
top_b2u = models.Campaign.objects.filter(status="ACTIVE", type=BUY2UNGLUE).order_by('-work__num_wishes')[:4]
|
||||
top_t4u = models.Campaign.objects.filter(status="ACTIVE",type=THANKS).order_by('-work__num_wishes')[:4]
|
||||
|
||||
top_t4u = models.Campaign.objects.exclude(id = featured.id).filter(status="ACTIVE",type=THANKS).order_by('-work__num_wishes')[:4]
|
||||
|
||||
most_wished = models.Work.objects.order_by('-num_wishes')[:4]
|
||||
|
||||
unglued_books = models.Work.objects.filter(campaigns__status="SUCCESSFUL").order_by('-campaigns__deadline')[:4]
|
||||
|
||||
cc_books = models.Work.objects.filter(
|
||||
cc_books = models.Work.objects.exclude(id = featured.id).filter(
|
||||
featured__isnull=False,
|
||||
editions__ebooks__rights__in=cc.LICENSE_LIST
|
||||
).distinct().order_by('-featured')[:4]
|
||||
|
@ -298,6 +302,7 @@ def home(request, landing=False):
|
|||
'unglued_books': unglued_books,
|
||||
'cc_books': cc_books,
|
||||
'most_wished': most_wished,
|
||||
'featured': featured,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -277,6 +277,7 @@ h3.featured_books {
|
|||
background: @pale-blue;
|
||||
.border-radius(10px, 10px, 0, 0);
|
||||
padding: 10px;
|
||||
-webkit-margin-before: 0;
|
||||
}
|
||||
|
||||
a.more_featured_books {
|
||||
|
|
Loading…
Reference in New Issue