Merge branch 'master' of github.com:Gluejar/regluit into goodreads

pull/1/head
Raymond Yee 2011-11-18 06:15:06 -08:00
commit 3fcc1b9947
9 changed files with 276 additions and 222 deletions

View File

@ -162,6 +162,10 @@ class Work(models.Model):
title = models.CharField(max_length=1000)
openlibrary_id = models.CharField(max_length=50, null=True)
def __init__(self, *args, **kwargs):
self._last_campaign = None
super(Work, self).__init__(*args, **kwargs)
def cover_image_small(self):
return self.editions.all()[0].cover_image_small()
@ -169,21 +173,22 @@ class Work(models.Model):
return self.editions.all()[0].cover_image_thumbnail()
def author(self):
authorlist = self.editions.all()[0].authors.all()
if authorlist.count() == 1:
myauthor = authorlist[0].name
elif authorlist.count() > 1:
myauthor = authorlist[0].name + ' et al.'
else:
myauthor = ''
return myauthor
authors = list(Author.objects.filter(editions__work=self).all())
if len(authors) == 1:
return authors[0].name
elif len(authors) > 1:
return authors[0].name + ' et al.'
return ''
def last_campaign(self):
# stash away the last campaign to prevent repeated lookups
if hasattr(self, '_last_campaign'):
return self._last_campaign
try:
last = self.campaigns.order_by('-created')[0]
except:
last = None
return last
self._last_campaign = self.campaigns.order_by('-created')[0]
except IndexError:
pass
return self._last_campaign
def last_campaign_status(self):
campaign = self.last_campaign()
@ -236,10 +241,9 @@ class Work(models.Model):
return self.first_ebook('epub')
def first_ebook(self, ebook_format=None):
for edition in self.editions.all():
for ebook in edition.ebooks.all():
if ebook_format == None or ebook.format == ebook_format:
return ebook
for ebook in Ebook.objects.filter(edition__work=self,
format=ebook_format):
return ebook
return None
def wished_by(self):

View File

@ -9,6 +9,7 @@
cd /opt/regluit
sudo -u ubuntu /usr/bin/git pull
source ENV/bin/activate
pip install -r requirements.pip
django-admin.py syncdb --migrate --settings regluit.settings.prod
sudo /etc/init.d/apache2 restart
sudo /etc/init.d/celeryd restart

View File

@ -1,4 +1,5 @@
{% extends "base.html" %}
{% load endless %}
{% block title %} — {{ supporter.username }}{% endblock %}
@ -231,7 +232,8 @@ how do I integrate the your wishlist thing with the tabs thing?
Nudge, nudge, say no more.
{% endifequal %}
{% else %}
{% for work in wishlist.works.all %}
{% paginate 20 works %}
{% for work in works %}
<!-- classify which tab depending on work.last_campaign_status -->
{% if work.last_campaign_status == 'SUCCESSFUL' %}
<div class="listview tabs tabs-1">
@ -350,6 +352,11 @@ how do I integrate the your wishlist thing with the tabs thing?
</div>
</div>
{% endfor %}
<br>
<hr>
<div class="pagination content-block-heading">
{% show_pages %}
</div>
{% endifequal %}
</div>
</div>

View File

@ -160,6 +160,7 @@ def rh_admin(request):
def supporter(request, supporter_username, template_name):
supporter = get_object_or_404(User, username=supporter_username)
wishlist = supporter.wishlist
works = wishlist.works.all()
backed = 0
backing = 0
transet = Transaction.objects.all().filter(user = supporter)
@ -238,6 +239,7 @@ def supporter(request, supporter_username, template_name):
context = {
"supporter": supporter,
"wishlist": wishlist,
"works": works,
"backed": backed,
"backing": backing,
"wished": wished,

View File

@ -16,3 +16,4 @@ oauth2
mechanize
pyzotero
freebase
django-endless-pagination

View File

@ -108,6 +108,7 @@ INSTALLED_APPS = (
'social_auth',
'tastypie',
'djcelery',
'endless_pagination',
)
# A sample logging configuration. The only tangible logging

View File

@ -296,3 +296,21 @@ div.content-block-content .cols3 .column {
#footer .column li a {
color: #6994a3;
}
.pagination {
width: 100%;
text-align: center;
margin-top: 20px;
}
.pagination .endless_page_link {
font-size: 16pt;
border: thin #eeeeee solid;
font-weight: normal;
margin: 5px;
}
.pagination .endless_page_current {
font-size: 16pt;
border: thin #eeeeee solid;
font-weight: normal;
margin: 5px;
background-color: #edf3f4;
}

View File

@ -3,12 +3,12 @@ which overrides display: none in the stylesheet. Sneaky! */
$(document).ready(function(){
$('#toggle-list').click(function(){
$('.panelview').addClass("listview").removeClass("panelview");
$j(this).css({opacity: 1});
$(this).css({opacity: 1});
$('#toggle-panel').css({opacity: .2});
});
$('#toggle-panel').click(function(){
$('.listview').addClass("panelview").removeClass("listview");
$j(this).css({opacity: 1});
$(this).css({opacity: 1});
$('#toggle-list').css({opacity: .2});
});
});
});

