user now sees pledged indicator rather than remove-wishlist option for pledged works

pull/1/head
Andromeda Yelton 2012-01-02 10:59:00 -05:00
parent 1f29f7538d
commit fb6d715429
3 changed files with 12 additions and 2 deletions

View File

@ -196,6 +196,7 @@ class Campaign(models.Model):
return self
def supporters(self):
"""nb: returns (distinct) supporter IDs, not supporter objects"""
translist = self.transactions().values_list('user', flat=True).distinct()
return translist

View File

@ -90,6 +90,11 @@
</div>
<div class="listview author {{ work.author }}">{{ work.author }}</div>
</div>
{% if request.user.id in work.last_campaign.supporters %}
<div class="listview panelfront side1 on-wishlist">
<span>Pledged!</span>
</div>
{% else %}
{% ifequal supporter request.user %}
<div class="listview panelfront side1 remove-wishlist">
<span id="{{ work.id }}">Remove This</span>
@ -106,7 +111,7 @@
<div class="listview panelfront side1 add-wishlist">
<span id="{{ googlebooks_id }}">Add to Wishlist</span>
</div>
{% endif %}{% endif %}{% endifequal %}
{% endif %}{% endif %}{% endifequal %}{% endif %}
<div class="listview panelfront side1 booklist-status">
<span class="booklist-status-label">Status:&nbsp;</span><span class="booklist-status-text">{{ status }}</span>
</div>

View File

@ -112,6 +112,10 @@ jQuery(document).ready(function(){
<div class="create-account">
<span title="{% url work work.id %}">Login to Add</span>
</div>
{% else %}{% if request.user.id in work.last_campaign.supporters %}
<div class="add-wishlist">
<span class="on-wishlist">Pledged!</span>
</div>
{% else %}{% if work in request.user.wishlist.works.all %}
<div class="remove-wishlist-workpage">
<span id="{{ work.id }}">Remove This</span>
@ -120,7 +124,7 @@ jQuery(document).ready(function(){
<div class="add-wishlist">
<span id="{{ work.googlebooks_id }}">Add to Wishlist</span>
</div>
{% endif %}{% endif %}
{% endif %}{% endif %}{% endif %}
</div>
</div>
</div>