show coming soon campaigns if none active, or skip section if none initialized either
parent
43cf61a7e8
commit
c8ff245e80
|
@ -41,6 +41,7 @@ function put_un_in_cookie2(){
|
|||
<div class="js-main" id="content-block">
|
||||
<div id="js-maincol-fl">
|
||||
<div id="js-main-container">
|
||||
{% if top_campaigns %}
|
||||
<h3 class="featured_books">Active Campaigns</h3>
|
||||
<div>
|
||||
{% for campaign in top_campaigns %}
|
||||
|
@ -53,6 +54,19 @@ function put_un_in_cookie2(){
|
|||
{% endfor %}
|
||||
<a class="more_featured_books" href="{% url campaign_list 'ending' %}"></a>
|
||||
</div>
|
||||
{% else %}{% if coming_soon %}
|
||||
<h3 class="featured_books">Coming Soon</h3>
|
||||
<div>
|
||||
{% for campaign in coming_soon %}
|
||||
{% with campaign.work as work %}
|
||||
{% with work.googlebooks_id as googlebooks_id %}
|
||||
{% with "INITIALIZED" as status %}
|
||||
{% include "book_panel.html" %}
|
||||
{% endwith %}{% endwith %}{% endwith %}
|
||||
{% endfor %}
|
||||
<a class="more_featured_books" href="{% url campaign_list 'ending' %}"></a>
|
||||
</div>
|
||||
{% endif %}{% endif %}
|
||||
<div class="spacer"></div>
|
||||
|
||||
<h3 class="featured_books">Already Unglued</h3>
|
||||
|
|
|
@ -148,6 +148,9 @@ def home(request, landing=False):
|
|||
drive interest toward most-nearly-successful
|
||||
"""
|
||||
top_campaigns = models.Campaign.objects.filter(status="ACTIVE").order_by('left')[:4]
|
||||
coming_soon = []
|
||||
if not top_campaigns:
|
||||
coming_soon = models.Campaign.objects.filter(status="INITIALIZED").order_by('-work__num_wishes')[:4]
|
||||
|
||||
most_wished = models.Work.objects.order_by('-num_wishes')[:4]
|
||||
|
||||
|
@ -203,9 +206,18 @@ def home(request, landing=False):
|
|||
else:
|
||||
events = latest_actions[:6]
|
||||
|
||||
return render(request, 'home.html', {
|
||||
'suppress_search_box': True, 'events': events, 'top_campaigns': top_campaigns, 'unglued_books': unglued_books, 'most_wished': most_wished
|
||||
})
|
||||
return render(
|
||||
request,
|
||||
'home.html',
|
||||
{
|
||||
'suppress_search_box': True,
|
||||
'events': events,
|
||||
'top_campaigns': top_campaigns,
|
||||
'coming_soon': coming_soon,
|
||||
'unglued_books': unglued_books,
|
||||
'most_wished': most_wished
|
||||
}
|
||||
)
|
||||
|
||||
def stub(request):
|
||||
path = request.path[6:] # get rid of /stub/
|
||||
|
|
Loading…
Reference in New Issue