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 class="js-main" id="content-block">
|
||||||
<div id="js-maincol-fl">
|
<div id="js-maincol-fl">
|
||||||
<div id="js-main-container">
|
<div id="js-main-container">
|
||||||
|
{% if top_campaigns %}
|
||||||
<h3 class="featured_books">Active Campaigns</h3>
|
<h3 class="featured_books">Active Campaigns</h3>
|
||||||
<div>
|
<div>
|
||||||
{% for campaign in top_campaigns %}
|
{% for campaign in top_campaigns %}
|
||||||
|
@ -53,6 +54,19 @@ function put_un_in_cookie2(){
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<a class="more_featured_books" href="{% url campaign_list 'ending' %}"></a>
|
<a class="more_featured_books" href="{% url campaign_list 'ending' %}"></a>
|
||||||
</div>
|
</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>
|
<div class="spacer"></div>
|
||||||
|
|
||||||
<h3 class="featured_books">Already Unglued</h3>
|
<h3 class="featured_books">Already Unglued</h3>
|
||||||
|
|
|
@ -148,6 +148,9 @@ def home(request, landing=False):
|
||||||
drive interest toward most-nearly-successful
|
drive interest toward most-nearly-successful
|
||||||
"""
|
"""
|
||||||
top_campaigns = models.Campaign.objects.filter(status="ACTIVE").order_by('left')[:4]
|
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]
|
most_wished = models.Work.objects.order_by('-num_wishes')[:4]
|
||||||
|
|
||||||
|
@ -203,9 +206,18 @@ def home(request, landing=False):
|
||||||
else:
|
else:
|
||||||
events = latest_actions[:6]
|
events = latest_actions[:6]
|
||||||
|
|
||||||
return render(request, 'home.html', {
|
return render(
|
||||||
'suppress_search_box': True, 'events': events, 'top_campaigns': top_campaigns, 'unglued_books': unglued_books, 'most_wished': most_wished
|
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):
|
def stub(request):
|
||||||
path = request.path[6:] # get rid of /stub/
|
path = request.path[6:] # get rid of /stub/
|
||||||
|
|
Loading…
Reference in New Issue