SciPost Code Repository

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

Uniformize views for sub, com and theses

parent 43f48f57
No related branches found
No related tags found
No related merge requests found
...@@ -48,20 +48,8 @@ class Commentary(models.Model): ...@@ -48,20 +48,8 @@ class Commentary(models.Model):
return header return header
def header_as_li (self): def header_as_li (self):
# header = '<li><table><tr><td><a href="{% url \'commentaries:commentary\' ' + str(self.id) + ' %}">' + self.pub_title + '</a></td></tr>'
# header += '<tr><td>by ' + self.author_list + '</td></tr><tr><td> (published ' + str(self.pub_date) + ')</td></tr></table></li>'
# header = '<li><ul><li><a href="{% url \'commentaries:commentary\' ' + str(self.id) + ' %}">' + self.pub_title + '</a></li>'
# header += '<li>by ' + self.author_list + '</li><li> (published ' + str(self.pub_date) + ')</li></ul></li>'
# header = '<li><p><a href="{% url \'commentaries:commentary\' ' + str(self.id) + ' %}">' + self.pub_title + '</a></p>'
# header += '<p>by ' + self.author_list + '</p><p> (published ' + str(self.pub_date) + ')</p></li>'
header = '<li><div class="flex-container">' header = '<li><div class="flex-container">'
header += '<div class="flex-whitebox0"><p><a href="/commentaries/commentary/' + str(self.id) + '">' + self.pub_title + '</a></p>' header += '<div class="flex-whitebox0"><p><a href="/commentaries/commentary/' + str(self.id) + '" class="pubtitleli">' + self.pub_title + '</a></p>'
header += '<p>by ' + self.author_list + '</p><p> (published ' + str(self.pub_date) + ')</p></div>' header += '<p>by ' + self.author_list + '</p><p> (published ' + str(self.pub_date) + ') - latest activity: ' + self.latest_activity.strftime('%Y-%m-%d %H:%M') + '</p></div>'
header += '<div class="flex-whitebox0"><p>Latest activity: ' + self.latest_activity.strftime('%Y-%m-%d %H:%M') + '</p></div>'
header += '</div></li>' header += '</div></li>'
#header = '<li>'
#header += '<p><a href="{% url \'commentaries:commentary\' commentary_id=' + str(self.id) + ' %}">' + self.pub_title + '</a></p>'
#header += '<p>by ' + self.author_list + '</p><p> (published ' + str(self.pub_date) + ')</p>'
#header += '<p>Latest activity: ' + str(self.latest_activity) + '</p>'
#header += '</li>'
return header return header
...@@ -71,6 +71,7 @@ def vet_commentary_request_ack(request, commentary_id): ...@@ -71,6 +71,7 @@ def vet_commentary_request_ack(request, commentary_id):
# accept the commentary as is # accept the commentary as is
commentary.vetted = True commentary.vetted = True
commentary.vetted_by = Contributor.objects.get(user=request.user) commentary.vetted_by = Contributor.objects.get(user=request.user)
commentary.latest_activity = timezone.now()
commentary.save() commentary.save()
email_text = 'Dear ' + title_dict[commentary.requested_by.title] + ' ' + commentary.requested_by.user.last_name + ', \n\nThe Commentary Page you have requested, concerning publication with title ' + commentary.pub_title + ' by ' + commentary.author_list + ', has been activated. You are now welcome to submit your comments.' + '\n\nThank you for your contribution, \nThe SciPost Team.' email_text = 'Dear ' + title_dict[commentary.requested_by.title] + ' ' + commentary.requested_by.user.last_name + ', \n\nThe Commentary Page you have requested, concerning publication with title ' + commentary.pub_title + ' by ' + commentary.author_list + ', has been activated. You are now welcome to submit your comments.' + '\n\nThank you for your contribution, \nThe SciPost Team.'
emailmessage = EmailMessage('SciPost Commentary Page activated', email_text, 'commentaries@scipost.org', [commentary.requested_by.user.email, 'commentaries@scipost.org'], reply_to=['commentaries@scipost.org']) emailmessage = EmailMessage('SciPost Commentary Page activated', email_text, 'commentaries@scipost.org', [commentary.requested_by.user.email, 'commentaries@scipost.org'], reply_to=['commentaries@scipost.org'])
...@@ -115,7 +116,8 @@ def commentaries(request): ...@@ -115,7 +116,8 @@ def commentaries(request):
form = CommentarySearchForm() form = CommentarySearchForm()
commentary_search_list = [] commentary_search_list = []
commentary_recent_list = Commentary.objects.filter(vetted=True, latest_activity__gte=timezone.now() + datetime.timedelta(days=-7)) #commentary_recent_list = Commentary.objects.filter(vetted=True, latest_activity__gte=timezone.now() + datetime.timedelta(days=-7))
commentary_recent_list = Commentary.objects.filter(vetted=True).order_by('-latest_activity')[:10]
context = {'form': form, 'commentary_search_list': commentary_search_list, 'commentary_recent_list': commentary_recent_list } context = {'form': form, 'commentary_search_list': commentary_search_list, 'commentary_recent_list': commentary_recent_list }
return render(request, 'commentaries/commentaries.html', context) return render(request, 'commentaries/commentaries.html', context)
......
...@@ -35,21 +35,25 @@ def vet_submitted_comment_ack(request, comment_id): ...@@ -35,21 +35,25 @@ def vet_submitted_comment_ack(request, comment_id):
email_text = 'Dear ' + title_dict[comment.author.title] + ' ' + comment.author.user.last_name + ', \n\nThe Comment you have submitted, concerning publication with title ' email_text = 'Dear ' + title_dict[comment.author.title] + ' ' + comment.author.user.last_name + ', \n\nThe Comment you have submitted, concerning publication with title '
if comment.commentary is not None: if comment.commentary is not None:
email_text += comment.commentary.pub_title + ' by ' + comment.commentary.author_list email_text += comment.commentary.pub_title + ' by ' + comment.commentary.author_list
comment.commentary.latest_activity = timezone.now()
comment.commentary.save()
elif comment.submission is not None: elif comment.submission is not None:
email_text += comment.submission.title + ' by ' + comment.submission.author_list email_text += comment.submission.title + ' by ' + comment.submission.author_list
comment.submission.latest_activity = timezone.now()
comment.submission.save()
email_text += ', has been accepted and published online.' + '\n\nThank you for your contribution, \nThe SciPost Team.' email_text += ', has been accepted and published online.' + '\n\nThank you for your contribution, \nThe SciPost Team.'
emailmessage = EmailMessage('SciPost Comment published', email_text, 'comments@scipost.org', [comment.author.user.email, 'comments@scipost.org'], reply_to=['comments@scipost.org']) emailmessage = EmailMessage('SciPost Comment published', email_text, 'comments@scipost.org', [comment.author.user.email, 'comments@scipost.org'], reply_to=['comments@scipost.org'])
emailmessage.send(fail_silently=False) emailmessage.send(fail_silently=False)
elif form.cleaned_data['action_option'] == '2': elif form.cleaned_data['action_option'] == '2':
# the comment request is simply rejected # the comment request is simply rejected
comment.status = form.cleaned_data['refusal_reason'] comment.status = int(form.cleaned_data['refusal_reason'])
comment.save() comment.save()
email_text = 'Dear ' + title_dict[comment.author.title] + ' ' + comment.author.user.last_name + ', \n\nThe Comment you have submitted, concerning publication with title ' email_text = 'Dear ' + title_dict[comment.author.title] + ' ' + comment.author.user.last_name + ', \n\nThe Comment you have submitted, concerning publication with title '
if comment.commentary is not None: if comment.commentary is not None:
email_text += comment.commentary.pub_title + ' by ' + comment.commentary.author_list email_text += comment.commentary.pub_title + ' by ' + comment.commentary.author_list
elif comment.submission is not None: elif comment.submission is not None:
email_text += comment.submission.title + ' by ' + comment.submission.author_list email_text += comment.submission.title + ' by ' + comment.submission.author_list
email_text += ', has been rejected for the following reason:' + comment_refusal_dict[form.cleaned_data['refusal_reason']] + '.\n\nThank you for your contribution, \nThe SciPost Team.' email_text += ', has been rejected for the following reason:' + comment_refusal_dict[comment.status] + '.\n\nThank you for your contribution, \nThe SciPost Team.'
if form.cleaned_data['email_response_field']: if form.cleaned_data['email_response_field']:
email_text += '\n\nFurther explanations: ' + form.cleaned_data['email_response_field'] email_text += '\n\nFurther explanations: ' + form.cleaned_data['email_response_field']
emailmessage = EmailMessage('SciPost Comment rejected', email_text, 'comments@scipost.org', [comment.author.user.email, 'comments@scipost.org'], reply_to=['comments@scipost.org']) emailmessage = EmailMessage('SciPost Comment rejected', email_text, 'comments@scipost.org', [comment.author.user.email, 'comments@scipost.org'], reply_to=['comments@scipost.org'])
...@@ -78,6 +82,7 @@ def reply_to_comment(request, comment_id): ...@@ -78,6 +82,7 @@ def reply_to_comment(request, comment_id):
is_lit = form.cleaned_data['is_lit'], is_lit = form.cleaned_data['is_lit'],
is_sug = form.cleaned_data['is_sug'], is_sug = form.cleaned_data['is_sug'],
comment_text = form.cleaned_data['comment_text'], comment_text = form.cleaned_data['comment_text'],
remarks_for_editors = form.cleaned_data['remarks_for_editors'],
date_submitted = timezone.now(), date_submitted = timezone.now(),
) )
newcomment.save() newcomment.save()
...@@ -157,8 +162,12 @@ def vet_author_reply_ack(request, reply_id): ...@@ -157,8 +162,12 @@ def vet_author_reply_ack(request, reply_id):
email_text = 'The Author Reply you have submitted, concerning publication with title ' email_text = 'The Author Reply you have submitted, concerning publication with title '
if reply.commentary is not None: if reply.commentary is not None:
email_text += reply.commentary.pub_title + ' by ' + reply.commentary.author_list email_text += reply.commentary.pub_title + ' by ' + reply.commentary.author_list
reply.commentary.latest_activity = timezone.now()
reply.commentary.save()
elif reply.submission is not None: elif reply.submission is not None:
email_text += reply.submission.title + ' by ' + reply.submission.author_list email_text += reply.submission.title + ' by ' + reply.submission.author_list
reply.submission.latest_activity = timezone.now()
reply.submission.save()
email_text += ', has been accepted and published online.' + '\n\nThank you for your contribution, \nThe SciPost Team.' email_text += ', has been accepted and published online.' + '\n\nThank you for your contribution, \nThe SciPost Team.'
emailmessage = EmailMessage('SciPost Author Reply published', email_text, 'comments@scipost.org', [reply.author.user.email, 'comments@scipost.org'], reply_to=['comments@scipost.org']) emailmessage = EmailMessage('SciPost Author Reply published', email_text, 'comments@scipost.org', [reply.author.user.email, 'comments@scipost.org'], reply_to=['comments@scipost.org'])
emailmessage.send(fail_silently=False) emailmessage.send(fail_silently=False)
......
...@@ -237,6 +237,14 @@ hr.hr12 { ...@@ -237,6 +237,14 @@ hr.hr12 {
padding: 0px; padding: 0px;
} }
.pubtitleli {
martin: 1px;
padding: 3px 5px;
background-color: #f4f4f4;
border-radius: 4px;
border: 1px solid orange;
}
body { body {
/* font-family: Merriweather, sans-serif; */ /* font-family: Merriweather, sans-serif; */
font-family: 'Merriweather Sans'; font-family: 'Merriweather Sans';
......
...@@ -60,6 +60,14 @@ class Submission(models.Model): ...@@ -60,6 +60,14 @@ class Submission(models.Model):
header += '</table>' header += '</table>'
return header return header
def header_as_li (self):
header = '<li><div class="flex-container">'
header += '<div class="flex-whitebox0"><p><a href="/submissions/submission/' + str(self.id) + '" class="pubtitleli">' + self.title + '</a></p>'
header += '<p>by ' + self.author_list + '</p><p> (submitted ' + str(self.submission_date) + ' to ' + journals_submit_dict[self.submitted_to_journal] + ') - latest activity: ' + self.latest_activity.strftime('%Y-%m-%d %H:%M') + '</p></div>'
header += '</div></li>'
return header
def submission_info_as_table (self): def submission_info_as_table (self):
header = '<table>' header = '<table>'
header += '<tr><td>Editor in charge: </td><td>&nbsp;</td><td>' + str(self.editor_in_charge) + '</td></tr>' header += '<tr><td>Editor in charge: </td><td>&nbsp;</td><td>' + str(self.editor_in_charge) + '</td></tr>'
......
...@@ -42,7 +42,7 @@ ack=4 %}">month</a> <a href="{% url 'submissions:browse' discipline='physics' nr ...@@ -42,7 +42,7 @@ ack=4 %}">month</a> <a href="{% url 'submissions:browse' discipline='physics' nr
<h3>Search results:</h3> <h3>Search results:</h3>
<ul> <ul>
{% for submission in submission_search_list %} {% for submission in submission_search_list %}
<li><a href="{% url 'submissions:submission' submission.id %}">{{ submission.title }}</a> by {{ submission.author_list }} (published {{ submission.submission_date }}) </li> {{ submission.header_as_li|safe }}
{% endfor %} {% endfor %}
</ul> </ul>
{% elif form.has_changed %} {% elif form.has_changed %}
...@@ -57,7 +57,7 @@ ack=4 %}">month</a> <a href="{% url 'submissions:browse' discipline='physics' nr ...@@ -57,7 +57,7 @@ ack=4 %}">month</a> <a href="{% url 'submissions:browse' discipline='physics' nr
<h2>Recent Submissions:</h2> <h2>Recent Submissions:</h2>
<ul> <ul>
{% for submission in submission_recent_list %} {% for submission in submission_recent_list %}
<li><a href="{% url 'submissions:submission' submission.id %}">{{ submission.title }}</a> by {{ submission.author_list }} (submitted {{ submission.submission_date }}) </li> {{ submission.header_as_li|safe }}
{% endfor %} {% endfor %}
</ul> </ul>
</section> </section>
......
...@@ -64,6 +64,7 @@ def process_new_submission_ack(request, submission_id): ...@@ -64,6 +64,7 @@ def process_new_submission_ack(request, submission_id):
submission.vetted = True submission.vetted = True
submission.editor_in_charge = form.cleaned_data['editor_in_charge'] submission.editor_in_charge = form.cleaned_data['editor_in_charge']
submission.status = 1 submission.status = 1
submission.latest_activity = timezone.now()
submission.save() submission.save()
context = {} context = {}
......
...@@ -55,10 +55,16 @@ class ThesisLink(models.Model): ...@@ -55,10 +55,16 @@ class ThesisLink(models.Model):
return header return header
def header_as_li (self): def header_as_li (self):
# header = '<li><div class="flex-container">'
# header += '<div class="flex-thesesbox"><p><a href="/theses/thesis/' + str(self.id) + '" class="pubtitleli">' + self.title + '</a></p>'
# header += '<p>' + thesis_type_dict[self.type] + ' thesis by ' + self.author + ' (supervisor(s): ' + self.supervisor + ')</p>'
# header += '<p>in ' + disciplines_dict[self.discipline] + ', ' + journals_domains_dict[self.domain] + ' ' + journals_spec_dict[self.specialization] + '</p></div>'
# header += '<div class="flex-thesesbox"><p>Defense date: ' + str(self.defense_date) + '</p><p>Latest activity: ' + self.latest_activity.strftime('%Y-%m-%d %H:%M') + '</p></div>'
# header += '</div></li>'
header = '<li><div class="flex-container">' header = '<li><div class="flex-container">'
header += '<div class="flex-thesesbox"><p><a href="/theses/thesis/' + str(self.id) + '">' + self.title + '</a></p>' header += '<div class="flex-whitebox0"><p><a href="/theses/thesis/' + str(self.id) + '" class="pubtitleli">' + self.title + '</a></p>'
header += '<p>' + thesis_type_dict[self.type] + ' thesis by ' + self.author + ' (supervisor(s): ' + self.supervisor + ')</p>' header += '<p>' + thesis_type_dict[self.type] + ' thesis by ' + self.author + ' (supervisor(s): ' + self.supervisor + ') in '
header += '<p>in ' + disciplines_dict[self.discipline] + ', ' + journals_domains_dict[self.domain] + ' ' + journals_spec_dict[self.specialization] + '</p></div>' header += disciplines_dict[self.discipline] + ', ' + journals_domains_dict[self.domain] + ' ' + journals_spec_dict[self.specialization] + '</p>'
header += '<div class="flex-thesesbox"><p>Defense date: ' + str(self.defense_date) + '</p><p>Latest activity: ' + self.latest_activity.strftime('%Y-%m-%d %H:%M') + '</p></div>' header += '<p>Defense date: ' + str(self.defense_date) + ' - Latest activity: ' + self.latest_activity.strftime('%Y-%m-%d %H:%M') + '</p></div>'
header += '</div></li>' header += '</div></li>'
return header return header
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