pull/1/head
Andromeda Yelton 2012-04-04 08:52:50 -04:00
commit 903356cbd6
8 changed files with 49 additions and 25 deletions

View File

@ -186,8 +186,6 @@ class Campaign(models.Model):
active_claim = self.work.claim.filter(status="active")[0] active_claim = self.work.claim.filter(status="active")[0]
ungluers = self.work.wished_by() ungluers = self.work.wished_by()
notification.queue(ungluers, "active_campaign", {'campaign':self, 'active_claim':active_claim}, True) notification.queue(ungluers, "active_campaign", {'campaign':self, 'active_claim':active_claim}, True)
#import regluit.core.tasks as tasks
#tasks.emit_notifications().delay()
return self return self

View File

@ -1,3 +1,4 @@
import re
import json import json
import requests import requests
import regluit.core.isbn import regluit.core.isbn
@ -32,7 +33,9 @@ def gluejar_search(q, user_ip='69.243.24.29', page=1):
# cover image # cover image
if v.has_key('imageLinks'): if v.has_key('imageLinks'):
r['cover_image_thumbnail'] = v['imageLinks'].get('thumbnail', "") url = v['imageLinks'].get('thumbnail', "")
url = re.sub(r'http://bks[0-9]+\.books\.google\.com', 'https://encrypted.google.com', url)
r['cover_image_thumbnail'] = url
else: else:
r['cover_image_thumbnail'] = "/static/images/generic_cover_larger.png" r['cover_image_thumbnail'] = "/static/images/generic_cover_larger.png"

View File

@ -83,7 +83,5 @@ def notify_comment(comment, request, **kwargs):
other_wishers = comment.content_object.wished_by().exclude(id=comment.user.id).exclude(id__in=other_commenters) other_wishers = comment.content_object.wished_by().exclude(id=comment.user.id).exclude(id__in=other_commenters)
notification.queue(other_commenters, "coment_on_commented", {'comment':comment}, True) notification.queue(other_commenters, "coment_on_commented", {'comment':comment}, True)
notification.queue(other_wishers, "wishlist_comment", {'comment':comment}, True) notification.queue(other_wishers, "wishlist_comment", {'comment':comment}, True)
# import regluit.core.tasks as tasks
# tasks.emit_notifications().delay()
comment_was_posted.connect(notify_comment) comment_was_posted.connect(notify_comment)

View File

@ -302,6 +302,7 @@ class SearchTests(TestCase):
self.assertTrue(r.has_key('author')) self.assertTrue(r.has_key('author'))
self.assertTrue(r.has_key('description')) self.assertTrue(r.has_key('description'))
self.assertTrue(r.has_key('cover_image_thumbnail')) self.assertTrue(r.has_key('cover_image_thumbnail'))
self.assertTrue(r['cover_image_thumbnail'].startswith('https'))
self.assertTrue(r.has_key('publisher')) self.assertTrue(r.has_key('publisher'))
self.assertTrue(r.has_key('isbn_13')) self.assertTrue(r.has_key('isbn_13'))
self.assertTrue(r.has_key('googlebooks_id')) self.assertTrue(r.has_key('googlebooks_id'))

View File

@ -131,6 +131,18 @@ class OpenCampaignForm(forms.ModelForm):
fields = 'name', 'work', 'managers' fields = 'name', 'work', 'managers'
widgets = { 'work': forms.HiddenInput } widgets = { 'work': forms.HiddenInput }
class EditManagersForm(forms.ModelForm):
managers = AutoCompleteSelectMultipleField(
OwnerLookup,
label='Campaign Managers',
widget=AutoCompleteSelectMultipleWidget(OwnerLookup),
required=True,
)
class Meta:
model = Campaign
fields = ('id', 'managers')
widgets = { 'id': forms.HiddenInput }
class CustomPremiumForm(forms.ModelForm): class CustomPremiumForm(forms.ModelForm):
class Meta: class Meta:

