tweaking email sharing

pull/1/head
Andromeda Yelton 2012-01-02 09:39:11 -05:00
parent a2ebda17b1
commit 03d94bfbc5
3 changed files with 5 additions and 3 deletions

View File

@ -193,10 +193,10 @@ class CampaignAdminForm(forms.Form):
pass
class EmailShareForm(forms.Form):
recipient = forms.EmailField()
sender = forms.EmailField(widget=forms.HiddenInput())
subject = forms.CharField(max_length=100)
message = forms.CharField(widget=forms.Textarea())
sender = forms.EmailField()
recipient = forms.EmailField()
# allows us to return user to original page by passing it as hidden form input
# we can't rely on POST or GET since the emailshare view handles both
# and may iterate several times as it catches user errors, losing URL info

View File

@ -235,7 +235,7 @@ jQuery(document).ready(function(){
<ul class="social menu">
<a href="https://www.facebook.com/sharer.php?u={{request.build_absolute_uri}}{{ request.path|urlencode:"" }}"><li class="facebook first"><span>Facebook</span></li></a>
<a href="https://twitter.com/intent/tweet?url={{request.build_absolute_uri}}{{ request.path|urlencode:"" }}&text=I'm%20ungluing%20{{ work.title|urlencode }}%20at%20%40unglueit"><li class="twitter"><span>Twitter</span></li></a>
<a href="{% url emailshare %}?next={{request.build_absolute_uri|urlencode:""}}"><li class="email"><span>Email</span></li></a>
{% if request.user.is_authenticated %}<a href="{% url emailshare %}?next={{request.build_absolute_uri|urlencode:""}}"><li class="email"><span>Email</span></li></a>{% endif %}
<a href="#" id="embed"><li class="embed"><span>Embed</span></li></a>
<div id="widgetcode">Copy/paste this into your site:<br /><textarea rows="7" cols="22">&lt;iframe src="{{request.build_absolute_uri}}/api/widget/{{work.editions.all.0.isbn_13}}/" width="152" height="325" frameborder="0"&gt;&lt;/iframe&gt;</textarea></div>
</ul>

View File

@ -18,6 +18,7 @@ from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.core.exceptions import ObjectDoesNotExist
from django.core.mail import send_mail
from django.contrib import messages
from django.forms import Select
from django.forms.models import modelformset_factory
from django.http import HttpResponseRedirect
@ -1017,6 +1018,7 @@ def work_goodreads(request, work_id):
url = "http://www.goodreads.com/search?" + q
return HttpResponseRedirect(url)
@login_required
def emailshare(request):
if request.method == 'POST':
form=EmailShareForm(request.POST)