decrudify and update emailshare
parent
92e870d2b7
commit
665fd94e73
|
@ -69,7 +69,7 @@ $j(document).ready(function() {
|
|||
<a href="https://www.facebook.com/sharer.php?u=https://{{ site.domain }}{% url work work.id|urlencode:"" %}"><li class="facebook first"><span>Facebook</span></li></a>
|
||||
<a href="https://twitter.com/intent/tweet?url={{ request.build_absolute_uri|urlencode:"" }}&text=I%27m%20enjoying%20{{ work.title|urlencode }}%2C%20a%20free%2C%20non%2DDRM%20ebook%2E%20You%20can%20too%21"><li class="twitter"><span>Twitter</span></li></a>
|
||||
{% endwith %}
|
||||
{% if request.user.is_authenticated %}<a href="{% url emailshare '' %}?next={% url work work.id %}"><li class="email"><span>Email</span></li></a>{% endif %}
|
||||
{% if request.user.is_authenticated %}<a href="{% url emailshare 'downloaded' %}?next={% url work work.id %}"><li class="email"><span>Email</span></li></a>{% endif %}
|
||||
<a id="embed2"><li class="embed"><span>Embed</span></li></a>
|
||||
<div id="widgetcode2">Copy/paste this into your site:<br /><textarea rows="7" cols="22"><iframe src="https://{{ request.META.HTTP_HOST }}/api/widget/{{ work.first_isbn_13 }}/" width="152" height="325" frameborder="0"></iframe></textarea></div>
|
||||
</ul>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
I just pledged to unglue one of my favorite books, "{{ work.title }}", on Unglue.it:
|
||||
I just {{ action }} one of my favorite books, "{{ work.title }}", on Unglue.it:
|
||||
https://{{site}}{% url work work.id %}.
|
||||
|
||||
If enough of us pledge to unglue this book, the creator will be paid and the ebook will become free to everyone on earth. Will you join me?
|
||||
{% ifequal work.last_campaign.type 1 %}If enough of us pledge to unglue this book, the creator will be paid and the ebook will become free to everyone on earth.{% endifequal %}{% ifequal work.last_campaign.type 2 %}If enough of us buy this book, the ebook will become free to everyone on earth.{% endifequal %}{% ifequal work.last_campaign.type 3 %}Creators of free ebooks need support if we want there to be more of them.{% endifequal %}
|
||||
|
||||
Will you join me?
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Help me unglue one of my favorite books, "{{ work.title }}" on Unglue.it:
|
||||
https://{{site}}{% url work work.id %}
|
||||
|
||||
If enough of us pledge to unglue this book, the creator will be paid and the ebook will become free to everyone on earth.
|
||||
{% ifequal work.last_campaign.type 1 %}If enough of us pledge to unglue this book, the creator will be paid and the ebook will become free to everyone on earth.{% endifequal %}{% ifequal work.last_campaign.type 2 %}If enough of us buy this book, the ebook will become free to everyone on earth.{% endifequal %}{% ifequal work.last_campaign.type 3 %}Creators of free ebooks need support if we want there to be more of them.{% endifequal %}
|
|
@ -1,4 +1,4 @@
|
|||
Help me unglue one of my favorite books, "{{ work.title }}" on Unglue.it:
|
||||
https://{{site}}{% url work work.id %}
|
||||
|
||||
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.
|
||||
If enough of us fave this book, Unglue.it may start a campaign to pay the creator and make the ebook free to everyone on earth.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<ul>
|
||||
{% if request.user.is_authenticated %}<a href="{% url emailshare 'pledge' %}?next={{ work_url|urlencode:"" }}"><li>Email it!</li></a>{% endif %}
|
||||
{% if request.user.is_authenticated %}<a href="{% url emailshare 'pledged' %}?next={{ work_url|urlencode:"" }}"><li>Email it!</li></a>{% endif %}
|
||||
<a href="https://twitter.com/intent/tweet?url=https://{{ current_site.domain }}{{ work_url|urlencode:"" }}&text=I%27m%helping%20to%20unglue%20{{ title|urlencode }}%20at%20%40unglueit.%20Will%20you%20join%20me%3F"><li>Tweet it!</li></a>
|
||||
<a href="https://www.facebook.com/sharer.php?u=https://{{ current_site.domain }}{{ work_url|urlencode:"" }}"><li>Share it on Facebook.</li></a>
|
||||
<li>Best idea: talk about it with those you love.</li>
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<ul class="social menu pledge">
|
||||
<a href="https://www.facebook.com/sharer.php?u=https://{{ site.domain }}{% url work work.id|urlencode:"" %}"><li class="facebook first"><span>Facebook</span></li></a>
|
||||
<a href="https://twitter.com/intent/tweet?url=https://{{ site.domain }}{% url work work.id|urlencode:"" %}&text=I%20just%20supported%20{{ work.title|urlencode }}%20at%20%40unglueit.%20Will%20you%20join%20me%3F"><li class="twitter"><span>Twitter</span></li></a>
|
||||
{% if request.user.is_authenticated %}<a href="{% url emailshare 'pledge' %}?next={% url work work.id|urlencode:"" %}"><li class="email"><span>Email</span></li></a>{% endif%}
|
||||
{% if request.user.is_authenticated %}<a href="{% url emailshare 'pledged' %}?next={% url work work.id|urlencode:"" %}"><li class="email"><span>Email</span></li></a>{% endif%}
|
||||
<a href="#" id="embed"><li class="embed"><span>Embed</span></li></a>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -2474,44 +2474,25 @@ def emailshare(request, action):
|
|||
work_id = next.split('/')[-2]
|
||||
work_id = int(work_id)
|
||||
work = models.Work.objects.get(pk=work_id)
|
||||
if action == 'pledge':
|
||||
message = render_to_string('emails/i_just_pledged.txt',{'request':request,'work':work,'site': Site.objects.get_current()})
|
||||
subject = "Help me unglue "+work.title
|
||||
else:
|
||||
try:
|
||||
status = work.last_campaign().status
|
||||
except:
|
||||
status = None
|
||||
|
||||
# customize the call to action depending on campaign status
|
||||
if status == 'SUCCESSFUL' or work.first_ebook():
|
||||
message = render_to_string('emails/read_this.txt',{'request':request,'work':work,'site': Site.objects.get_current()})
|
||||
subject = 'I think you\'d like this book I\'m reading'
|
||||
elif status == 'ACTIVE':
|
||||
message = render_to_string('emails/pledge_this.txt',{'request':request,'work':work,'site': Site.objects.get_current()})
|
||||
subject = 'Please help me give this book to the world'
|
||||
else:
|
||||
message = render_to_string('emails/wish_this.txt',{'request':request,'work':work,'site': Site.objects.get_current()})
|
||||
subject = 'Come see one of my favorite books on Unglue.it'
|
||||
|
||||
form = EmailShareForm(initial={ 'next':next, 'subject': subject, 'message': message})
|
||||
if not action:
|
||||
status = work.last_campaign().status
|
||||
except:
|
||||
pass
|
||||
|
||||
if action == 'pledge':
|
||||
message = render_to_string('emails/i_just_pledged.txt',{'request':request,'work':work,'site': Site.objects.get_current()})
|
||||
context = {'request':request,'work':work,'site': Site.objects.get_current(), 'action': action}
|
||||
if work and action :
|
||||
message = render_to_string('emails/i_just_pledged.txt', context)
|
||||
subject = "Help me unglue "+work.title
|
||||
else:
|
||||
# customize the call to action depending on campaign status
|
||||
if status == 'ACTIVE':
|
||||
message = render_to_string('emails/pledge_this.txt',{'request':request,'work':work,'site': Site.objects.get_current()})
|
||||
message = render_to_string('emails/pledge_this.txt', context)
|
||||
subject = 'Please help me give this book to the world'
|
||||
elif work:
|
||||
message = render_to_string('emails/wish_this.txt',{'request':request,'work':work,'site': Site.objects.get_current()})
|
||||
subject = 'Come see one of my favorite books on Unglue.it'
|
||||
message = render_to_string('emails/wish_this.txt', context)
|
||||
subject = 'This is one of my favorite books on Unglue.it'
|
||||
else:
|
||||
# for email shares not bound to a campaign or pledge
|
||||
message = render_to_string('emails/join_me.txt',{'request':request,'site': Site.objects.get_current()})
|
||||
message = render_to_string('emails/join_me.txt', context)
|
||||
subject = "Help me give books to the world"
|
||||
|
||||
form = EmailShareForm(initial={ 'next':next, 'subject': subject, 'message': message})
|
||||
|
|
Loading…
Reference in New Issue