View File

@ -4,22 +4,22 @@
/* Local variables */
.utilityheaders {
text-transform:uppercase;
color:@text-blue;
font-size:12px;
display:block;
text-transform:uppercase;
color:@text-blue;
font-size:12px;
display:block;
}
.utilitylinks (@topbottom, @leftright) {
padding:@topbottom @leftright;
a {
color:@medium-blue;
}
padding:@topbottom @leftright;
a {
color:@medium-blue;
}
}
/* Page-wide elements */
html, body {
/* Necessary to make footer stretch to bottom of page */
/* Necessary to make footer stretch to bottom of page */
height:100%;
}
@ -33,46 +33,46 @@ body{
}
a {
font-weight:bold;
font-size:13px;
text-decoration:none;
cursor:pointer;
color: @medium-blue;
font-weight:bold;
font-size:13px;
text-decoration:none;
cursor:pointer;
color: @medium-blue;
}
img {
border:none;
border:none;
}
h2 {
&.content-heading {
padding:15px;
margin:0;
font-size:19px;
font-weight:normal;
color:@text-blue;
float:left;
width:50%;
span {
font-style:italic;
}
}
&.content-heading {
padding:15px;
margin:0;
font-size:19px;
font-weight:normal;
color:@text-blue;
float:left;
width:50%;
span {
font-style:italic;
}
}
}
h3 {
&.jsmod-title {
background:url(@background-header) 0 0 no-repeat;
padding:0;
margin:0;
height:73px;
span {
font-size:17px;
color:#fff;
padding:26px 40px 27px 20px;
display:block;
}
&.jsmod-title {
background:url(@background-header) 0 0 no-repeat;
padding:0;
margin:0;
height:73px;
span {
font-size:17px;
color:#fff;
padding:26px 40px 27px 20px;
display:block;
}
}
}
@ -95,170 +95,170 @@ ul.menu{
}
a.readon {
background:url(@background-header) 100% -72px no-repeat;
color:#fff;
text-transform:capitalize;
display:block;
float:right;
font-size:13px;
font-weight:bold;
background:url(@background-header) 100% -72px no-repeat;
color:#fff;
text-transform:capitalize;
display:block;
float:right;
font-size:13px;
font-weight:bold;
span {
background:url(@background-header) -770px -108px no-repeat;
margin-right:34px;
padding:0 5px 0 20px;
.height(36px);
display:block;
}
span {
background:url(@background-header) -770px -108px no-repeat;
margin-right:34px;
padding:0 5px 0 20px;
.height(36px);
display:block;
}
}
/* Header section */
#js-header {
height:90px;
height:90px;
}
.js-logo {
float:left;
padding-top:10px;
a {
img { border: none;}
}
float:left;
padding-top:10px;
a {
img { border: none;}
}
}
.js-topmenu {
float:right;
padding-top:25px;
float:right;
padding-top:25px;
ul {
li {
float:left;
padding:0 10px;
a {
color:@text-blue;
.header-text;
}
span#welcome {
color:@green;
.header-text;
}
&.last {
a {
background: url(@background-header) right top no-repeat;
span {
background:url(@background-header) -770px -36px no-repeat;
margin-right:29px;
display:block;
padding:0 5px 0 15px;
}
}
}
}
}
ul {
li {
float:left;
padding:0 10px;
a {
color:@text-blue;
.header-text;
}
span#welcome {
color:@green;
.header-text;
}
&.last {
a {
background: url(@background-header) right top no-repeat;
span {
background:url(@background-header) -770px -36px no-repeat;
margin-right:29px;
display:block;
padding:0 5px 0 15px;
}
}
}
}
}
}
.js-search {
float:left;
padding-top:25px;
margin-left: 81px;
input {
float: left;
}
.inputbox {
padding:0 0 0 15px;
margin:0;
border:none;
outline: none;
background:url(@background-header) -645px -180px;
.height(36px);
float: left;
color:@medium-blue;
}
.button {
background:url(@background-header) 100% -144px no-repeat;
padding:0;
margin:0;
width:40px;
height:36px;
display:block;
border:none;
text-indent:-10000px;
cursor:pointer;
}
float:left;
padding-top:25px;
margin-left: 81px;
input {
float: left;
}
.inputbox {
padding:0 0 0 15px;
margin:0;
border:none;
outline: none;
background:url(@background-header) -645px -180px;
.height(36px);
float: left;
color:@medium-blue;
}
.button {
background:url(@background-header) 100% -144px no-repeat;
padding:0;
margin:0;
width:40px;
height:36px;
display:block;
border:none;
text-indent:-10000px;
cursor:pointer;
}
}
.js-search-inner {
float:right;
float:right;
}
/* Explore column */
#js-leftcol {
float:left;
width:235px;
margin-bottom: 20px;
a {
font-weight:normal;
&:hover{
text-decoration:underline;
}
}
.jsmod-content {
border:1px solid @pale-blue;
margin-left:10px;
.border-radius(0, 0, 10px, 10px);
}
float:left;
width:235px;
margin-bottom: 20px;
a {
font-weight:normal;
&:hover{
text-decoration:underline;
}
}
.jsmod-content {
border:1px solid @pale-blue;
margin-left:10px;
.border-radius(0, 0, 10px, 10px);
}
ul {
&.level1 > li > a {
border-bottom:1px solid @pale-blue;
border-top:1px solid @pale-blue;
.utilityheaders;
padding:10px;
}
ul {
&.level1 > li > a {
border-bottom:1px solid @pale-blue;
border-top:1px solid @pale-blue;
.utilityheaders;
padding:10px;
}
&.level2 li {
.utilitylinks(5px, 10px);
}
}
&.level2 li {
.utilitylinks(5px, 10px);
}
}
}
/* Main content area: top*/
#js-topsection {
padding:15px 0; overflow:hidden;
padding:15px 0; overflow:hidden;
}
.js-topnews {
float:left;
width:100%;
float:left;
width:100%;
}
.js-topnews1 {
background:url("@{image-base}header/header-m.png") 0 0 repeat-y;
background:url("@{image-base}header/header-m.png") 0 0 repeat-y;
}
.js-topnews2 {
background:url("@{image-base}header/header-t.png") 0 0 no-repeat;
background:url("@{image-base}header/header-t.png") 0 0 no-repeat;
}
.js-topnews3 {
background:url("@{image-base}header/header-b.png") 0 100% no-repeat;
display:block;
overflow:hidden;
padding:10px;
background:url("@{image-base}header/header-b.png") 0 100% no-repeat;
display:block;
overflow:hidden;
padding:10px;
}
/* Main content area: main*/
#js-maincol-fr {
float:right;
width:725px;
float:right;
width:725px;
}
div.content-block {
@ -269,50 +269,70 @@ div.content-block {
}
.content-block-heading a.block-link {
float:right;
padding:15px;
font-size:11px;
color:@text-blue;
text-decoration:underline;
font-weight:normal;
float:right;
padding:15px;
font-size:11px;
color:@text-blue;
text-decoration:underline;
font-weight:normal;
}
div.content-block-content {
width:100%;
overflow:hidden;
padding-left: 10px;
.cols3 .column {
width:33.33%;
float:left;
}
width:100%;
overflow:hidden;
padding-left: 10px;
.cols3 .column {
width:33.33%;
float:left;
}
}
/* Footer */
#footer {
background-color: @pale-blue;
clear: both;
.utilityheaders;
padding: 15px 0px 45px 0px;
margin-top: 15px;
overflow: hidden;
.column {
float:left;
width: 25%;
padding-top:5px;
ul {
padding-top:5px;
margin-left:0;
padding-left:0;
}
li {
.utilitylinks(5px, 0);
text-transform: none;
list-style: none;
margin-left: 0;
}
}
}
background-color: @pale-blue;
clear: both;
.utilityheaders;
padding: 15px 0px 45px 0px;
margin-top: 15px;
overflow: hidden;
.column {
float:left;
width: 25%;
padding-top:5px;
ul {
padding-top:5px;
margin-left:0;
padding-left:0;
}
li {
.utilitylinks(5px, 0);
text-transform: none;
list-style: none;
margin-left: 0;
}
}
}
.pagination {
width: 100%;
text-align: center;
margin-top: 20px;
.endless_page_link {
font-size: 16pt;
border: thin #eeeeee solid;
font-weight: normal;
margin: 5px;
}
.endless_page_current {
font-size: 16pt;
border: thin #eeeeee solid;
font-weight: normal;
margin: 5px;
background-color:@pale-blue;
}
}