From 6e801e684102748e8938a2f32e9f9c204645cd6a Mon Sep 17 00:00:00 2001 From: Andromeda Yelton Date: Tue, 26 Mar 2013 14:55:50 -0400 Subject: [PATCH] adding bookish activity to main content area --- frontend/templates/home.html | 52 +++++++++++++++++++++++++++-------- frontend/views.py | 21 ++++++++++++-- static/css/landingpage2.css | 2 +- static/less/landingpage2.less | 14 ++++++++++ 4 files changed, 73 insertions(+), 16 deletions(-) diff --git a/frontend/templates/home.html b/frontend/templates/home.html index 8a594b68..a24033d5 100755 --- a/frontend/templates/home.html +++ b/frontend/templates/home.html @@ -47,25 +47,53 @@ function put_un_in_cookie2(){
-
-
- -
+ + {% 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 %} +
+ + + {% 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 %} +
+ + + {% 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 %} +
+ +
-
- Questions? Read our general FAQ or FAQ for rights holders. +
+ Questions? Read our general FAQ or FAQ for rights holders.
-
+
diff --git a/frontend/views.py b/frontend/views.py index 9a29f180..59574c85 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -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/ diff --git a/static/css/landingpage2.css b/static/css/landingpage2.css index 2c261770..c73d5652 100644 --- a/static/css/landingpage2.css +++ b/static/css/landingpage2.css @@ -1 +1 @@ -.header-text{height:36px;line-height:36px;display:block;text-decoration:none;font-weight:bold;letter-spacing:-0.05em}.panelborders{border-width:1px 0;border-style:solid none;border-color:#fff}.roundedspan{border:1px solid #d4d4d4;-moz-border-radius:7px;-webkit-border-radius:7px;border-radius:7px;padding:1px;color:#fff;margin:0 8px 0 0;display:inline-block}.roundedspan>span{padding:7px 7px;min-width:15px;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;text-align:center;display:inline-block}.roundedspan>span .hovertext{display:none}.roundedspan>span:hover .hovertext{display:inline}.mediaborder{padding:5px;border:solid 5px #edf3f4}.actionbuttons{width:auto;height:36px;line-height:36px;background:#8dc63f;-moz-border-radius:32px;-webkit-border-radius:32px;border-radius:32px;color:white;cursor:pointer;font-size:13px;font-weight:bold;padding:0 15px;border:0;margin:5px 0}.errors{-moz-border-radius:16px;-webkit-border-radius:16px;border-radius:16px;border:solid #e35351 3px;clear:both;width:90%;height:auto;line-height:16px;padding:7px 0;font-weight:bold;font-size:13px;text-align:center}.errors li{list-style:none;border:0}.header-text{height:36px;line-height:36px;display:block;text-decoration:none;font-weight:bold;letter-spacing:-0.05em}.panelborders{border-width:1px 0;border-style:solid none;border-color:#fff}.roundedspan{border:1px solid #d4d4d4;-moz-border-radius:7px;-webkit-border-radius:7px;border-radius:7px;padding:1px;color:#fff;margin:0 8px 0 0;display:inline-block}.roundedspan>span{padding:7px 7px;min-width:15px;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;text-align:center;display:inline-block}.roundedspan>span .hovertext{display:none}.roundedspan>span:hover .hovertext{display:inline}.mediaborder{padding:5px;border:solid 5px #edf3f4}.actionbuttons{width:auto;height:36px;line-height:36px;background:#8dc63f;-moz-border-radius:32px;-webkit-border-radius:32px;border-radius:32px;color:white;cursor:pointer;font-size:13px;font-weight:bold;padding:0 15px;border:0;margin:5px 0}.errors{-moz-border-radius:16px;-webkit-border-radius:16px;border-radius:16px;border:solid #e35351 3px;clear:both;width:90%;height:auto;line-height:16px;padding:7px 0;font-weight:bold;font-size:13px;text-align:center}.errors li{list-style:none;border:0}.learnmore_block{float:left;width:100%;clear:both;border-top:solid 1px #8ac3d7;margin-top:20px}.learnmore_block .quicktour{width:270px;float:left;font-style:italic;line-height:20px;font-size:13px;margin-top:20px}.learnmore_block .quicktour .highlight{font-weight:bold}.learnmore_block .quicktour.last{padding-right:0;width:270px}.learnmore_block .quicktour.last .signup{color:#8dc63f;font-weight:bold;margin-top:10px}.learnmore_block .quicktour.last .signup img{margin-left:5px;vertical-align:middle;margin-bottom:3px}.learnmore_block .movingrightalong{background:url("/static/images/landingpage/quicktour-arrow.png") no-repeat center;height:100px;width:75px;float:left;margin-top:20px}#block-intro-text div{display:none;line-height:25px;padding-bottom:10px}#block-intro-text div#active{display:inherit}#expandable{display:none}#main-container.main-container-fl .js-main{width:968px;background:#fff url("/static/images/landingpage/container-top.png") top center no-repeat}#js-maincol-fl{padding:30px 30px 0 30px;overflow:hidden}#js-maincol-fl #content-block{background:0;padding:0}#js-maincol-fl #js-main-container{float:left;width:672px}#js-maincol-fl .js-main-container-inner{padding-right:40px}#js-maincol-fl h2.page-heading{margin:0 0 20px 0;color:#3d4e53;font-size:19px;font-weight:bold}#user-block{width:100%;clear:both}#user-block1,.user-block2{float:left}#user-block1{width:70%}#user-block1 #block-intro-text{float:left;width:70%;font-size:19px}#user-block1 a#readon{float:left}.user-block2{color:#6994a3;font-size:13px;line-height:normal;width:30%}.user-block2 .block-inner{float:right;padding-right:0}.user-block2 label{float:left;font-size:19px;height:30px;line-height:30px;color:#3d4e53;padding-right:15px}#js-rightcol,#js-rightcol2{float:right;width:230px}#js-rightcol .jsmodule,#js-rightcol2 .jsmodule{float:left;width:208px;background:#edf3f4;border:1px solid #d6dde0;-moz-border-radius:12px;-webkit-border-radius:12px;border-radius:12px;margin-bottom:10px;padding:0 10px 10px 10px}#js-rightcol .jsmodule.last,#js-rightcol2 .jsmodule.last{border-bottom:0;padding-bottom:10px}#js-rightcol .jsmodule input,#js-rightcol2 .jsmodule input{-moz-border-radius:32px;-webkit-border-radius:32px;border-radius:32px;border:0;height:36px;line-height:36px;width:90%;outline:0;padding-left:16px}#js-rightcol .jsmodule input.signup,#js-rightcol2 .jsmodule input.signup{background:url("/static/images/landingpage/button.png") no-repeat 0 0;border:medium none;color:#FFF;cursor:pointer;display:inline-block;font-weight:bold;font-size:13px;overflow:hidden;padding:0 31px 0 11px;width:111px}#js-rightcol div.button,#js-rightcol2 div.button{padding-top:10px}#js-rightcol label,#js-rightcol2 label{width:100%;display:block;clear:both;padding:10px 0 5px 16px}.google_signup{padding:14px 0}.google_signup div{height:24px;line-height:24px;float:left;padding-left:5px;font-size:15px;display:inline-block}.google_signup img{float:left;height:24px;width:24px}.google_signup div{height:24px;line-height:24px;float:left;padding-left:5px;font-size:15px;display:inline-block}.google_signup img{float:left;height:24px;width:24px}.js-rightcol-padd{padding:0}h3.heading{color:#3d4e53;font-weight:bold}ul.ungluingwhat{list-style:none;padding:0;margin:0 -10px}ul.ungluingwhat li{margin-bottom:7px;background:#fff;padding:10px;display:block;overflow:hidden}ul.ungluingwhat li>span{float:left}ul.ungluingwhat .user-avatar{width:43px}ul.ungluingwhat .user-avatar img{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}ul.ungluingwhat .user-book-info{margin-left:5px;width:160px;word-wrap:break-word;font-size:15px;line-height:19.5px}ul.ungluingwhat .user-book-info a{font-weight:normal}div.typo2{background:#edf3f4;-moz-border-radius:12px;-webkit-border-radius:12px;border-radius:12px;padding:10px;font-style:italic}div.signup_btn{display:block;overflow:hidden}div.signup_btn a{background:url("/static/images/bg.png") no-repeat scroll right top transparent;color:#fff;display:block;font-size:13px;font-weight:bold;height:36px;line-height:36px;letter-spacing:1px;text-decoration:none;text-transform:capitalize;float:left}div.signup_btn a span{background:url("/static/images/bg.png") no-repeat scroll -770px -36px transparent;display:block;margin-right:29px;padding:0 5px 0 15px}.have-content-right-module .item-content{float:left;width:364px;font-size:15px;height:132px;border-bottom:7px solid #8ac3d7}.have-content-right-module .item-content p{margin-bottom:20px;line-height:135%}.have-content-right-module .item-content h2.page-heading{padding-right:97px;line-height:43px;padding-bottom:4px;padding-top:5px}.have-content-right-module .content-right-module{width:268px;float:right}.have-content-right-module .content-right-module h3{color:#8ac3d7;text-transform:uppercase;font-size:24px;font-weight:normal;padding:0;margin:0 0 16px 0}h2.page-heading{color:#3c4e52;font-size:28px!important;font-style:italic;font-weight:normal!important}#js-maincontainer-faq{clear:both;overflow:hidden;margin:15px 0;width:100%}.js-maincontainer-faq-inner{float:right;color:#3d4e53;font-size:15px;padding-right:60px}.js-maincontainer-faq-inner a{font-weight:normal;color:#3d4e53;text-decoration:underline}h3.module-title{padding:10px 0;font-size:19px;font-weight:normal}.landingheader{border-bottom:solid 5px #6994a3;float:left;height:134px}#footer{clear:both;margin-top:30px} \ No newline at end of file +.header-text{height:36px;line-height:36px;display:block;text-decoration:none;font-weight:bold;letter-spacing:-0.05em}.panelborders{border-width:1px 0;border-style:solid none;border-color:#fff}.roundedspan{border:1px solid #d4d4d4;-moz-border-radius:7px;-webkit-border-radius:7px;border-radius:7px;padding:1px;color:#fff;margin:0 8px 0 0;display:inline-block}.roundedspan>span{padding:7px 7px;min-width:15px;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;text-align:center;display:inline-block}.roundedspan>span .hovertext{display:none}.roundedspan>span:hover .hovertext{display:inline}.mediaborder{padding:5px;border:solid 5px #edf3f4}.actionbuttons{width:auto;height:36px;line-height:36px;background:#8dc63f;-moz-border-radius:32px;-webkit-border-radius:32px;border-radius:32px;color:white;cursor:pointer;font-size:13px;font-weight:bold;padding:0 15px;border:0;margin:5px 0}.errors{-moz-border-radius:16px;-webkit-border-radius:16px;border-radius:16px;border:solid #e35351 3px;clear:both;width:90%;height:auto;line-height:16px;padding:7px 0;font-weight:bold;font-size:13px;text-align:center}.errors li{list-style:none;border:0}.header-text{height:36px;line-height:36px;display:block;text-decoration:none;font-weight:bold;letter-spacing:-0.05em}.panelborders{border-width:1px 0;border-style:solid none;border-color:#fff}.roundedspan{border:1px solid #d4d4d4;-moz-border-radius:7px;-webkit-border-radius:7px;border-radius:7px;padding:1px;color:#fff;margin:0 8px 0 0;display:inline-block}.roundedspan>span{padding:7px 7px;min-width:15px;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;text-align:center;display:inline-block}.roundedspan>span .hovertext{display:none}.roundedspan>span:hover .hovertext{display:inline}.mediaborder{padding:5px;border:solid 5px #edf3f4}.actionbuttons{width:auto;height:36px;line-height:36px;background:#8dc63f;-moz-border-radius:32px;-webkit-border-radius:32px;border-radius:32px;color:white;cursor:pointer;font-size:13px;font-weight:bold;padding:0 15px;border:0;margin:5px 0}.errors{-moz-border-radius:16px;-webkit-border-radius:16px;border-radius:16px;border:solid #e35351 3px;clear:both;width:90%;height:auto;line-height:16px;padding:7px 0;font-weight:bold;font-size:13px;text-align:center}.errors li{list-style:none;border:0}.learnmore_block{float:left;width:100%;clear:both;border-top:solid 1px #8ac3d7;margin-top:20px}.learnmore_block .quicktour{width:270px;float:left;font-style:italic;line-height:20px;font-size:13px;margin-top:20px}.learnmore_block .quicktour .highlight{font-weight:bold}.learnmore_block .quicktour.last{padding-right:0;width:270px}.learnmore_block .quicktour.last .signup{color:#8dc63f;font-weight:bold;margin-top:10px}.learnmore_block .quicktour.last .signup img{margin-left:5px;vertical-align:middle;margin-bottom:3px}.learnmore_block .movingrightalong{background:url("/static/images/landingpage/quicktour-arrow.png") no-repeat center;height:100px;width:75px;float:left;margin-top:20px}#block-intro-text div{display:none;line-height:25px;padding-bottom:10px}#block-intro-text div#active{display:inherit}#expandable{display:none}#main-container.main-container-fl .js-main{width:968px;background:#fff url("/static/images/landingpage/container-top.png") top center no-repeat}#js-maincol-fl{padding:30px 30px 0 30px;overflow:hidden}#js-maincol-fl #content-block{background:0;padding:0}#js-maincol-fl #js-main-container{float:left;width:672px}#js-maincol-fl .js-main-container-inner{padding-right:40px}#js-maincol-fl h2.page-heading{margin:0 0 20px 0;color:#3d4e53;font-size:19px;font-weight:bold}#user-block{width:100%;clear:both}#user-block1,.user-block2{float:left}#user-block1{width:70%}#user-block1 #block-intro-text{float:left;width:70%;font-size:19px}#user-block1 a#readon{float:left}.user-block2{color:#6994a3;font-size:13px;line-height:normal;width:30%}.user-block2 .block-inner{float:right;padding-right:0}.user-block2 label{float:left;font-size:19px;height:30px;line-height:30px;color:#3d4e53;padding-right:15px}#js-rightcol,#js-rightcol2{float:right;width:230px}#js-rightcol .jsmodule,#js-rightcol2 .jsmodule{float:left;width:208px;background:#edf3f4;border:1px solid #d6dde0;-moz-border-radius:12px;-webkit-border-radius:12px;border-radius:12px;margin-bottom:10px;padding:0 10px 10px 10px}#js-rightcol .jsmodule.last,#js-rightcol2 .jsmodule.last{border-bottom:0;padding-bottom:10px}#js-rightcol .jsmodule input,#js-rightcol2 .jsmodule input{-moz-border-radius:32px;-webkit-border-radius:32px;border-radius:32px;border:0;height:36px;line-height:36px;width:90%;outline:0;padding-left:16px}#js-rightcol .jsmodule input.signup,#js-rightcol2 .jsmodule input.signup{background:url("/static/images/landingpage/button.png") no-repeat 0 0;border:medium none;color:#FFF;cursor:pointer;display:inline-block;font-weight:bold;font-size:13px;overflow:hidden;padding:0 31px 0 11px;width:111px}#js-rightcol div.button,#js-rightcol2 div.button{padding-top:10px}#js-rightcol label,#js-rightcol2 label{width:100%;display:block;clear:both;padding:10px 0 5px 16px}.google_signup{padding:14px 0}.google_signup div{height:24px;line-height:24px;float:left;padding-left:5px;font-size:15px;display:inline-block}.google_signup img{float:left;height:24px;width:24px}.google_signup div{height:24px;line-height:24px;float:left;padding-left:5px;font-size:15px;display:inline-block}.google_signup img{float:left;height:24px;width:24px}.js-rightcol-padd{padding:0}h3.heading{color:#3d4e53;font-weight:bold}ul.ungluingwhat{list-style:none;padding:0;margin:0 -10px}ul.ungluingwhat li{margin-bottom:7px;background:#fff;padding:10px;display:block;overflow:hidden}ul.ungluingwhat li>span{float:left}ul.ungluingwhat .user-avatar{width:43px}ul.ungluingwhat .user-avatar img{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}ul.ungluingwhat .user-book-info{margin-left:5px;width:160px;word-wrap:break-word;font-size:15px;line-height:19.5px}ul.ungluingwhat .user-book-info a{font-weight:normal}div.typo2{background:#edf3f4;-moz-border-radius:12px;-webkit-border-radius:12px;border-radius:12px;padding:10px;font-style:italic}div.signup_btn{display:block;overflow:hidden}div.signup_btn a{background:url("/static/images/bg.png") no-repeat scroll right top transparent;color:#fff;display:block;font-size:13px;font-weight:bold;height:36px;line-height:36px;letter-spacing:1px;text-decoration:none;text-transform:capitalize;float:left}div.signup_btn a span{background:url("/static/images/bg.png") no-repeat scroll -770px -36px transparent;display:block;margin-right:29px;padding:0 5px 0 15px}.have-content-right-module .item-content{float:left;width:364px;font-size:15px;height:132px;border-bottom:7px solid #8ac3d7}.have-content-right-module .item-content p{margin-bottom:20px;line-height:135%}.have-content-right-module .item-content h2.page-heading{padding-right:97px;line-height:43px;padding-bottom:4px;padding-top:5px}.have-content-right-module .content-right-module{width:268px;float:right}.have-content-right-module .content-right-module h3{color:#8ac3d7;text-transform:uppercase;font-size:24px;font-weight:normal;padding:0;margin:0 0 16px 0}h2.page-heading{color:#3c4e52;font-size:28px!important;font-style:italic;font-weight:normal!important}#js-maincontainer-faq{clear:both;overflow:hidden;margin:15px 0;width:100%}.js-maincontainer-faq-inner{float:right;color:#3d4e53;font-size:15px;padding-right:60px}.js-maincontainer-faq-inner a{font-weight:normal;color:#3d4e53;text-decoration:underline}h3.module-title{padding:10px 0;font-size:19px;font-weight:normal}.landingheader{border-bottom:solid 5px #6994a3;float:left;height:134px}h3.featured_books{clear:both;color:white;background:#8ac3d7;-moz-border-radius:10px 10px 0 0;-webkit-border-radius:10px 10px 0 0;border-radius:10px 10px 0 0;padding:10px}.spacer{height:15px;width:100%;clear:both}#footer{clear:both;margin-top:30px} \ No newline at end of file diff --git a/static/less/landingpage2.less b/static/less/landingpage2.less index bfe40621..5866e875 100644 --- a/static/less/landingpage2.less +++ b/static/less/landingpage2.less @@ -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;