diff --git a/comments/models.py b/comments/models.py index a73d060be614666ba34217a65806e0096b280017..73a2f9210b8f1b69d5989a2ebf08776d9ec1a807 100644 --- a/comments/models.py +++ b/comments/models.py @@ -109,6 +109,8 @@ class Comment(models.Model): # for display output = '<div class="commentid">\n' output += '<h3><a id="comment_id' + str(self.id) + '"></a>' + if self.is_author_reply: + output += 'Author ' if not self.anonymous: output += (' <a href="/contributor/' + str(self.author.id) + '">' + self.author.user.first_name + ' ' + self.author.user.last_name + '</a> on ') @@ -118,44 +120,46 @@ class Comment(models.Model): # str(self.in_reply_to.author.user.first_name) + ' ' + # str(self.in_reply_to.author.user.last_name) + ' on ' + # self.in_reply_to.date_submitted.strftime("%Y-%m-%d") + '</a>') - output += self.date_submitted.strftime("%Y-%m-%d") + ' (in reply to ' + output += self.date_submitted.strftime("%Y-%m-%d") if self.in_reply_to_comment: - output += ('<a href="#comment_id' + str(self.in_reply_to_comment_id) + '">' + + output += (' (in reply to <a href="#comment_id' + str(self.in_reply_to_comment_id) + '">' + str(self.in_reply_to_comment.author.user.first_name) + ' ' + str(self.in_reply_to_comment.author.user.last_name) + ' on ' + - self.in_reply_to_comment.date_submitted.strftime("%Y-%m-%d")) + self.in_reply_to_comment.date_submitted.strftime("%Y-%m-%d") + '</a>)') elif self.in_reply_to_report: - output += ('<a href="#report_id' + str(self.in_reply_to_report_id) + '">') + output += (' (in reply to <a href="#report_id' + str(self.in_reply_to_report_id) + '">') if not self.in_reply_to_report.anonymous: output += (str(self.in_reply_to_report.author.user.first_name) + ' ' + str(self.in_reply_to_report.author.user.last_name)) else: output += 'Report ' + str(self.in_reply_to_report_id) - output += '</a> on ' + self.in_reply_to_report.date_submitted.strftime("%Y-%m-%d") - output += '</a>)</h3></div>' + output += '</a> on ' + self.in_reply_to_report.date_submitted.strftime("%Y-%m-%d") + '</a>)' + output += '</h3></div>' return output def print_identifier_for_vetting (self): # for display, same as print_identifier but named even if anonymous, not linked output = '<div class="commentid">\n' output += '<h3>' + if self.is_author_reply: + output += 'Author ' output += (' <a href="/contributor/' + str(self.author.id) + '">' + self.author.user.first_name + ' ' + self.author.user.last_name + '</a> on ') - output += self.date_submitted.strftime("%Y-%m-%d") + ' (in reply to ' + output += self.date_submitted.strftime("%Y-%m-%d") if self.in_reply_to_comment: - output += ('<a href="#comment_id' + str(self.in_reply_to_comment_id) + '">' + + output += (' (in reply to <a href="#comment_id' + str(self.in_reply_to_comment_id) + '">' + str(self.in_reply_to_comment.author.user.first_name) + ' ' + str(self.in_reply_to_comment.author.user.last_name) + ' on ' + - self.in_reply_to_comment.date_submitted.strftime("%Y-%m-%d")) + self.in_reply_to_comment.date_submitted.strftime("%Y-%m-%d") + '</a>)') elif self.in_reply_to_report: - output += ('<a href="#report_id' + str(self.in_reply_to_report_id) + '">') + output += (' (in reply to <a href="#report_id' + str(self.in_reply_to_report_id) + '">') if not self.in_reply_to_report.anonymous: output += (str(self.in_reply_to_report.author.user.first_name) + ' ' + str(self.in_reply_to_report.author.user.last_name)) else: output += 'Report ' + str(self.in_reply_to_report_id) - output += ' on ' + self.in_reply_to_report.date_submitted.strftime("%Y-%m-%d") - output += '</a>)</h3></div>' + output += ' on ' + self.in_reply_to_report.date_submitted.strftime("%Y-%m-%d") + '</a>)' + output += '</h3></div>' return output diff --git a/scipost/static/scipost/SciPost.css b/scipost/static/scipost/SciPost.css index c65badb948775222f3f839b7e9b0b2c30c125f60..cf50f4104c5d708f825cbe52ce91b697705c3c42 100644 --- a/scipost/static/scipost/SciPost.css +++ b/scipost/static/scipost/SciPost.css @@ -372,7 +372,7 @@ section ul li { margin: 0px 4px; padding: 1px; display: inline-block; - box-shadow: 1px 1px 4px #888888; + box-shadow: 1px 1px 1px #888888; background: linear-gradient(to right,#fcfcfc, #f0f0f0); } .opinionsDisplay ul { diff --git a/scipost/templates/scipost/contributor_info.html b/scipost/templates/scipost/contributor_info.html index 51b427a469a56409e0303863a25b20f3a426a46c..adeb92f8da65e52e598cdece88717b60f042720b 100644 --- a/scipost/templates/scipost/contributor_info.html +++ b/scipost/templates/scipost/contributor_info.html @@ -6,6 +6,15 @@ <script> $(document).ready(function(){ + $("#mysubmissionsbutton").click(function(){ + $("#mysubmissionslist").toggle(); + }); + $("#mycommentariesbutton").click(function(){ + $("#mycommentarieslist").toggle(); + }); + $("#mythesesbutton").click(function(){ + $("#mytheseslist").toggle(); + }); $("#mycommentsbutton").click(function(){ $("#mycommentslist").toggle(); }); @@ -30,19 +39,59 @@ </div> </section> +{% if contributor_submissions %} +<section> + <hr class="hr12"> + <div class="flex-greybox"> + <h1>Submissions</h1> + <button id="mysubmissionsbutton">View/hide submissions</button> + </div> + <div id="mysubmissionslist"> + <h3>Submissions for which this Contributor is identified as an author:</h3> + <ul> + {% for sub in contributor_submissions %} + {{ sub.header_as_li|safe }} + {% endfor %} + </ul> + </div> +</section> +{% endif %} + +{% if contributor_commentaries %} <section> <hr class="hr12"> <div class="flex-greybox"> - <h1>SciPost Submissions</h1> + <h1>Commentaries</h1> + <button id="mycommentariesbutton">View/hide commentaries</button> + </div> + <div id="mycommentarieslist"> + <h3>Commentaries for which this Contributor is identified as an author:</h3> + <ul> + {% for com in contributor_commentaries %} + {{ com.header_as_li|safe }} + {% endfor %} + </ul> </div> </section> +{% endif %} +{% if contributor_theses %} <section> <hr class="hr12"> <div class="flex-greybox"> - <h1>SciPost Commentaries</h1> + <h1>Theses</h1> + <button id="mythesesbutton">View/hide theses</button> + </div> + <div id="mytheseslist"> + <h3>Theses for which this Contributor is identified as an author:</h3> + <ul> + {% for thesis in contributor_theses %} + {{ thesis.header_as_li|safe }} + {% endfor %} + </ul> </div> </section> +{% endif %} {% if contributor_comments %} <section> @@ -61,17 +110,17 @@ </section> {% endif %} -{% if own_authorreplies %} +{% if contributor_authorreplies %} <section> <hr class="hr12"> <div class="flex-greybox"> - <h1>Your Author Replies</h1> + <h1>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 }} + {{ contributor_reply.header_as_li|safe }} {% endfor %} </ul> </div> diff --git a/scipost/templates/scipost/personal_page.html b/scipost/templates/scipost/personal_page.html index 183b2d97c0744bed7725283066a687e8126ac37e..adfd1c9a8de26a13c75835ba7cf835be2d0e2ee0 100644 --- a/scipost/templates/scipost/personal_page.html +++ b/scipost/templates/scipost/personal_page.html @@ -6,6 +6,15 @@ <script> $(document).ready(function(){ + $("#mysubmissionsbutton").click(function(){ + $("#mysubmissionslist").toggle(); + }); + $("#mycommentariesbutton").click(function(){ + $("#mycommentarieslist").toggle(); + }); + $("#mythesesbutton").click(function(){ + $("#mytheseslist").toggle(); + }); $("#mycommentsbutton").click(function(){ $("#mycommentslist").toggle(); }); @@ -26,7 +35,7 @@ <hr class="hr12"> <div class="flex-greybox"> - <h1>Your SciPost Account</h1> + <h1>Your Account</h1> </div> <div class="row"> <div class="col-6"> @@ -47,7 +56,7 @@ <section> <hr class="hr12"> <div class="flex-greybox"> - <h1>Pending SciPost Editorial Actions</h1> + <h1>Pending Editorial Actions</h1> </div> <br> <div class="row"> @@ -88,7 +97,8 @@ <section> <hr class="hr12"> <div class="flex-greybox"> - <h1>SciPost Submissions</h1> + <h1>Submissions</h1> + <button id="mysubmissionsbutton">View/hide your submissions</button> <ul> {% if nr_submission_authorships_to_claim > 0 %} <li><a href="{% url 'scipost:claim_authorships' %}">Potential authorships to claim (auto-detected: {{ nr_submission_authorships_to_claim}})</a></li> @@ -96,20 +106,23 @@ <li><a href="{% url 'submissions:submit_manuscript' %}">Submit an arXiv preprint to a SciPost Journal</a></li> </ul> </div> - {% if own_submissions %} - <h3>Submissions for which you are identified an author:</h3> - <ul> - {% for sub in own_submissions %} - {{ sub.header_as_li|safe }} - {% endfor %} - </ul> - {% endif %} + <div id="mysubmissionslist"> + {% if own_submissions %} + <h3>Submissions for which you are identified as an author:</h3> + <ul> + {% for sub in own_submissions %} + {{ sub.header_as_li|safe }} + {% endfor %} + </ul> + {% endif %} + </div> </section> <section> <hr class="hr12"> <div class="flex-greybox"> - <h1>SciPost Commentaries</h1> + <h1>Commentaries</h1> + <button id="mycommentariesbutton">View/hide commentaries on your papers</button> <ul> {% if nr_commentary_authorships_to_claim > 0 %} <li><a href="{% url 'scipost:claim_authorships' %}">Potential authorships to claim (auto-detected: {{ nr_commentary_authorships_to_claim}})</a></li> @@ -117,20 +130,23 @@ <li><a href="{% url 'commentaries:request_commentary' %}">Request opening a SciPost Commentary Page</a></li> </ul> </div> - {% if own_commentaries %} - <h3>Commentaries for which you are identified an author:</h3> - <ul> - {% for com in own_commentaries %} - {{ com.header_as_li|safe }} - {% endfor %} - </ul> - {% endif %} + <div id="mycommentarieslist"> + {% if own_commentaries %} + <h3>Commentaries for which you are identified as an author:</h3> + <ul> + {% for com in own_commentaries %} + {{ com.header_as_li|safe }} + {% endfor %} + </ul> + {% endif %} + </div> </section> <section> <hr class="hr12"> <div class="flex-greybox"> - <h1>SciPost Theses</h1> + <h1>Theses</h1> + <button id="mythesesbutton">View/hide your theses</button> <ul> {% if nr_thesis_authorships_to_claim > 0 %} <li><a href="{% url 'scipost:claim_authorships' %}">Potential authorships to claim (auto-detected: {{ nr_thesis_authorships_to_claim}})</a></li> @@ -138,14 +154,16 @@ <li><a href="{% url 'theses:request_thesislink' %}">Request a SciPost ThesisLink</a></li> </ul> </div> - {% if own_thesislinks %} - <h3>Theses for which you are identified an author:</h3> - <ul> - {% for thesis in own_thesislinks %} - {{ thesis.header_as_li|safe }} - {% endfor %} - </ul> - {% endif %} + <div id="mytheseslist"> + {% if own_thesislinks %} + <h3>Theses for which you are identified as an author:</h3> + <ul> + {% for thesis in own_thesislinks %} + {{ thesis.header_as_li|safe }} + {% endfor %} + </ul> + {% endif %} + </div> </section> {% if contributor.rank == 0 %} diff --git a/scipost/views.py b/scipost/views.py index ee0ef5dabb616f0e378ffef1866d08560520912f..de4b8482e11f282122e0b2807ec5eb52edf2556a 100644 --- a/scipost/views.py +++ b/scipost/views.py @@ -445,9 +445,15 @@ def vet_thesis_authorship_claim(request, thesis_id, claim): def contributor_info(request, contributor_id): if request.user.is_authenticated(): contributor = Contributor.objects.get(pk=contributor_id) + contributor_submissions = Submission.objects.filter(authors__in=[contributor]) + contributor_commentaries = Commentary.objects.filter(authors__in=[contributor]) + contributor_theses = ThesisLink.objects.filter(author_as_cont__in=[contributor]) contributor_comments = Comment.objects.filter(author=contributor, is_author_reply=False, status__gte=1).order_by('-date_submitted') contributor_authorreplies = Comment.objects.filter(author=contributor, is_author_reply=True, status__gte=1).order_by('-date_submitted') context = {'contributor': contributor, + 'contributor_submissions': contributor_submissions, + 'contributor_commentaries': contributor_commentaries, + 'contributor_theses': contributor_theses, 'contributor_comments': contributor_comments, 'contributor_authorreplies': contributor_authorreplies} return render(request, 'scipost/contributor_info.html', context)