better text for twitter and email sharing

pull/1/head
Andromeda Yelton 2012-03-12 13:18:11 -04:00
parent 2c13104f5d
commit b5c284cc2d
4 changed files with 43 additions and 7 deletions

View File

@ -1,4 +1,23 @@
{% extends "basedocumentation.html" %} {% extends "basedocumentation.html" %}
{% block extra_css %}
<style type="text/css">
#id_subject, #id_recipient {
float: right;
width: 75%;
padding: 2px;
}
#id_message {
width: 75%;
float: right;
}
input[type=submit] {
float: right;
margin: 7px 0px auto 0px;;
}
</style>
{% endblock %}
{% block title %}Pledge{% endblock %} {% block title %}Pledge{% endblock %}
@ -7,7 +26,7 @@
<form method="POST" action="/emailshare/"> <form method="POST" action="/emailshare/">
{% csrf_token %} {% csrf_token %}
{{ form.as_p }} {{ form.as_p }}
<input type="submit" value="Share" /> <div class="spacer"></div><input type="submit" value="Share" />
</form> </form>
{% endblock %} {% endblock %}

View File

@ -259,7 +259,7 @@ there's no tab for seeing ALL my books, only the filters! huh.
<li class="tabs3"><a href="#">Wishlisted</a></li> <li class="tabs3"><a href="#">Wishlisted</a></li>
</ul> </ul>
<span id="rss"><a href="feed" title="RSS feed of {{ supporter }}'s latest wishbooks" alt="RSS feed of {{ supporter }}'s latest wishbooks"><img src="/static/images/feedicons-standard/feed-icon-14x14.png"></a></span> <span id="rss"><a href="feed" title="RSS feed of {{ supporter }}'s latest wishbooks" alt="RSS feed of {{ supporter }}'s latest wishbooks"><img src="/static/images/feedicons-standard/feed-icon-14x14.png">Subscribe</a></span>
{% if not works %} {% if not works %}
{% comment %} {% comment %}

View File

@ -338,7 +338,7 @@ $j(document).ready(function(){
<div class="jsmod-content"> <div class="jsmod-content">
<ul class="social menu"> <ul class="social menu">
<a href="https://www.facebook.com/sharer.php?u={{request.build_absolute_uri|urlencode:"" }}"><li class="facebook first"><span>Facebook</span></li></a> <a href="https://www.facebook.com/sharer.php?u={{request.build_absolute_uri|urlencode:"" }}"><li class="facebook first"><span>Facebook</span></li></a>
<a href="https://twitter.com/intent/tweet?url={{request.build_absolute_uri|urlencode:"" }}&amp;text=I%27m%20ungluing%20{{ work.title|urlencode }}%20at%20%40unglueit"><li class="twitter"><span>Twitter</span></li></a> <a href="https://twitter.com/intent/tweet?url={{request.build_absolute_uri|urlencode:"" }}&amp;text=I%27m%20ungluing%20{{ work.title|urlencode }}%20at%20%40unglueit.%20Join%20me%21"><li class="twitter"><span>Twitter</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 %} {% 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> <a href="#" id="embed"><li class="embed"><span>Embed</span></li></a>
</ul> </ul>

View File

@ -1359,13 +1359,30 @@ def emailshare(request):
else: else:
try: try:
next = request.GET['next'] next = request.GET['next']
work_id = next.split('/')[-2]
work_id = int(work_id)
book = models.Work.objects.get(pk=work_id)
title = book.title
# if title requires unicode let's ignore it for now
try:
title = ', '+str(title)+', '
except:
title = ' '
try:
status = book.last_campaign().status
except:
status = None
# customize the call to action depending on campaign status
if status == 'ACTIVE':
message = 'Help me unglue one of my favorite books'+title+'on Unglue.It: '+next+'. If enough of us pledge to unglue this book, the creator will be paid and the ebook will become free to everyone on earth.'
else:
message = 'Help me unglue one of my favorite books'+title+'on Unglue.It: '+next+'. If enough of us wishlist this book, Unglue.It may start a campaign to pay the creator and make the ebook free to everyone on earth.'
form = EmailShareForm(initial={'next':next, 'subject': 'Come see one of my favorite books on Unglue.It', 'message': message})
except: except:
next = '' next = ''
if request.user.is_authenticated():
sender = request.user.email
else:
sender = '' sender = ''
form = EmailShareForm(initial={'next':next, 'message':"I'm ungluing books at unglue.it. Here's one of my favorites: "+next, "sender":sender}) form = EmailShareForm(initial={'next':next, 'subject': 'Come join me on Unglue.It', 'message':"I'm ungluing books on Unglue.It. Together we're paying creators and making ebooks free to everyone on earth. Join me! http://unglue.it"})
return render(request, "emailshare.html", {'form':form}) return render(request, "emailshare.html", {'form':form})