View File

@ -38,7 +38,7 @@ Any questions not covered here? Please email us at <a href="mailto:rights@gluej
<h2>Works You Have Claimed</h2> <h2>Works You Have Claimed</h2>
<dl> <dl>
{% for claim in claims %} {% for claim in claims %}
<dt>Title: <a href="{% url work work_id=claim.work.id %}">{{claim.work.title }}</a></dt> <dt>Title: <a href="{% url work work_id=claim.work.id %}">{{claim.work.title }}</a>&nbsp;&nbsp;&nbsp;(work #{{ claim.work.id }})</dt>
<dd>Author: {{claim.work.author }} <dd>Author: {{claim.work.author }}
<br />On Behalf of: {{ claim.rights_holder.rights_holder_name }} <br />On Behalf of: {{ claim.rights_holder.rights_holder_name }}
<br />PSA #: {{ claim.rights_holder.id }} <br />PSA #: {{ claim.rights_holder.id }}
@ -65,6 +65,10 @@ Any questions not covered here? Please email us at <a href="mailto:rights@gluej
Name: Your campaign, "{{ campaign.name }}", is {{ campaign.status }}<br /> Name: Your campaign, "{{ campaign.name }}", is {{ campaign.status }}<br />
Created: {{ campaign.created }}<br /> Created: {{ campaign.created }}<br />
Manager(s): {% for user in campaign.managers.all %} <a href="{% url supporter user.username %}">{{ user.username }} </a> {% endfor %} Manager(s): {% for user in campaign.managers.all %} <a href="{% url supporter user.username %}">{{ user.username }} </a> {% endfor %}
<form method="POST" action="#">{% csrf_token %}
Add/Remove Managers: {{ campaign.edit_managers_form.managers }}{{ campaign.edit_managers_form.managers.errors }}
<input type="submit" name="edit_managers_{{campaign.id}}" value="Save Managers" id="submit">
</form>
</div> </div>
<div> <div>
<a href="{% url manage_campaign campaign.id %}" class="manage">Manage This Campaign</a> <a href="{% url manage_campaign campaign.id %}" class="manage">Manage This Campaign</a>
@ -81,7 +85,7 @@ Any questions not covered here? Please email us at <a href="mailto:rights@gluej
<h2>Rights Holders That You Administer</h2> <h2>Rights Holders That You Administer</h2>
<dl> <dl>
{% for rights_holder in request.user.rights_holder.all %} {% for rights_holder in request.user.rights_holder.all %}
<dt>Name: {{ rights_holder.rights_holder_name }}</dt> <dt>Name: {{ rights_holder.rights_holder_name }}&nbsp;&nbsp;&nbsp;(rights holder #{{ rights_holder.id }})</dt>
<dd>PSA #: {{ rights_holder.id }} <dd>PSA #: {{ rights_holder.id }}
<br />contact email: {{ rights_holder.email }}</dd> <br />contact email: {{ rights_holder.email }}</dd>
{% endfor %} {% endfor %}

View File

@ -11,7 +11,7 @@
<script type="text/javascript" src="{{ jquery_ui_home }}"></script> <script type="text/javascript" src="{{ jquery_ui_home }}"></script>
<script type="text/javascript" src="/static/js/wishlist.js"></script> <script type="text/javascript" src="/static/js/wishlist.js"></script>
<script type="text/javascript" src="/static/js/tabs4.js"></script> <script type="text/javascript" src="/static/js/tabs4.js"></script>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
<script type="text/javascript" src="/static/js/counter.js"></script> <script type="text/javascript" src="/static/js/counter.js"></script>
<script> <script>
@ -180,7 +180,8 @@ $j(document).ready(function(){
<ul class="tabs"> <ul class="tabs">
<li class="tabs1 {% if activetab == '1' %}active{% endif %}"><a href="#">{% if status == 'ACTIVE' %}Campaign{% else %}Description{% endif %}</a></li> <li class="tabs1 {% if activetab == '1' %}active{% endif %}"><a href="#">{% if status == 'ACTIVE' %}Campaign{% else %}Description{% endif %}</a></li>
<li class="tabs2 {% if activetab == '2' %}active{% endif %}"><a href="#">Comments {% if comment_count > 0 %}({{ comment_count }}){% endif %}</a></li> <li class="tabs2 {% if activetab == '2' %}active{% endif %}"><a href="#">Comments {% if comment_count > 0 %}({{ comment_count }}){% endif %}</a></li>
<li class="tabs3 {% if activetab == '3' %}active{% endif %}" id="supporters"><a href="#">Supporters {% if wishers > 0 %}({{ wishers }}){% endif %}</a></li> {# the number of supporters currently commented out because they are overflowing the tab space #}
<li class="tabs3 {% if activetab == '3' %}active{% endif %}" id="supporters"><a href="#">Supporters {# {% if wishers > 0 %}({{ wishers }}){% endif %} #}</a></li>
<li class="tabs4 {% if activetab == '4' %}active{% endif %}"><a href="#">Rights</a></li> <li class="tabs4 {% if activetab == '4' %}active{% endif %}"><a href="#">Rights</a></li>
</ul> </ul>

View File

@ -45,7 +45,7 @@ from regluit.core.goodreads import GoodreadsClient
from regluit.frontend.forms import UserData, ProfileForm, CampaignPledgeForm, GoodreadsShelfLoadingForm from regluit.frontend.forms import UserData, ProfileForm, CampaignPledgeForm, GoodreadsShelfLoadingForm
from regluit.frontend.forms import RightsHolderForm, UserClaimForm, LibraryThingForm, OpenCampaignForm from regluit.frontend.forms import RightsHolderForm, UserClaimForm, LibraryThingForm, OpenCampaignForm
from regluit.frontend.forms import ManageCampaignForm, DonateForm, CampaignAdminForm, EmailShareForm, FeedbackForm from regluit.frontend.forms import ManageCampaignForm, DonateForm, CampaignAdminForm, EmailShareForm, FeedbackForm
from regluit.frontend.forms import EbookForm, CustomPremiumForm from regluit.frontend.forms import EbookForm, CustomPremiumForm, EditManagersForm
from regluit.payment.manager import PaymentManager from regluit.payment.manager import PaymentManager
from regluit.payment.models import Transaction from regluit.payment.models import Transaction
from regluit.payment.parameters import TARGET_TYPE_CAMPAIGN, TARGET_TYPE_DONATION, PAYMENT_TYPE_AUTHORIZATION from regluit.payment.parameters import TARGET_TYPE_CAMPAIGN, TARGET_TYPE_DONATION, PAYMENT_TYPE_AUTHORIZATION
@ -809,6 +809,13 @@ def rh_tools(request):
for campaign in claim.campaigns: for campaign in claim.campaigns:
if campaign.status in ['ACTIVE','INITIALIZED']: if campaign.status in ['ACTIVE','INITIALIZED']:
claim.can_open_new=False claim.can_open_new=False
if campaign.status == 'ACTIVE':
if request.method == 'POST' and request.POST.has_key('edit_managers_%s'% campaign.id) :
campaign.edit_managers_form=EditManagersForm( instance=campaign, data=request.POST, prefix=campaign.id)
if campaign.edit_managers_form.is_valid():
campaign.edit_managers_form.save()
else:
campaign.edit_managers_form=EditManagersForm(instance=campaign, prefix=campaign.id)
if claim.status == 'active' and claim.can_open_new: if claim.status == 'active' and claim.can_open_new:
if request.method == 'POST' and int(request.POST['work']) == claim.work.id : if request.method == 'POST' and int(request.POST['work']) == claim.work.id :
claim.campaign_form = OpenCampaignForm(request.POST) claim.campaign_form = OpenCampaignForm(request.POST)