SciPost Code Repository

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

Add contributor_info page

parent 76758b78
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,7 @@ from django.contrib import admin ...@@ -19,6 +19,7 @@ from django.contrib import admin
urlpatterns = [ urlpatterns = [
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
url(r'^', include('scipost.urls', namespace="scipost")), url(r'^', include('scipost.urls', namespace="scipost")),
url(r'^contributor/', include('scipost.urls', namespace="scipost")),
url(r'^commentaries/', include('commentaries.urls', namespace="commentaries")), url(r'^commentaries/', include('commentaries.urls', namespace="commentaries")),
url(r'^commentary/', include('commentaries.urls', namespace="commentaries")), url(r'^commentary/', include('commentaries.urls', namespace="commentaries")),
url(r'^comments/', include('comments.urls', namespace="comments")), url(r'^comments/', include('comments.urls', namespace="comments")),
......
...@@ -89,7 +89,8 @@ class Comment(models.Model): ...@@ -89,7 +89,8 @@ class Comment(models.Model):
output = '<div class="commentid">\n' output = '<div class="commentid">\n'
output += '<h3><a id="comment_id' + str(self.id) + '">' + str(self.id) + '</a>' output += '<h3><a id="comment_id' + str(self.id) + '">' + str(self.id) + '</a>'
if not self.anonymous: if not self.anonymous:
output += ' by ' + self.author.user.first_name + ' ' + self.author.user.last_name output += (' by <a href="/contributor/' + str(self.author.id) + '">' +
self.author.user.first_name + ' ' + self.author.user.last_name + '</a>')
output += '</h3>' output += '</h3>'
if self.in_reply_to: if self.in_reply_to:
output += '<h4>in reply to ' + str(self.in_reply_to.id) + '</h4>\n' output += '<h4>in reply to ' + str(self.in_reply_to.id) + '</h4>\n'
......
{% extends 'scipost/base.html' %}
{% block pagetitle %}: personal page{% endblock pagetitle %}
{% block headsup %}
<script>
$(document).ready(function(){
$("#mycommentsbutton").click(function(){
$("#mycommentslist").toggle();
});
$("#myauthorrepliesbutton").click(function(){
$("#myauthorreplieslist").toggle();
});
});
</script>
{% endblock headsup %}
{% block bodysup %}
<section>
<div class="flex-greybox">
<h1>Contributor info</h1>
</div>
<div class="row">
<div class="col-6">
{{ contributor.as_table|safe }}
</div>
</div>
</section>
<section>
<hr class="hr12">
<div class="flex-greybox">
<h1>SciPost Submissions</h1>
</div>
</section>
<section>
<hr class="hr12">
<div class="flex-greybox">
<h1>SciPost Commentaries</h1>
</div>
</section>
{% if contributor_comments %}
<section>
<hr class="hr12">
<div class="flex-greybox">
<h1>Comments</h1>
<button id="mycommentsbutton">View/hide comments</button>
</div>
<div id="mycommentslist">
<ul>
{% for comment in contributor_comments %}
{{ comment.header_as_li|safe }}
{% endfor %}
</ul>
</div>
</section>
{% endif %}
{% if own_authorreplies %}
<section>
<hr class="hr12">
<div class="flex-greybox">
<h1>Your Author Replies</h1>
<button id="myauthorrepliesbutton">View/hide author replies</button>
</div>
<div id="myauthorreplieslist">
<ul>
{% for reply in contributor_authorreplies %}
{{ own_reply.header_as_li|safe }}
{% endfor %}
</ul>
</div>
</section>
{% endif %}
{% endblock bodysup %}
...@@ -90,6 +90,12 @@ ...@@ -90,6 +90,12 @@
<div class="flex-greybox"> <div class="flex-greybox">
<h1>SciPost Submissions</h1> <h1>SciPost Submissions</h1>
</div> </div>
{% if submission_authorships_to_claim %}
<ul>
{% for sub in submission_authorships_to_claim %}
{{ submission.header_as_li|safe %}
{% endfor %}
{% endif %}
<ul> <ul>
<li><a href="{% url 'submissions:submit_manuscript' %}">Submit an arXiv preprint to a SciPost Journal</a></li> <li><a href="{% url 'submissions:submit_manuscript' %}">Submit an arXiv preprint to a SciPost Journal</a></li>
</ul> </ul>
......
...@@ -37,4 +37,7 @@ urlpatterns = [ ...@@ -37,4 +37,7 @@ urlpatterns = [
url(r'^reset_password/$', views.reset_password, name='reset_password'), url(r'^reset_password/$', views.reset_password, name='reset_password'),
url(r'^update_personal_data$', views.update_personal_data, name='update_personal_data'), url(r'^update_personal_data$', views.update_personal_data, name='update_personal_data'),
url(r'^update_personal_data_ack$', TemplateView.as_view(template_name='scipost/update_personal_data_ack.html'), name='update_personal_data_ack'), url(r'^update_personal_data_ack$', TemplateView.as_view(template_name='scipost/update_personal_data_ack.html'), name='update_personal_data_ack'),
# Contributor info
url(r'^(?P<contributor_id>[0-9]+)$', views.contributor_info, name="contributor_info"),
] ]
...@@ -231,6 +231,8 @@ def personal_page(request): ...@@ -231,6 +231,8 @@ def personal_page(request):
nr_author_replies_to_vet = AuthorReply.objects.filter(status=0).count() nr_author_replies_to_vet = AuthorReply.objects.filter(status=0).count()
nr_reports_to_vet = Report.objects.filter(status=0).count() nr_reports_to_vet = Report.objects.filter(status=0).count()
nr_thesislink_requests_to_vet = ThesisLink.objects.filter(vetted=False).count() nr_thesislink_requests_to_vet = ThesisLink.objects.filter(vetted=False).count()
# Verify if there exist objects authored by this contributor, whose authorship hasn't been claimed yet
submission_authorships_to_claim = Submission.objects.filter(author_list__contains=contributor.user.last_name)
own_comments = Comment.objects.filter(author=contributor).order_by('-date_submitted') own_comments = Comment.objects.filter(author=contributor).order_by('-date_submitted')
own_authorreplies = AuthorReply.objects.filter(author=contributor).order_by('-date_submitted') own_authorreplies = AuthorReply.objects.filter(author=contributor).order_by('-date_submitted')
context = {'contributor': contributor, 'nr_reg_to_vet': nr_reg_to_vet, context = {'contributor': contributor, 'nr_reg_to_vet': nr_reg_to_vet,
...@@ -241,6 +243,7 @@ def personal_page(request): ...@@ -241,6 +243,7 @@ def personal_page(request):
'nr_reports_to_vet': nr_reports_to_vet, 'nr_reports_to_vet': nr_reports_to_vet,
'nr_submissions_to_process': nr_submissions_to_process, 'nr_submissions_to_process': nr_submissions_to_process,
'nr_thesislink_requests_to_vet': nr_thesislink_requests_to_vet, 'nr_thesislink_requests_to_vet': nr_thesislink_requests_to_vet,
'submission_authorships_to_claim': submission_authorships_to_claim,
'own_comments': own_comments, 'own_authorreplies': own_authorreplies} 'own_comments': own_comments, 'own_authorreplies': own_authorreplies}
return render(request, 'scipost/personal_page.html', context) return render(request, 'scipost/personal_page.html', context)
else: else:
...@@ -308,3 +311,17 @@ def update_personal_data(request): ...@@ -308,3 +311,17 @@ def update_personal_data(request):
return render(request, 'scipost/login.html', {'form': form}) return render(request, 'scipost/login.html', {'form': form})
def contributor_info(request, contributor_id):
if request.user.is_authenticated():
contributor = Contributor.objects.get(pk=contributor_id)
contributor_comments = Comment.objects.filter(author=contributor, status__gte=1).order_by('-date_submitted')
contributor_authorreplies = AuthorReply.objects.filter(author=contributor, status__gte=1).order_by('-date_submitted')
context = {'contributor': contributor,
'contributor_comments': contributor_comments,
'contributor_authorreplies': contributor_authorreplies}
return render(request, 'scipost/contributor_info.html', context)
else:
form = AuthenticationForm()
context = {'form': form}
return render(request, 'scipost/login.html', context)
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