adding bookish activity to main content area
parent
7f59be6ada
commit
6e801e6841
|
@ -47,25 +47,53 @@ function put_un_in_cookie2(){
|
|||
<div class="js-main">
|
||||
<div id="js-maincol-fl">
|
||||
<div id="js-main-container">
|
||||
<div class="js-main-container-inner">
|
||||
<div id="js-maincontainer-content" class="have-content-right-module">
|
||||
|
||||
</div>
|
||||
<h3 class="featured_books">Active Campaigns</h3>
|
||||
{% for campaign in top_campaigns %}
|
||||
{% with campaign.work as work %}
|
||||
{% with work.googlebooks_id as googlebooks_id %}
|
||||
{% with "ACTIVE" as status %}
|
||||
{% with campaign.deadline as deadline %}
|
||||
{% include "book_panel.html" %}
|
||||
{% endwith %}{% endwith %}{% endwith %}{% endwith %}
|
||||
{% endfor %}
|
||||
<div class="spacer"></div>
|
||||
|
||||
<h3 class="featured_books">Already Unglued</h3>
|
||||
{% for work in unglued_books %}
|
||||
{% with work.googlebooks_id as googlebooks_id %}
|
||||
{% with "ACTIVE" as status %}
|
||||
{% with work.last_campaign.deadline as deadline %}
|
||||
{% include "book_panel.html" %}
|
||||
{% endwith %}{% endwith %}{% endwith %}
|
||||
{% endfor %}
|
||||
<div class="spacer"></div>
|
||||
|
||||
<h3 class="featured_books">Most Wished</h3>
|
||||
{% for work in most_wished %}
|
||||
{% with work.googlebooks_id as googlebooks_id %}
|
||||
{% with "ACTIVE" as status %}
|
||||
{% with work.last_campaign.deadline as deadline %}
|
||||
{% include "book_panel.html" %}
|
||||
{% endwith %}{% endwith %}{% endwith %}
|
||||
{% endfor %}
|
||||
<div class="spacer"></div>
|
||||
|
||||
<div class="js-main-container-inner">
|
||||
<div id="js-maincontainer-bot-block">
|
||||
<div id="js-search">
|
||||
<label>What book would you give to the world? </label>
|
||||
<form action="{% url search %}" method="get">
|
||||
<input type="text" id="watermark" onfocus="imgfocus()" onblur="imgblur(0)" size="25" class="inputbox" name="q" value="{{ q }}">
|
||||
<input type="submit" class="greenbutton" value="Search">
|
||||
</form>
|
||||
<label>What book would you give to the world? </label>
|
||||
<form action="{% url search %}" method="get">
|
||||
<input type="text" id="watermark" onfocus="imgfocus()" onblur="imgblur(0)" size="25" class="inputbox" name="q" value="{{ q }}">
|
||||
<input type="submit" class="greenbutton" value="Search">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="js-maincontainer-faq">
|
||||
<div class="js-maincontainer-faq-inner">
|
||||
Questions? Read our <a href="/faq/">general FAQ</a> or <a href="/faq/rightsholders/">FAQ for rights holders</a>.
|
||||
<div class="js-maincontainer-faq-inner">
|
||||
Questions? Read our <a href="/faq/">general FAQ</a> or <a href="/faq/rightsholders/">FAQ for rights holders</a>.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="js-rightcol">
|
||||
<div class="js-rightcol-padd">
|
||||
|
|
|
@ -139,6 +139,16 @@ def home(request, landing=False):
|
|||
if request.user.is_authenticated() and landing == False:
|
||||
return HttpResponseRedirect(reverse('supporter',
|
||||
args=[request.user.username]))
|
||||
|
||||
"""
|
||||
use campaigns instead of works so that we can order by amount left,
|
||||
drive interest toward most-nearly-successful
|
||||
"""
|
||||
top_campaigns = models.Campaign.objects.filter(status="ACTIVE").order_by('left')[:4]
|
||||
|
||||
most_wished = models.Work.objects.order_by('-wishes')[:4]
|
||||
|
||||
unglued_books = models.Work.objects.filter(campaigns__status="SUCCESSFUL").order_by('-campaigns__deadline')
|
||||
|
||||
"""
|
||||
get various recent types of site activity
|
||||
|
@ -156,7 +166,7 @@ def home(request, landing=False):
|
|||
)[:10]
|
||||
|
||||
"""
|
||||
for each event, we'll be passing its id and type to the template
|
||||
for each event, we'll be passing its object and type to the template
|
||||
(and preserving its date for sorting purposes)
|
||||
"""
|
||||
latest_comments_tuple = map(
|
||||
|
@ -173,7 +183,10 @@ def home(request, landing=False):
|
|||
lambda x: (x.created, x, "wish"),
|
||||
latest_wishes
|
||||
)
|
||||
|
||||
|
||||
"""
|
||||
merge latest actions into a single list, sorted by date, to loop through in template
|
||||
"""
|
||||
latest_actions = sorted(
|
||||
chain(latest_comments_tuple, latest_pledges_tuple, latest_wishes_tuple),
|
||||
key=lambda instance: instance[0],
|
||||
|
@ -185,7 +198,9 @@ def home(request, landing=False):
|
|||
else:
|
||||
events = latest_actions[:6]
|
||||
|
||||
return render(request, 'home.html', {'suppress_search_box': True, 'events': events})
|
||||
return render(request, 'home.html', {
|
||||
'suppress_search_box': True, 'events': events, 'top_campaigns': top_campaigns, 'unglued_books': unglued_books, 'most_wished': most_wished
|
||||
})
|
||||
|
||||
def stub(request):
|
||||
path = request.path[6:] # get rid of /stub/
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -292,6 +292,20 @@ h3.module-title {
|
|||
height:134px;
|
||||
}
|
||||
|
||||
h3.featured_books {
|
||||
clear: both;
|
||||
color: white;
|
||||
background: @bright-blue;
|
||||
.border-radius(10px, 10px, 0, 0);
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.spacer {
|
||||
height: 15px;
|
||||
width: 100%;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#footer {
|
||||
clear: both;
|
||||
margin-top:30px;
|
||||
|
|
Loading…
Reference in New Issue