SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 7b735c3a authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Add ContactPerson emailing facilities

parent 3416a350
No related branches found
No related tags found
No related merge requests found
......@@ -221,6 +221,7 @@ $(document).ready(function($) {
<ul>
{% if perms.scipost.can_manage_organizations %}
<li><a href="{% url 'organizations:email_contactperson' contactperson_id=contactperson.id %}">Email (initial)</a></li>
<li><a href="{% url 'organizations:email_contactperson' contactperson_id=contactperson.id mail='followup' %}">Email (followup)</a></li>
<li><a href="{% url 'organizations:add_contact' organization_id=org.id contactperson_id=contactperson.id %}"><span class="text-success">Upgrade to Contact</span></a></li>
{% endif %}
<li><a href="{% url 'organizations:contactperson_update' pk=contactperson.id %}"><span class="text-warning">Update</span></a></li>
......
......@@ -52,6 +52,11 @@ urlpatterns = [
views.ContactPersonDeleteView.as_view(),
name='contactperson_delete'
),
url(
r'^contactperson/(?P<contactperson_id>[0-9]+)/email/(?P<mail>followup)$',
views.email_contactperson,
name='email_contactperson'
),
url(
r'^contactperson/(?P<contactperson_id>[0-9]+)/email/$',
views.email_contactperson,
......
......@@ -173,17 +173,18 @@ class ContactPersonDeleteView(UserPassesTestMixin, DeleteView):
kwargs={'pk': self.object.organization.id})
@permission_required('scipost.can_email_prospartner_contact', return_403=True)
@permission_required('scipost.can_manage_organizations', return_403=True)
@transaction.atomic
def email_contactperson(request, contactperson_id, mail=None):
contactperson = get_object_or_404(ContactPerson, pk=contactperson_id)
suffix = ''
if mail == 'followup':
code = 'contactperson_followup_mail'
code = 'org_contacts/contactperson_followup_mail'
suffix = ' (followup)'
else:
code = 'org_contacts/contactperson_initial_mail'
suffix = ' (initial)'
mail_request = MailEditingSubView(request, mail_code=code, contactperson=contactperson)
if mail_request.is_valid():
comments = 'Email{suffix} sent to {name}.'.format(suffix=suffix, name=contactperson)
......@@ -192,11 +193,11 @@ def email_contactperson(request, contactperson_id, mail=None):
event=ORGANIZATION_EVENT_EMAIL_SENT,
comments=comments,
noted_on=timezone.now(),
noted_by=request.user.contributor)
noted_by=request.user)
event.save()
messages.success(request, 'Email successfully sent.')
mail_request.send()
return redirect(reverse('organizations:dashboard'))
return redirect(contactperson.organization.get_absolute_url())
else:
return mail_request.return_render()
......
<p>
Dear {% if contactperson %}{{ contactperson.get_title_display }} {{ contactperson.last_name }}{% else %}colleagues{% endif %},
</p>
<p>
We recently contacted you concerning SciPost, to probe your organization's interest in becoming a Sponsor. With this follow-up email, I would simply like to check whether you got the original message.
</p>
<p>
<a href="https://scipost.org">SciPost</a> is a next-generation publication portal aiming to transform the business of scientific publishing. You can find a one-page summary in <a href="https://scipost.org/static/sponsors/SciPost_Sponsors_Board_Prospectus.pdf">our online prospectus</a> outlining the reasons why joining would be beneficial for your institution.
</p>
<p>
You can also find a summary of how your organization has benefitted from our activities at <a href="https://scipost.org{{ contactperson.organization.get_absolute_url }}">this link</a>.
</p>
<p>
I will be happy to provide any required further details. If you are interested, you can simply get in touch via this address (sponsors@scipost.org). I sincerely hope that SciPost will be able to count on your support.
</p>
<p>
If you not the right representative to get in touch with, could you please forward this to the right person, or let us know?
</p>
<p>
Many thanks in advance,
</p>
<p>
On behalf of the SciPost Foundation,<br><br>
Prof. dr Jean-Sébastien Caux<br>
J.S.Caux@uva.nl&nbsp;jscaux@scipost.org<br>
https://jscaux.org<br>
---------------------------------------------<br>
Institute for Theoretical Physics<br>
University of Amsterdam<br>
Science Park 904<br>
1098 XH Amsterdam<br>
The Netherlands<br>
---------------------------------------------<br>
tel.: +31 (0)20 5255775<br>
fax: +31 (0)20 5255778<br>
---------------------------------------------
</p>
{% include 'email/_footer.html' %}
{
"subject": "SciPost: Sponsors",
"to_address": "email",
"bcc_to": "sponsors@scipost.org",
"from_address_name": "SciPost Sponsors",
"from_address": "sponsors@scipost.org",
"context_object": "contactperson"
}
......@@ -4,5 +4,5 @@
"bcc_to": "sponsors@scipost.org",
"from_address_name": "SciPost Sponsors",
"from_address": "sponsors@scipost.org",
"context_object": "contact"
"context_object": "contactperson"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment