diff --git a/commentaries/models.py b/commentaries/models.py index 37b54c8caa499ee143360e8d086d5840dd510f39..68860aa7f0763f6f81e6452d414366562d7361cd 100644 --- a/commentaries/models.py +++ b/commentaries/models.py @@ -1,7 +1,6 @@ from django.db import models from django.contrib.postgres.fields import JSONField from django.template import Template, Context -from django.template.loader import get_template from journals.models import SCIPOST_JOURNALS_DOMAINS from scipost.behaviors import ArxivCallable @@ -136,32 +135,6 @@ class Commentary(ArxivCallable, TimeStampedModel): template = Template('<a href="{{scipost_url}}" class="pubtitleli">{{pub_title}}</a>') return template.render(context) - def header_as_li(self): - # TO BE REMOVED!!!! - template = get_template('commentaries/commentary_header_li.html') - return template.render({'object': self}) - - def simple_header_as_li(self): - # for display in Lists - context = Context({'scipost_url': self.scipost_url(), 'pub_title': self.pub_title, - 'author_list': self.author_list}) - header = ('<li>' - '<p><a href="{{ scipost_url }}" ' - 'class="pubtitleli">{{ pub_title }}</a></p>' - '<p>by {{ author_list }}') - if self.type == 'published': - header += ', {{ journal }} {{ volume }}, {{ pages }}' - context['journal'] = self.journal - context['volume'] = self.volume - context['pages'] = self.pages - elif self.type == 'preprint': - header += ', <a href="{{ arxiv_link }}">{{ arxiv_link }}</a>' - context['arxiv_link'] = self.arxiv_link - header += '</p>' - header += '</li>' - template = Template(header) - return template.render(context) - def parse_links_into_urls(self, commit=False): """ Takes the arXiv nr or DOI and turns it into the urls """ if self.pub_DOI: diff --git a/commentaries/templates/commentaries/_commentary_card_content.html b/commentaries/templates/commentaries/_commentary_card_content.html new file mode 100644 index 0000000000000000000000000000000000000000..6724ee64fb06a93f49d90aac0c5f062297bac03f --- /dev/null +++ b/commentaries/templates/commentaries/_commentary_card_content.html @@ -0,0 +1,11 @@ +<div class="card-block"> + <h3 class="card-title"> + <a href="{{ commentary.scipost_url }}">{{ commentary.pub_title }}</a> + </h3> + <p class="card-text"> + by {{ commentary.author_list }}{% if commentary.type == 'published' %}, {{ commentary.journal }} {{ commentary.volume }}, {{ commentary.pages }}{% elif commentary.type == 'preprint' %} - <a href="{{ commentary.arxiv_link }}">{{ commentary.arxiv_link }}</a>{% endif %} + </p> + <p class="card-text text-muted"> + {% if commentary.pub_date %}(published {{ commentary.pub_date }}) - {% endif %}latest activity: {{ commentary.latest_activity }} + </p> +</div> diff --git a/commentaries/templates/commentaries/commentary_detail.html b/commentaries/templates/commentaries/commentary_detail.html index b9c5fcd2f9a3691477692d54a4441d17f4b8c913..0e253b730ee81cdb3feed44d1df665b63bf09715 100644 --- a/commentaries/templates/commentaries/commentary_detail.html +++ b/commentaries/templates/commentaries/commentary_detail.html @@ -8,9 +8,6 @@ <script> $(document).ready(function(){ - $("#commentsbutton").click(function(){ - $("#commentslist").toggle(); - }); var comment_text_input = $("#id_comment_text"); @@ -32,16 +29,12 @@ {% block content %} - <div class="row"> <div class="col-12"> - <div class="panel"> - <h1>SciPost Commentary Page (non-SciPost publications)</h1> - </div> + <h1 class="highlight">SciPost Commentary Page (non-SciPost publications)</h1> </div> </div> -<hr> <div class="row"> <div class="col-12"> <h2>Original publication: </h2> diff --git a/commentaries/templates/commentaries/commentary_header_li.html b/commentaries/templates/commentaries/commentary_header_li.html deleted file mode 100644 index 56fd1ee2e850419b883521ed1b89f6d5b34c70f9..0000000000000000000000000000000000000000 --- a/commentaries/templates/commentaries/commentary_header_li.html +++ /dev/null @@ -1,13 +0,0 @@ -<li> - <p> - <a href="{{ object.scipost_url }}" class="pubtitleli">{{ object.pub_title }}</a> - </p> - <p> - by {{ object.author_list }} - {% if object.type == 'published' %}, {{ object.journal }} {{ object.volume }}, {{ object.pages }} - {% elif object.type == 'preprint' %}, <a href="{{ object.arxiv_link }}">{{ object.arxiv_link }}</a>{% endif %} - </p> - <p> - {% if object.pub_date %}(published {{ object.pub_date }}) - {% endif %}latest activity: {{ object.latest_activity }} - </p> -</li> diff --git a/commentaries/templates/commentaries/commentary_list.html b/commentaries/templates/commentaries/commentary_list.html index 4a420102c155cd83ed008a0b4c8362792c7093bf..a8c92a52df708b0f81a43c36bd0b77d6817d63ef 100644 --- a/commentaries/templates/commentaries/commentary_list.html +++ b/commentaries/templates/commentaries/commentary_list.html @@ -6,54 +6,64 @@ {% block pagetitle %}: Commentaries{% endblock pagetitle %} {% block headsup %} -<script type="text/javascript" async src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"></script> + <script type="text/javascript" async src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"></script> {% endblock headsup %} {% block content %} <div class="row"> <div class="col-md-4"> - <div class="panel page-header-panel"> - <h1>SciPost Commentaries</h1> - <h3><a href="{% url 'commentaries:howto' %}">SciPost Commentaries how-to</a></h3> - <h3><a href="{% url 'commentaries:request_commentary' %}">Request a new Commentary Page</a></h3> + <div class="card card-grey"> + <div class="card-block min-height-190"> + <h1 class="card-title">SciPost Commentaries</h1> + <h3><a href="{% url 'commentaries:howto' %}">SciPost Commentaries how-to</a></h3> + <h3><a href="{% url 'commentaries:request_commentary' %}">Request a new Commentary Page</a></h3> + </div> </div> </div> <div class="col-md-4"> - <div class="panel page-header-panel"> - <h2>Search SciPost Commentaries:</h2> - <form action="{% url 'commentaries:commentaries' %}" class="small" method="get"> - {{ form|bootstrap:'4,8,sm' }} - <input class="btn btn-sm btn-secondary" type="submit"/> - </form> + <div class="card card-grey"> + <div class="card-block min-height-190"> + <h2 class="card-title">Search SciPost Commentaries:</h2> + <form action="{% url 'commentaries:commentaries' %}" class="small" method="get"> + {{ form|bootstrap:'4,8,sm' }} + <input class="btn btn-sm btn-secondary" type="submit"/> + </form> + </div> </div> </div> <div class="col-md-4"> - <div class="panel page-header-panel"> - <h2>View SciPost Commentaries</h2> - <ul> - <li>Physics: last <a href="{% url 'commentaries:browse' discipline='physics' nrweeksback=1 %}">week</a>, <a href="{% url 'commentaries:browse' discipline='physics' nrweeksback=4 %}">month</a> or <a href="{% url 'commentaries:browse' discipline='physics' nrweeksback=52 %}">year</a> </li> - </ul> + <div class="card card-grey"> + <div class="card-block min-height-190"> + <h2 class="card-title">View SciPost Commentaries</h2> + <ul> + <li>Physics: last <a href="{% url 'commentaries:browse' discipline='physics' nrweeksback=1 %}">week</a>, <a href="{% url 'commentaries:browse' discipline='physics' nrweeksback=4 %}">month</a> or <a href="{% url 'commentaries:browse' discipline='physics' nrweeksback=52 %}">year</a> </li> + </ul> + </div> </div> </div> </div> {% if not browse and recent %} +<hr> <div class="row"> <div class="col-12"> - <hr class="hr12"> <h2>Recent Comments</h2> - <ul> + </div> + <div class="col-12"> + <ul class="list-group list-group-flush"> {% for comment in comment_list %} - {{ comment.simple_header_as_li }} + <li class="list-group-item"> + {% include 'comments/_comment_card_content.html' with comment=comment %} + </li> {% endfor %} </ul> </div> </div> {% endif %} +<hr> <div class="row"> <div class="col-12"> - <hr class="hr12"> {% if recent %} <h2>Recently active Commentaries:</h2> {% elif browse %} @@ -73,9 +83,15 @@ {% endif %} </p> {% endif %} - <ul> + + </div> + <div class="col-12"> + + <ul class="list-group list-group-flush"> {% for object in object_list %} - {% include 'commentaries/commentary_header_li.html' with object=object %} + <li class="list-group-item"> + {% include 'commentaries/_commentary_card_content.html' with commentary=object %} + </li> {% endfor %} </ul> {% else %} diff --git a/commentaries/templates/commentaries/request_commentary.html b/commentaries/templates/commentaries/request_commentary.html index 99409292c3a2ad78fff5e2383fac45f1e164ad29..dec478082ee981283b6a946ff54db43c78383faa 100644 --- a/commentaries/templates/commentaries/request_commentary.html +++ b/commentaries/templates/commentaries/request_commentary.html @@ -84,7 +84,7 @@ {% if errormessage %} <h3 style="color: red;">Error: {{ errormessage }}</h3> {% if existing_commentary %} - <ul>{% include 'commentaries/commentary_header_li.html' with object=existing_commentary %}</ul> + <ul>{% include 'commentaries/_commentary_card_content.html' with object=existing_commentary %}</ul> {% endif %} <br/> {% endif %} diff --git a/commentaries/views.py b/commentaries/views.py index e103063d5ff6074d4a37aa0137a51efb166697cd..6a2dbb3754926722cd3b69682aa0c2257863b758 100644 --- a/commentaries/views.py +++ b/commentaries/views.py @@ -7,6 +7,7 @@ from django.contrib.auth.decorators import permission_required from django.contrib.auth.mixins import LoginRequiredMixin from django.core.mail import EmailMessage from django.core.urlresolvers import reverse, reverse_lazy +from django.db.models import Q from django.shortcuts import redirect from django.template.loader import render_to_string from django.views.generic.edit import CreateView, FormView @@ -282,9 +283,12 @@ class CommentaryListView(ListView): context = super().get_context_data(**kwargs) # Get newest comments - context['comment_list'] = Comment.objects.vetted().select_related( - 'author__user', 'submission', 'commentary').order_by( - '-date_submitted')[:10] + context['comment_list'] = (Comment.objects.vetted() + .filter(Q(commentary__isnull=False) | + Q(submission__isnull=False) | + Q(thesislink__isnull=False)) + .select_related('author__user', 'submission', 'commentary') + .order_by('-date_submitted')[:10]) # Form into the context! context['form'] = self.form diff --git a/comments/models.py b/comments/models.py index 3851d0737a0a93519a09ae986e63be0dad6498f5..eff1cf1f0f6dfc5799433cc6f666a4649a722aa0 100644 --- a/comments/models.py +++ b/comments/models.py @@ -56,7 +56,7 @@ class Comment(TimeStampedModel): submission = models.ForeignKey(Submission, blank=True, null=True, on_delete=models.CASCADE) thesislink = models.ForeignKey(ThesisLink, blank=True, null=True, on_delete=models.CASCADE) is_author_reply = models.BooleanField(default=False) - in_reply_to_comment = models.ForeignKey('self', blank=True, null=True, on_delete=models.CASCADE) + in_reply_to_comment = models.ForeignKey('self', blank=True, null=True, related_name="nested_comments", on_delete=models.CASCADE) in_reply_to_report = models.ForeignKey(Report, blank=True, null=True, on_delete=models.CASCADE) author = models.ForeignKey(Contributor, on_delete=models.CASCADE) anonymous = models.BooleanField(default=False, verbose_name='Publish anonymously') @@ -90,6 +90,19 @@ class Comment(TimeStampedModel): return ('by ' + self.author.user.first_name + ' ' + self.author.user.last_name + ' on ' + self.date_submitted.strftime('%Y-%m-%d') + ', ' + self.comment_text[:30]) + def get_author(self): + '''Get author, if and only if comment is not anonymous!!!''' + if not self.anonymous: + return self.author + return None + + def get_author_str(self): + '''Get author string, if and only if comment is not anonymous!!!''' + author = self.get_author() + if author: + return author.user.first_name + ' ' + author.user.last_name + return 'Anonymous' + def update_opinions(self, contributor_id, opinion): contributor = get_object_or_404(Contributor, pk=contributor_id) self.in_agreement.remove(contributor) @@ -216,104 +229,6 @@ class Comment(TimeStampedModel): template = Template(output) return template.render(context) - def header_as_li(self): - # for search lists - header = '<li>' - # header += '<div class="flex-container"><div class="flex-whitebox0">' - header += 'Nr {{ id }}' - context = Context({'id': self.id}) - header += ', <div class="opinionsDisplay">' + self.opinions_as_ul_tiny() + '</div>' - if self.status <= 0: - header += (', status: <span style="color:red">' - + comment_status_dict[self.status] + '</span>') - text_cut = self.comment_text[:50] - if len(self.comment_text) > 50: - text_cut += '...' - context['id'] = self.id - context['text_cut'] = text_cut - context['date_submitted'] = self.date_submitted.strftime("%Y-%m-%d") - header += ': ' - if not self.anonymous: - header += (' <a href="/contributor/{{ author_id }}">' - '{{ first_name }} {{ last_name }}</a>, ') - context['author_id'] = self.author.id - context['first_name'] = self.author.user.first_name - context['last_name'] = self.author.user.last_name - if self.submission is not None: - header += ('<a href="/submission/{{ arxiv_identifier_w_vn_nr }}#comment_id{{ id }}">' - ' \"{{ text_cut }}\"</a><p>submitted on {{ date_submitted }}') - header += (' in submission on <a href="/submission/{{ arxiv_identifier_w_vn_nr }}"' - ' class="pubtitleli">{{ submission_title }}</a> by ' - '{{ submission_author_list }}</p>') - context['arxiv_identifier_w_vn_nr'] = self.submission.arxiv_identifier_w_vn_nr - context['submission_title'] = self.submission.title - context['submission_author_list'] = self.submission.author_list - if self.commentary is not None: - header += ('<a href="/commentary/{{ commentary_url }}#comment_id{{ id }}">' - ' \"{{ text_cut }}\"</a><p>submitted on {{ date_submitted }}') - header += (' in commentary on <a href="/commentary/{{ commentary_url }}"' - ' class="pubtitleli">' - '{{ commentary_pub_title }}</a> by {{ commentary_author_list }}</p>') - context['commentary_url'] = self.commentary.arxiv_or_DOI_string - context['commentary_pub_title'] = self.commentary.pub_title - context['commentary_author_list'] = self.commentary.author_list - if self.thesislink is not None: - header += ('<a href="/thesis/{{ thesislink_id }}#comment_id{{ id }}">' - ' \"{{ text_cut }}\"</a><p>submitted on {{ date_submitted }}') - header += (' in thesislink on ' - '<a href="/thesis/{{ thesislink_id }}" class="pubtitleli">' - '{{ thesislink_title }}</a> by {{ thesislink_author }}</p>') - context['thesislink_id'] = self.thesislink.id - context['thesislink_title'] = self.thesislink.title - context['thesislink_author'] = self.thesislink.author - # header += '</div></div>' - header += '</li>' - template = Template(header) - return template.render(context) - - def simple_header_as_li(self): - # for Lists - header = '<li>' - # header += '<div class="flex-container"><div class="flex-whitebox0">' - context = Context({}) - text_cut = self.comment_text[:30] - if len(self.comment_text) > 30: - text_cut += '...' - context['text_cut'] = text_cut - if not self.anonymous: - header += ' <a href="/contributor/{{ author_id }}">{{ first_name }} {{ last_name }}</a>, ' - context['author_id'] = self.author.id - context['first_name'] = self.author.user.first_name - context['last_name'] = self.author.user.last_name - if self.submission is not None: - header += ('<a href="/submission/{{ arxiv_identifier_w_vn_nr }}#comment_id{{ id }}"> ' - '\"{{ text_cut }}\"</a>' - ' in submission on <a href="/submission/{{ arxiv_identifier_w_vn_nr }}" class="pubtitleli">' - '{{ submission_title }}</a> by {{ submission_author_list }}</p>') - context['arxiv_identifier_w_vn_nr'] = self.submission.arxiv_identifier_w_vn_nr - context['submission_title'] = self.submission.title - context['submission_author_list'] = self.submission.author_list - if self.commentary is not None: - header += ('<a href="/commentary/{{ commentary_url }}#comment_id{{ id }}"> ' - '\"{{ text_cut }}\"</a>' - ' in commentary on <a href="/commentary/{{ commentary_url }}" class="pubtitleli">' - '{{ commentary_pub_title }}</a> by {{ commentary_author_list }}</p>') - context['commentary_url'] = self.commentary.arxiv_or_DOI_string - context['commentary_pub_title'] = self.commentary.pub_title - context['commentary_author_list'] = self.commentary.author_list - if self.thesislink is not None: - header += '<a href="/thesis/{{ thesislink_id }}#comment_id{{ id }}"> \"{{ text_cut }}\"</a>' - header += (' in thesislink on ' - '<a href="/thesis/{{ thesislink_id }}" class="pubtitleli">' - '{{ thesislink_title }}</a> by {{ thesislink_author }}</p>') - context['thesislink_id'] = self.thesislink.id - context['thesislink_title'] = self.thesislink.title - context['thesislink_author'] = self.thesislink.author - # header += '</div></div>' - header += '</li>' - template = Template(header) - return template.render(context) - def categories_as_ul(self): output = '<div class="commentcategorydisplay"><h4>Category:</h4><ul>' if self.is_rem: diff --git a/comments/templates/comments/_comment_card_content.html b/comments/templates/comments/_comment_card_content.html new file mode 100644 index 0000000000000000000000000000000000000000..d4cec6b538ca30ec1de1c5c2f770f2c6bfd9b5d4 --- /dev/null +++ b/comments/templates/comments/_comment_card_content.html @@ -0,0 +1,31 @@ +<div class="card-block card-comment"> + {% block card_block_header %}{% endblock %} + <p class="card-text"> + <span class="text-blue"> + <a href="{% if comment.get_author %}{% url 'scipost:contributor_info' comment.get_author.id %}{% else %}javascript:;{% endif %}">{{comment.get_author_str}}</a>: + </span> + + {% if comment.submission %} + <a href="{% url 'submissions:submission' comment.submission.arxiv_identifier_w_vn_nr %}#comment_id{{comment.id}}"> + "{{comment.comment_text|slice:'30'}}{% if comment.comment_text|length > 30 %}...{% endif %}" + </a> + </p><p class="card-text pl-md-3"> + in submission on <a href="{% url 'submissions:submission' comment.submission.arxiv_identifier_w_vn_nr %}" class="pubtitleli">{{comment.submission.title}}</a> + <span class="text-muted">by {{comment.submission.author_list}}</span> + {% elif comment.commentary %} + <a href="{% url 'commentaries:commentary' comment.commentary.arxiv_or_DOI_string %}#comment_id{{comment.id}}"> + "{{comment.comment_text|slice:'30'}}{% if comment.comment_text|length > 30 %}...{% endif %}" + </a> + </p><p class="card-text pl-md-3"> + in commentary on <a href="{% url 'commentaries:commentary' comment.commentary.arxiv_or_DOI_string %}" class="pubtitleli">{{comment.commentary.pub_title}}</a> + <span class="text-muted">by {{comment.commentary.author_list}}</span> + {% elif comment.thesislink %} + <a href="{% url 'commentaries:commentary' comment.commentary.arxiv_or_DOI_string %}#comment_id{{comment.id}}"> + "{{comment.comment_text|slice:'30'}}{% if comment.comment_text|length > 30 %}...{% endif %}" + </a> + </p><p class="card-text pl-md-3"> + in thesislink on <a href="{% url 'theses:thesis' comment.thesislink.id %}" class="pubtitleli">{{comment.thesislink.title}}</a> + <span class="text-muted">by {{ comment.thesislink.author }}</span> + {% endif %} + </p> +</div> diff --git a/comments/templates/comments/_comment_card_extended_content.html b/comments/templates/comments/_comment_card_extended_content.html new file mode 100644 index 0000000000000000000000000000000000000000..168b2eef9c649099eef5062d4a35d3fa13f56004 --- /dev/null +++ b/comments/templates/comments/_comment_card_extended_content.html @@ -0,0 +1,8 @@ +{% extends 'comments/_comment_card_content.html' %} + +{% block card_block_header %} + <div class="mb-2"> + <div class="d-inline-block mr-1">Nr {{comment.id}}</div> + {% include 'comments/_comment_voting_summary.html' with comment=comment class='small' %} + </div> +{% endblock %} diff --git a/comments/templates/comments/_comment_categories.html b/comments/templates/comments/_comment_categories.html new file mode 100644 index 0000000000000000000000000000000000000000..fec5707adee9e21640e36ce5c4d8208df2ee2893 --- /dev/null +++ b/comments/templates/comments/_comment_categories.html @@ -0,0 +1,30 @@ +<div class="btn-group category-group {{class}}"> + <label class="btn btn-secondary name">Category:</label> + {% if comment.is_rem %} + <label class="btn btn-secondary"><span class="inner">remark</spin></label> + {% endif %} + {% if comment.is_que %} + <label class="btn btn-secondary"><span class="inner">question</spin></label> + {% endif %} + {% if comment.is_ans %} + <label class="btn btn-secondary"><span class="inner">answer to question</spin></label> + {% endif %} + {% if comment.is_obj %} + <label class="btn btn-secondary"><span class="inner">objection</spin></label> + {% endif %} + {% if comment.is_rep %} + <label class="btn btn-secondary"><span class="inner">reply to objection</spin></label> + {% endif %} + {% if comment.is_cor %} + <label class="btn btn-secondary"><span class="inner">correction</spin></label> + {% endif %} + {% if comment.is_val %} + <label class="btn btn-secondary"><span class="inner">validation or rederivation</spin></label> + {% endif %} + {% if comment.is_lit %} + <label class="btn btn-secondary"><span class="inner">pointer to related literature</spin></label> + {% endif %} + {% if comment.is_sug %} + <label class="btn btn-secondary"><span class="inner">suggestion for further work</spin></label> + {% endif %} +</div> diff --git a/comments/templates/comments/_comment_voting_form.html b/comments/templates/comments/_comment_voting_form.html new file mode 100644 index 0000000000000000000000000000000000000000..1563284d7cfd90111e4864b04809f642d3d05b47 --- /dev/null +++ b/comments/templates/comments/_comment_voting_form.html @@ -0,0 +1,20 @@ +{% if user.is_authenticated and perms.scipost.can_express_opinion_on_comments %} + {% if user.contributor != comment.author %} + <div class="btn-group voting-group {{class}}"> + <form action="{% url 'comments:express_opinion' comment_id=comment.id opinion='A' %}" method="post"> + {% csrf_token %} + <input type="submit" class="btn agree" value="Agree {{ comment.nr_A }}"/> + </form> + <form action="{% url 'comments:express_opinion' comment_id=comment.id opinion='N' %}" method="post"> + {% csrf_token %} + <input type="submit" class="btn neutral" value="Not sure {{ comment.nr_N }}"/> + </form> + <form action="{% url 'comments:express_opinion' comment_id=comment.id opinion='D'%}" method="post"> + {% csrf_token %} + <input type="submit" class="btn disagree" value="Disagree {{ comment.nr_D }}"/> + </form> + </div> + {% else %} + {% include 'comments/_comment_voting_summary.html' with comment=comment %} + {% endif %} +{% endif %} diff --git a/comments/templates/comments/_comment_voting_summary.html b/comments/templates/comments/_comment_voting_summary.html new file mode 100644 index 0000000000000000000000000000000000000000..b57fb55e3572fd01a3b6698ba201dc737dda0077 --- /dev/null +++ b/comments/templates/comments/_comment_voting_summary.html @@ -0,0 +1,5 @@ +<div class="btn-group voting-group {{class}}"> + <label class="btn agree">Agree {{ comment.nr_A }}</label> + <label class="btn neutral">Not sure {{ comment.nr_N }}</label> + <label class="btn disagree">Disagree {{ comment.nr_D }}</label> +</div> diff --git a/comments/templates/comments/_single_comment.html b/comments/templates/comments/_single_comment.html new file mode 100644 index 0000000000000000000000000000000000000000..84a01f82c7516645d75c49cb00a1fe976da6fb73 --- /dev/null +++ b/comments/templates/comments/_single_comment.html @@ -0,0 +1,54 @@ +{% load scipost_extras %} +{% load filename %} +{% load file_extentions %} + +<div class="row"> + <div class="col-12"> + <div class="comment" id="comment_id{{comment.id}}"> + + <div class="row"> + <div class="col-12"> + {{ comment.print_identifier }} + + {% include 'comments/_comment_categories.html' with comment=comment class='mr-2' %} + + {% include 'comments/_comment_voting_form.html' with comment=comment perms=perms user=user %} + </div> + </div> + + + <div class="row"> + <div class="col-12"> + <p> + {{ comment.comment_text|linebreaks }} + + {% if comment.file_attachment %} + <h3>Attachment:</h3> + <p> + <a target="_blank" href="{{ comment.file_attachment.url }}"> + {% if comment.file_attachment|is_image %} + <img class="attachment attachment-comment" src="{{ comment.file_attachment.url }}"> + {% else %} + {{ comment.file_attachment|filename }}<br><small>{{ comment.file_attachment.size|filesizeformat }}</small> + {% endif %} + </a> + </p> + {% endif %} + </p> + {% if user|is_in_group:'Editorial College' or user|is_in_group:'Editorial Administrators' %} + {% if comment.remarks_for_editors %} + <h3>Remarks for editors:</h3> + <p>{{ comment.remarks_for_editors|linebreaks }}</p> + {% endif %} + {% endif %} + </div> + </div> + + {% for reply in comment.nested_comments.vetted %} + {% include 'comments/_single_comment.html' with comment=reply perms=perms user=user %} + {% endfor %} + + {% block comment_footer %}{% endblock %} + </div> + </div> +</div> diff --git a/comments/templates/comments/_single_comment_with_link.html b/comments/templates/comments/_single_comment_with_link.html new file mode 100644 index 0000000000000000000000000000000000000000..06cf9a4b95f2bb72bfe3d90b5ed87eac4b8e0b73 --- /dev/null +++ b/comments/templates/comments/_single_comment_with_link.html @@ -0,0 +1,12 @@ +{% extends 'comments/_single_comment.html' %} + +{% block comment_footer %} + {% if user.is_authenticated and perms.scipost.can_submit_comments %} + <hr class="small"> + <div class="row"> + <div class="col-12"> + <h3><a href="{% url 'comments:reply_to_comment' comment_id=comment.id %}">Reply to this comment</a></h3> + </div> + </div> + {% endif %} +{% endblock %} diff --git a/comments/templates/comments/reply_to_comment.html b/comments/templates/comments/reply_to_comment.html index a31a2a92d8160f143c72c1e9dca36a81c275ccaa..3f2b8e81a153f0ee890db3e4b19657607d52db56 100644 --- a/comments/templates/comments/reply_to_comment.html +++ b/comments/templates/comments/reply_to_comment.html @@ -69,10 +69,10 @@ <div class="col-12"> <div class="comment"> {{ comment.print_identifier }} - {{ comment.categories_as_ul }} - <div class="opinionsDisplay"> - {{ comment.opinions_as_ul }} - </div> + + {% include 'comments/_comment_categories.html' with comment=comment class='mr-2' %} + + {% include 'comments/_comment_voting_summary.html' with comment=comment %} <p>{{ comment.comment_text|linebreaks }}</p> </div> diff --git a/journals/models.py b/journals/models.py index d858d6bcc51394a7f299831ae2f5011494c52e87..2a07b982f244e93be2dcc1641ce93fe93b03948e 100644 --- a/journals/models.py +++ b/journals/models.py @@ -307,29 +307,6 @@ class Publication(models.Model): 'year': self.publication_date.strftime('%Y'), }) return template.render(context) - def header_as_li(self): - header = ('<div class="publicationHeader">' - '<h3 class="publicationTitle"><a href="{% url \'scipost:publication_detail\' doi_string=doi_string %}">{{ title }}</a></h3>' - '<p class="publicationAuthors">{{ author_list }}</p>' - '<p class="publicationReference">{{ citation }} ' - '| published {{ pub_date }}</p>' - '<p class="publicationAbstract">{{ abstract }}</p>' - '<ul class="publicationClickables">' - '<li><button class="btn btn-secondary toggleAbstractButton">Toggle abstract</button></li>' - '<li class="publicationPDF"><a href="{% url \'scipost:publication_pdf\' doi_string=doi_string %}" target="_blank">pdf</a></li>' - '</ul>' - '</div>') - template = Template(header) - context = Context({ - 'doi_string': self.doi_string, - 'title': self.title, - 'author_list': self.author_list, - 'citation': self.citation, - 'pub_date': self.publication_date.strftime('%d %B %Y'), - 'abstract': self.abstract, - }) - return template.render(context) - def details(self): """ This method is called from the publication_detail template. diff --git a/journals/templates/journals/_publication_card_content.html b/journals/templates/journals/_publication_card_content.html new file mode 100644 index 0000000000000000000000000000000000000000..68cb6396513fd7f0804c2a5e8f14f03a5c3b765b --- /dev/null +++ b/journals/templates/journals/_publication_card_content.html @@ -0,0 +1,12 @@ +<div class="card-header"> + <h3><a href="{% url 'scipost:publication_detail' publication.doi_string %}">{{ publication.title }}</a></h3> +</div> +<div class="card-block publication-{{publication.id}}"> + <p>{{ publication.author_list }}</p> + <p>{{ publication.citation }} | published {{ publication.publication_date|date:'j F Y' }}</p> + <p class="abstract" style="display:none;">{{ publication.abstract }}</p> + <div class="actions"> + <button class="btn btn-secondary mr-3" data-toggle="toggle" data-target=".card-block.publication-{{publication.id}} .abstract">Toggle abstract</button> + <a href="{% url 'scipost:publication_pdf' publication.doi_string %}" target="_blank">pdf</a> + </div> +</div> diff --git a/journals/templates/journals/scipost_physics.html b/journals/templates/journals/scipost_physics.html index 4ed754b5d0b5f509f600d7211f8fbe235e262323..6aa469bf679dd86baad9e131540a4e0758f8219c 100644 --- a/journals/templates/journals/scipost_physics.html +++ b/journals/templates/journals/scipost_physics.html @@ -2,21 +2,6 @@ {% block pagetitle %}: SciPost Physics{% endblock pagetitle %} -{% block headsup %} - -<script> - $(document).ready(function(){ - - $(".publicationAbstract").hide(); - - $(".toggleAbstractButton").click(function(){ - $(this).parent("li").parent("ul").siblings("p.publicationAbstract").toggle(); - }); - }); -</script> - -{% endblock headsup %} - {% block content %} {% include 'journals/scipost_physics_menu.html' %} @@ -32,11 +17,13 @@ <div class="publicationHeaderList"> <div class="row"> - {% for paper in current_issue.publication_set.all|dictsort:"paper_nr" %} - <div class="col-12"> - {{ paper.header_as_li }} - </div> - {% endfor %} + <div class="col-12"> + {% for paper in current_issue.publication_set.all|dictsort:"paper_nr" %} + <div class="card card-publication"> + {% include 'journals/_publication_card_content.html' with publication=paper %} + </div> + {% endfor %} + </div> </div> </div> <hr> @@ -53,11 +40,13 @@ <div class="publicationHeaderList"> <div class="row"> - {% for paper in latest_issue.publication_set.all|dictsort:"paper_nr" %} - <div class="col-12"> - {{ paper.header_as_li }} - </div> - {% endfor %} + <div class="col-12"> + {% for paper in latest_issue.publication_set.all|dictsort:"paper_nr" %} + <div class="card card-publication"> + {% include 'journals/_publication_card_content.html' with publication=paper %} + </div> + {% endfor %} + </div> </div> </div> {% endif %} diff --git a/journals/templates/journals/scipost_physics_accepted.html b/journals/templates/journals/scipost_physics_accepted.html index d4ff241e74faaac3b9675fa1c41d3e67e6228c91..fc820ce148524ecff2f1aaacf42b3286bde04e8c 100644 --- a/journals/templates/journals/scipost_physics_accepted.html +++ b/journals/templates/journals/scipost_physics_accepted.html @@ -17,9 +17,11 @@ <div class="row"> <div class="col-12"> {% if accepted_SP_submissions %} - <ul> + <ul class="list-group list-group-flush"> {% for submission in accepted_SP_submissions %} - {{ submission.header_as_li }} + <li class="list-group-item"> + {% include 'submissions/_submission_card_content.html' with submission=submission %} + </li> {% endfor %} </ul> {% else %} diff --git a/journals/templates/journals/scipost_physics_issue_detail.html b/journals/templates/journals/scipost_physics_issue_detail.html index c153f276d52fedb4a7b0e5f8a9cadda20d4875ef..7906d350b003b1ca7173bf7783b1d5970feb96a1 100644 --- a/journals/templates/journals/scipost_physics_issue_detail.html +++ b/journals/templates/journals/scipost_physics_issue_detail.html @@ -4,17 +4,6 @@ {% block headsup %} -<script> - $(document).ready(function(){ - - $(".publicationAbstract").hide(); - - $(".toggleAbstractButton").click(function(){ - $(this).parent("li").parent("ul").siblings("p.publicationAbstract").toggle(); - }); - }); -</script> - {% endblock headsup %} {% block content %} @@ -31,13 +20,13 @@ <div class="publicationHeaderList"> <div class="row"> - {% for paper in papers %} - <div class="col-12"> - <div class="panel"> - {{ paper.header_as_li }} + <div class="col-12"> + {% for paper in papers %} + <div class="card card-publication"> + {% include 'journals/_publication_card_content.html' with publication=paper %} </div> - </div> - {% endfor %} + {% endfor %} + </div> </div> </div> diff --git a/journals/templates/journals/scipost_physics_menu.html b/journals/templates/journals/scipost_physics_menu.html index 3f6a16a2cc605b5ff52873b6bc9a04f997330f1c..093a6e941c80ac01a7389b9fad30a7a700ad6c98 100644 --- a/journals/templates/journals/scipost_physics_menu.html +++ b/journals/templates/journals/scipost_physics_menu.html @@ -1,9 +1,7 @@ <ul class="SciPostPhysicsTabMenu"> <li> - <div class="SciPostPhysicsTab"> - <h3><a href="{% url 'journals:scipost_physics' %}">SciPost Physics</a></h3> - </div> + <h3 class="banner py-2"><a href="{% url 'journals:scipost_physics' %}">SciPost Physics</a></h3> </li> <li><a href="{% url 'journals:scipost_physics_issues' %}">Issues</li> <li><a href="{% url 'journals:scipost_physics_recent' %}">Recent</li> diff --git a/journals/templates/journals/scipost_physics_recent.html b/journals/templates/journals/scipost_physics_recent.html index a0340ae76be42a86c6add47b0e629b080eb40bae..8ec348d99b4e36c8f160f5f1e82b11502eb92af7 100644 --- a/journals/templates/journals/scipost_physics_recent.html +++ b/journals/templates/journals/scipost_physics_recent.html @@ -2,19 +2,6 @@ {% block pagetitle %}: SciPost Physics: recent{% endblock pagetitle %} -{% block headsup %} -<script> - $(document).ready(function(){ - - $(".publicationAbstract").hide(); - - $(".toggleAbstractButton").click(function(){ - $(this).parent("li").parent("ul").siblings("p.publicationAbstract").toggle(); - }); - }); -</script> -{% endblock headsup %} - {% block content %} {% include 'journals/scipost_physics_menu.html' %} @@ -30,11 +17,13 @@ {% if recent_papers %} <div class="publicationHeaderList"> <div class="row"> - {% for paper in recent_papers %} - <div class="col-12"> - {{ paper.header_as_li }} - </div> - {% endfor %} + <div class="col-12"> + {% for paper in recent_papers %} + <div class="card card-publication"> + {% include 'journals/_publication_card_content.html' with publication=paper %} + </div> + {% endfor %} + </div> </div> </div> {% endif %} diff --git a/journals/templates/journals/validate_publication.html b/journals/templates/journals/validate_publication.html index a9245987880f9d174621755158794e5091096201..e2fd2cd90b373a7ca0e1a2ec5c48a5e52d452c4d 100644 --- a/journals/templates/journals/validate_publication.html +++ b/journals/templates/journals/validate_publication.html @@ -1,26 +1,29 @@ {% extends 'scipost/base.html' %} -{% block pagetitle %}: Validate publication{% endblock pagetitle %} - -{% block bodysup %} - - -<section> - <div class="flex-greybox"> - <h1>Validate publication page</h1> - </div> - - {% if errormessage %} - <h2 style="color: red;">{{ errormessage }}</h2> - {% endif %} - - <form action="{% url 'journals:validate_publication' %}" method="post" enctype="multipart/form-data"> - {% csrf_token %} - {{ validate_publication_form.as_p }} - <input type="submit" value="Submit"> - </form> - -</section> +{% load bootstrap %} +{% block pagetitle %}: Validate publication{% endblock pagetitle %} -{% endblock bodysup %} +{% block content %} + +<div class="row"> + <div class="col-12"> + <h1 class="highlight">Validate publication page</h1> + </div> +</div> + +<div class="row"> + <div class="col-lg-10 offset-lg-1"> + {% if errormessage %} + <h2 style="color: red;">{{ errormessage }}</h2> + {% endif %} + + <form action="{% url 'journals:validate_publication' %}" method="post" enctype="multipart/form-data"> + {% csrf_token %} + {{ validate_publication_form|bootstrap }} + <input class="btn btn-secondary" type="submit" value="Submit"> + </form> + </div> +</div> + +{% endblock content %} diff --git a/scipost/static/scipost/assets/css/_buttons.scss b/scipost/static/scipost/assets/css/_buttons.scss index 90781a20da4ef3d3fb0a51dc4953bef2e104771a..3646c5181e9edd3179e727450cadb28d9ebdb5d3 100644 --- a/scipost/static/scipost/assets/css/_buttons.scss +++ b/scipost/static/scipost/assets/css/_buttons.scss @@ -6,3 +6,56 @@ cursor: pointer; font-family: inherit; } + +.category-group, +.voting-group { + border-radius: 0.05rem; + + .btn { + color: #fff; + box-shadow: 0 1px 1px 0 #ccc; + border-color: #ccc; + margin: 0; + font-size: 0.7rem; + border-radius: 0.05rem; + cursor: default; + + &.agree { + background-color: $scipost-darkblue; + } + &.neutral { + background-color: $scipost-lightblue; + } + &.disagree { + background-color: $red; + } + } + + &.small .btn { + font-size: 0.55rem; + } + + form .btn { + cursor: pointer; + + &.agree:hover { + background-color: #004f86; + } + &.neutral:hover { + background-color: #045f9e; + } + &.disagree:hover { + background-color: #c9302c; + } + } +} + +.category-group .btn { + color: #333; + background-color: #fafafa; + + &.name { + background-color: #ddd; + color: #002b49; + } +} diff --git a/scipost/static/scipost/assets/css/_cards.scss b/scipost/static/scipost/assets/css/_cards.scss index 2fe5f997e617af4967c022c0c15eb03bb448fd0a..129e0b047f5212a83c6af050d2aefcbde7813321 100644 --- a/scipost/static/scipost/assets/css/_cards.scss +++ b/scipost/static/scipost/assets/css/_cards.scss @@ -4,6 +4,16 @@ &.card-grey { background-color: #F4F4F4; } + + &.card-publication { + .card-header { + background-color: #eee; + } + + .card-block { + background-color: #f8f8f8; + } + } } .list-group-item > .card-block { @@ -14,3 +24,7 @@ .card-text { margin-bottom: 0.25rem; } + +.card-subtitle { + line-height: 1.5; +} diff --git a/scipost/static/scipost/assets/css/_general.scss b/scipost/static/scipost/assets/css/_general.scss new file mode 100644 index 0000000000000000000000000000000000000000..3a7a8095d4f6d2e860e636ba811e23613fca7852 --- /dev/null +++ b/scipost/static/scipost/assets/css/_general.scss @@ -0,0 +1,11 @@ +.banner { + background-color: #002b49; + line-height: 1.5; + padding: 10px 20px; + text-align: center; + + &, + a { + color: #FFA300; + } +} diff --git a/scipost/static/scipost/assets/css/_submissions.scss b/scipost/static/scipost/assets/css/_submissions.scss index a2c299931cd9ce9a2306612835ffb2cc03deee72..0b8166e69f7fbc3991d9dcf59e17a1c753f89d2d 100644 --- a/scipost/static/scipost/assets/css/_submissions.scss +++ b/scipost/static/scipost/assets/css/_submissions.scss @@ -27,4 +27,8 @@ table.submission_header { background-color: $brand-danger; color: $white; border-radius: $card-border-radius; + + &.no-actions { + background-color: $brand-success; + } } diff --git a/scipost/static/scipost/assets/css/_type.scss b/scipost/static/scipost/assets/css/_type.scss index f352738152fabc94e77a394155b560e9946840c1..582c6c9b7157aa28bc23d34aef50cb27e97ce7cf 100644 --- a/scipost/static/scipost/assets/css/_type.scss +++ b/scipost/static/scipost/assets/css/_type.scss @@ -28,11 +28,22 @@ h1, h2, h3, h4, h5, h6 { padding: 3px 5px; } } +.highlight-inline { + padding: 0.15rem 0.3rem; + background-color: #f4f4f4; + border-radius: 0.15rem; + color: #6884C2; +} + h1.highlight, h2.highlight { padding: 15px; } +h3.highlight { + padding: 10px; +} + hr, hr.hr12 { height: 3px; diff --git a/scipost/static/scipost/assets/css/style.scss b/scipost/static/scipost/assets/css/style.scss index 50ebdb189857fbc100f2cd5e0b7f5098941bafa0..17cfeb51944c746c682c388bf64b816cbbab679b 100644 --- a/scipost/static/scipost/assets/css/style.scss +++ b/scipost/static/scipost/assets/css/style.scss @@ -34,6 +34,8 @@ * SciPost Specific * */ +@import "general"; + @import "about"; @import "comments"; @import "journals"; diff --git a/scipost/static/scipost/assets/js/scripts.js b/scipost/static/scipost/assets/js/scripts.js index 001f02c0ead487734d86757d0d303035c10f7343..ff2b6d6312ad34227951b20ec566e1ba7841ace8 100644 --- a/scipost/static/scipost/assets/js/scripts.js +++ b/scipost/static/scipost/assets/js/scripts.js @@ -5,4 +5,9 @@ function hide_all_alerts() { $(function(){ // Remove all alerts in screen automatically after 10sec. setTimeout(function() {hide_all_alerts()}, 10000); + + // Start general toggle + $('[data-toggle="toggle"]').on('click', function() { + $($(this).attr('data-target')).toggle(); + }); }); diff --git a/scipost/templates/scipost/Fellow_activity_overview.html b/scipost/templates/scipost/Fellow_activity_overview.html index 273de7c154e07d186decdbe4750d63948edb282e..3e2bacaa8d6f19781f406e14d306a351e64d8a80 100644 --- a/scipost/templates/scipost/Fellow_activity_overview.html +++ b/scipost/templates/scipost/Fellow_activity_overview.html @@ -2,78 +2,79 @@ {% block pagetitle %}: Overview{% endblock pagetitle %} -{% block headsup %} - -{% endblock headsup %} - -{% block bodysup %} - {% load scipost_extras %} {% load submissions_extras %} -<section> - <div class="flex-container"> - <div class="flex-greybox"> - <h1>Overview of Fellows's activities</h1> +{% block content %} + +<div class="row"> + <div class="col-12"> + <h1 class="highlight">Overview of Fellows's activities</h1> + <h3>Click on a Fellow's name to view full assignment details.</h3> </div> - </div> - <p>Click on a Fellow's name to view full assignment details.</p> - <table class="assignments_listing"> - <thead> - <th>Name</th> - <th>Expertises</th> - <th>Ongoing</th> - <th>Assignments<br/>last yr / tot</th> - <th>Accepted<br/>last yr / tot</th> - <th>Refused<br/>last yr / tot</th> - <th>Ignored<br/>last yr / tot</th> - <th>Fulfilled<br/>last yr / tot</th> - </thead> - <tbody> - {% for Fellow in Fellows %} - <tr> - <td><a href="{% url 'scipost:Fellow_activity_overview' Fellow_id=Fellow.id %}">{{ Fellow.user.last_name }}, {{ Fellow.user.first_name }}</a></td> - {{ Fellow.assignments_summary_as_td }} - </tr> - {% endfor %} - </tbody> - </table> +</div> -</section> +<div class="row"> + <div class="col-12"> + <table class="assignments_listing w-100"> + <thead> + <th>Name</th> + <th>Expertises</th> + <th>Ongoing</th> + <th>Assignments<br/>last yr / tot</th> + <th>Accepted<br/>last yr / tot</th> + <th>Refused<br/>last yr / tot</th> + <th>Ignored<br/>last yr / tot</th> + <th>Fulfilled<br/>last yr / tot</th> + </thead> + <tbody> + {% for fellow in fellows %} + <tr> + <td><a href="{% url 'scipost:Fellow_activity_overview' Fellow_id=fellow.id %}">{{ fellow.user.last_name }}, {{ fellow.user.first_name }}</a></td> + {{ fellow.assignments_summary_as_td }} + </tr> + {% endfor %} + </tbody> + </table> + </div> +</div> -{% if Fellow %} -<section> - <div class="flex-container"> - <div class="flex-greybox"> - <h1>Overview of Fellows's activities</h1> +{% if fellow %} + <div class="row"> + <div class="col-12"> + <h3 class="highlight">Assignments for {{ fellow.user.first_name }} {{ fellow.user.last_name }}</h3> + </div> </div> - </div> - <h3>Assignments for {{ Fellow.user.first_name }} {{ Fellow.user.last_name }}</h3> - <h4>Ongoing:</h4> - <ul> - {% for assignment in assignments_of_Fellow %} - {% if assignment.accepted and not assignment.completed %} - {% if request.user|is_not_author_of_submission:assignment.submission.arxiv_identifier_w_vn_nr %} - {{ assignment.header_as_li }} - {% endif %} - {% endif %} - {% endfor %} - </ul> + <div class="row"> + <div class="col-12"> + <h3>Ongoing:</h3> + </div> + <div class="col-12"> + <ul class="list-group list-group-flush"> + {% for assignment in assignments_ongoing %} + <li class="list-group-item"> + {% include 'submissions/_submission_card_contributor_content.html' with submission=assignment.submission %} + </li> + {% endfor %} + </ul> + </div> - <h4>Completed:</h4> - <ul> - {% for assignment in assignments_of_Fellow %} - {% if assignment.completed %} - {% if request.user|is_not_author_of_submission:assignment.submission.arxiv_identifier_w_vn_nr %} - {{ assignment.header_as_li }} - {% endif %} - {% endif %} - {% endfor %} - </ul> + <div class="col-12"> + <h3>Completed:</h3> + </div> + <div class="col-12"> + <ul class="list-group list-group-flush"> + {% for assignment in assignments_completed %} + <li class="list-group-item"> + {% include 'submissions/_submission_card_contributor_content.html' with submission=assignment.submission %} + </li> + {% endfor %} + </ul> + </div> + </div> -</section> {% endif %} -{% endblock bodysup %} +{% endblock content %} diff --git a/scipost/templates/scipost/about.html b/scipost/templates/scipost/about.html index 0728f95d21542d31d73333adfaeca93c40f77f22..67a8f8b996294dd966dc342df9784898968280d0 100644 --- a/scipost/templates/scipost/about.html +++ b/scipost/templates/scipost/about.html @@ -159,7 +159,7 @@ {% if codes %} <div class="row"> <div class="col-12"> - <a href="javascript:;" class="d-block mb-1" data-toggle="toggle-show" data-target="#specializations-{{college|lower}}">Show all specialization codes</a> + <a href="javascript:;" class="d-block mb-1" data-toggle="toggle-show" data-target="#specializations-{{college|lower}}">Show Fellows by specialization</a> <div id="specializations-{{college|lower}}" class="all-specializations" style="border: 1px solid; display: none;"> {% for code in codes %} <div class="specialization" data-specialization="{{code.0|lower}}">{{code.0}} - {{code.1}}</div> diff --git a/scipost/templates/scipost/claim_authorships.html b/scipost/templates/scipost/claim_authorships.html index 2554bd2ed89b73fde73120e1ff6720ae69f5d8e0..2630c6844582f8b7e476ad2063d3884044977a44 100644 --- a/scipost/templates/scipost/claim_authorships.html +++ b/scipost/templates/scipost/claim_authorships.html @@ -6,81 +6,104 @@ {% endblock headsup %} -{% block bodysup %} +{% block content %} -<section> - <div class="flex-greybox"> - <h1>Contributor Authorship Claims</h1> - </div> - - {% if submission_authorships_to_claim %} - <hr class="hr12"> - <div class="flex-greybox"> - <h1>SciPost Submissions</h1> +<div class="row"> + <div class="col-12"> + <h1 class="highlight">Contributor Authorship Claims</h1> </div> - <h3>Potential authorships to claim (auto-detected)</h3> - <ul> - {% for sub in submission_authorships_to_claim %} - {{ sub.header_as_li }} - <form action="{% url 'scipost:claim_sub_authorship' submission_id=sub.id claim=1%}" method="post"> - {% csrf_token %} - <input type="submit" value="I am an author" /> - </form> - <form action="{% url 'scipost:claim_sub_authorship' submission_id=sub.id claim=0%}" method="post"> - {% csrf_token %} - <input type="submit" value="I am not an author" /> - </form> - {% endfor %} - </ul> - {% endif %} +</div> - {% if commentary_authorships_to_claim %} - <hr class="hr12"> - <div class="flex-greybox"> - <h1>SciPost Commentaries</h1> +{% if submission_authorships_to_claim %} + <div class="row"> + <div class="col-12"> + <h2 class="highlight">SciPost Submissions</h2> + <h3>Potential authorships to claim (auto-detected)</h3> + </div> </div> - <h3>Potential authorships to claim (auto-detected)</h3> - <ul> - {% for com in commentary_authorships_to_claim %} - {{ com.header_as_li }} - <form action="{% url 'scipost:claim_com_authorship' commentary_id=com.id claim=1%}" method="post"> - {% csrf_token %} - <input type="submit" value="I am an author" /> - </form> - <form action="{% url 'scipost:claim_com_authorship' commentary_id=com.id claim=0%}" method="post"> - {% csrf_token %} - <input type="submit" value="I am not an author" /> - </form> - {% endfor %} - </ul> - {% endif %} + <div class="row"> + <div class="col-12"> + {% for sub in submission_authorships_to_claim %} + <div class="card"> + {% include 'submissions/_submission_card_content.html' with submission=sub %} + <div class="card-footer"> + <form class="d-inline-block" action="{% url 'scipost:claim_sub_authorship' submission_id=sub.id claim=1 %}" method="post"> + {% csrf_token %} + <input class="btn btn-secondary" type="submit" value="I am an author" /> + </form> + <form class="d-inline-block ml-1" action="{% url 'scipost:claim_sub_authorship' submission_id=sub.id claim=0 %}" method="post"> + {% csrf_token %} + <input class="btn btn-danger" type="submit" value="I am not an author" /> + </form> + </div> + </div> + {% endfor %} + </div> + </div> +{% endif %} - {% if thesis_authorships_to_claim %} - <hr class="hr12"> - <div class="flex-greybox"> - <h1>SciPost Thesis Links</h1> +{% if commentary_authorships_to_claim %} + <div class="row"> + <div class="col-12"> + <h2 class="highlight">SciPost Commentaries</h2> + <h3>Potential authorships to claim (auto-detected)</h3> + </div> + </div> + <div class="row"> + <div class="col-12"> + {% for com in commentary_authorships_to_claim %} + <div class="card"> + {% include 'commentaries/_commentary_card_content.html' with commentary=com %} + <div class="card-footer"> + <form class="d-inline-block" action="{% url 'scipost:claim_com_authorship' commentary_id=com.id claim=1 %}" method="post"> + {% csrf_token %} + <input class="btn btn-secondary" type="submit" value="I am an author" /> + </form> + <form class="d-inline-block ml-1" action="{% url 'scipost:claim_com_authorship' commentary_id=com.id claim=0 %}" method="post"> + {% csrf_token %} + <input class="btn btn-danger" type="submit" value="I am not an author" /> + </form> + </div> + </div> + {% endfor %} + </div> </div> - <h3>Potential authorships to claim (auto-detected)</h3> - <ul> - {% for thesis in thesis_authorships_to_claim %} - {% include 'theses/_thesislink_header_as_li.html' with thesislink=thesis %} - <form action="{% url 'scipost:claim_thesis_authorship' thesis_id=thesis.id claim=1%}" method="post"> - {% csrf_token %} - <input type="submit" value="I am an author" /> - </form> - <form action="{% url 'scipost:claim_thesis_authorship' thesis_id=thesis.id claim=0%}" method="post"> - {% csrf_token %} - <input type="submit" value="I am not an author" /> - </form> - {% endfor %} - </ul> {% endif %} - {% if not submission_authorships_to_claim and not commentary_authorships_to_claim and not thesis_authorships_to_claim %} - <hr class="hr12"> - <h1>You have no authorships to claim</h1> - {% endif %} +{% if thesis_authorships_to_claim %} + <div class="row"> + <div class="col-12"> + <h2 class="highlight">SciPost Thesis Links</h2> + <h3>Potential authorships to claim (auto-detected)</h3> + </div> + </div> + <div class="row"> + <div class="col-12"> + {% for thesis in thesis_authorships_to_claim %} + <div class="card"> + {% include 'theses/_thesislink_card_content.html' with thesislink=thesis %} + <div class="card-footer"> + <form class="d-inline-block" action="{% url 'scipost:claim_thesis_authorship' thesis_id=thesis.id claim=1%}" method="post"> + {% csrf_token %} + <input class="btn btn-secondary" type="submit" value="I am an author" /> + </form> + <form class="d-inline-block ml-1" action="{% url 'scipost:claim_thesis_authorship' thesis_id=thesis.id claim=0%}" method="post"> + {% csrf_token %} + <input class="btn btn-danger" type="submit" value="I am not an author" /> + </form> + </div> + </div> + {% endfor %} + </div> + </div> +{% endif %} -</section> +{% if not submission_authorships_to_claim and not commentary_authorships_to_claim and not thesis_authorships_to_claim %} +<div class="row"> + <div class="col-12"> + <h2>You have no authorships to claim</h2> + </div> +</div> +{% endif %} -{% endblock bodysup %} +{% endblock content %} diff --git a/scipost/templates/scipost/comments_block.html b/scipost/templates/scipost/comments_block.html index babd085c7a2678c783f26dc4fac4079243c1bde3..9b9507f085931320986c9eb93c5ac93131b2260a 100644 --- a/scipost/templates/scipost/comments_block.html +++ b/scipost/templates/scipost/comments_block.html @@ -1,151 +1,19 @@ -{% load scipost_extras %} - -{% load filename %} -{% load file_extentions %} - {% if comments %} <hr> <div class="row"> <div class="col-12"> - <div class="panel"> - <h2>Comments on this publication</h2> - <button class="btn btn-secondary" id="commentsbutton">Toggle comments view</button> + <div class="card card-grey"> + <div class="card-block"> + <h2 class="card-title">Comments on this publication</h2> + <button class="btn btn-secondary" data-toggle="toggle" data-target="#commentslist">Toggle comments view</button> + </div> </div> </div> </div> -<div class="row" id="commentslist"> +<div id="commentslist"> {% for comment in comments %} - <div class="col-12"> - <div class="comment"> - - <div class="row"> - <div class="col-12"> - {{ comment.print_identifier }} - {{ comment.categories_as_ul }} - - <div class="opinionsDisplay"> - {% if user.is_authenticated and perms.scipost.can_express_opinion_on_comments %} - {% if user.contributor != comment.author %} - <form action="{% url 'comments:express_opinion' comment_id=comment.id opinion='A' %}" method="post"> - {% csrf_token %} - <input type="submit" class="agree" value="Agree {{ comment.nr_A }} "/> - </form> - <form action="{% url 'comments:express_opinion' comment_id=comment.id opinion='N' %}" method="post"> - {% csrf_token %} - <input type="submit" class="notsure" value="Not sure {{ comment.nr_N }}"/> - </form> - <form action="{% url 'comments:express_opinion' comment_id=comment.id opinion='D'%}" method="post"> - {% csrf_token %} - <input type="submit" class="disagree" value="Disagree {{ comment.nr_D }}"/> - </form> - {% else %} - {{ comment.opinions_as_ul }} - {% endif %} - {% endif %} - </div> - </div> - </div> - - - <div class="row"> - <div class="col-12"> - <p> - {{ comment.comment_text|linebreaks }} - - {% if comment.file_attachment %} - <h3>Attachment:</h3> - <p> - <a target="_blank" href="{{ comment.file_attachment.url }}"> - {% if comment.file_attachment|is_image %} - <img class="attachment attachment-comment" src="{{ comment.file_attachment.url }}"> - {% else %} - {{ comment.file_attachment|filename }}<br><small>{{ comment.file_attachment.size|filesizeformat }}</small> - {% endif %} - </a> - </p> - {% endif %} - </p> - {% if user|is_in_group:'Editorial College' or user|is_in_group:'Editorial Administrators' %} - {% if comment.remarks_for_editors %} - <h3>Remarks for editors:</h3> - <p>{{ comment.remarks_for_editors|linebreaks }}</p> - {% endif %} - {% endif %} - </div> - </div> - - {% for reply in author_replies %} - {% if reply.in_reply_to_comment %} - {% if reply.in_reply_to_comment.id == comment.id %} - <div class="row"> - <div class="col-12"> - {{ reply.print_identifier }} - {{ reply.categories_as_ul }} - <div class="opinionsDisplay"> - {% if user.is_authenticated and perms.scipost.can_express_opinion_on_comments %} - {% if user.contributor != reply.author %} - <form action="{% url 'comments:express_opinion' comment_id=reply.id opinion='A' %}" method="post"> - {% csrf_token %} - <input type="submit" class="agree" value="Agree {{ reply.nr_A }} "/> - </form> - <form action="{% url 'comments:express_opinion' comment_id=reply.id opinion='N' %}" method="post"> - {% csrf_token %} - <input type="submit" class="notsure" value="Not sure {{ reply.nr_N }}"/> - </form> - <form action="{% url 'comments:express_opinion' comment_id=reply.id opinion='D'%}" method="post"> - {% csrf_token %} - <input type="submit" class="disagree" value="Disagree {{ reply.nr_D }}"/> - </form> - {% else %} - {{ reply.opinions_as_ul }} - {% endif %} - {% endif %} - </div> - </div> - </div> - - <div class="row"> - <div class="col-12"> - <p> - {{ reply.comment_text|linebreaks }} - {% if reply.file_attachment %} - <h3>Attachment:</h3> - <p> - <a target="_blank" href="{{ reply.file_attachment.url }}"> - {% if reply.file_attachment|is_image %} - <img class="attachment attachment-comment" src="{{ reply.file_attachment.url }}"> - {% else %} - {{ reply.file_attachment|filename }}<br><small>{{ reply.file_attachment.size|filesizeformat }}</small> - {% endif %} - </a> - </p> - {% endif %} - </p> - - {% if user|is_in_group:'Editorial College' or user|is_in_group:'Editorial Administrators' %} - {% if reply.remarks_for_editors %} - <h3>Remarks for editors:</h3> - <p>{{ reply.remarks_for_editors|linebreaks }}</p> - {% endif %} - {% endif %} - </div> - </div> - - {% endif %} - {% endif %} - {% endfor %} - - {% if user.is_authenticated and perms.scipost.can_submit_comments %} - <hr class="small"> - <div class="row"> - <div class="col-12"> - <h3><a href="{% url 'comments:reply_to_comment' comment_id=comment.id %}">Reply to this comment</a></h3> - </div> - </div> - {% endif %} - </div> - </div> + {% include 'comments/_single_comment_with_link.html' with comment=comment perms=perms user=request.user %} {% endfor %} </div> {% endif %} diff --git a/scipost/templates/scipost/contributor_info.html b/scipost/templates/scipost/contributor_info.html index be6f2d0bbbafb4e05494ee4c822a85d8c8c12dc9..7160c77f293a90c85add66d4306a4206bbbaeba6 100644 --- a/scipost/templates/scipost/contributor_info.html +++ b/scipost/templates/scipost/contributor_info.html @@ -2,146 +2,132 @@ {% block pagetitle %}: personal page{% endblock pagetitle %} -{% block headsup %} +{% block content %} -<script> - $(document).ready(function(){ - $("#mypublicationsbutton").click(function(){ - $("#mypublicationslist").toggle(); - }); - $("#mysubmissionsbutton").click(function(){ - $("#mysubmissionslist").toggle(); - }); - $("#mycommentariesbutton").click(function(){ - $("#mycommentarieslist").toggle(); - }); - $("#mythesesbutton").click(function(){ - $("#mytheseslist").toggle(); - }); - $("#mycommentsbutton").click(function(){ - $("#mycommentslist").toggle(); - }); - $("#myauthorrepliesbutton").click(function(){ - $("#myauthorreplieslist").toggle(); - }); - }); -</script> +<div class="row"> + <div class="col-12"> + <h1 class="highlight">Contributor info</h1> + </div> +</div> -{% endblock headsup %} - -{% block bodysup %} - -<section> - <div class="flex-greybox"> - <h1>Contributor info</h1> - </div> - {{ contributor.public_info_as_table }} -</section> +{{ contributor.public_info_as_table }} {% if contributor_publications %} -<section> - <hr class="hr12"> - <div class="flex-greybox"> - <h1>Publications</h1> - <button id="mypublicationsbutton">View/hide publications</button> - </div> - <div id="mypublicationslist"> - <h3>Publications for which this Contributor is identified as an author:</h3> - <ul> - {% for pub in contributor_publications %} - {{ pub.header_as_li }} - {% endfor %} - </ul> - </div> -</section> + <hr> + <div class="row"> + <div class="col-12"> + <h2 class="highlight">Publications <span class="btn btn-secondary ml-2" data-toggle="toggle" data-target="#mypublicationslist">View/hide publications</span></h2> + </div> + <div class="col-12" id="mypublicationslist"> + <h3 class="mb-2">Publications for which this Contributor is identified as an author:</h3> + {% for pub in contributor_publications %} + <div class="card card-publication"> + {% include 'journals/_publication_card_content.html' with publication=pub %} + </div> + {% endfor %} + </div> + </div> + {% endif %} {% 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 }} - {% endfor %} - </ul> - </div> -</section> + <hr> + <div class="row"> + <div class="col-12"> + <h2 class="highlight">Submissions <span class="btn btn-secondary ml-2" data-toggle="toggle" data-target="#mysubmissionslist">View/hide submissions</span></h2> + </div> + <div class="col-12" id="mysubmissionslist"> + <h3>Submissions for which this Contributor is identified as an author:</h3> + <div> + <ul class="list-group list-group-flush"> + {% for sub in contributor_submissions %} + <li class="list-group-item"> + {% include 'submissions/_submission_card_content.html' with submission=sub %} + </li> + {% endfor %} + </ul> + </div> + </div> + </div> {% endif %} {% if contributor_commentaries %} -<section> - <hr class="hr12"> - <div class="flex-greybox"> - <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 }} - {% endfor %} - </ul> - </div> -</section> + <hr> + <div class="row"> + <div class="col-12"> + <h2 class="highlight">Commentaries <span class="btn btn-secondary ml-2" data-toggle="toggle" data-target="#mycommentarieslist">View/hide commentaries</span></h2> + + </div> + <div class="col-12" id="mycommentarieslist"> + <h3>Commentaries for which this Contributor is identified as an author:</h3> + <div> + <ul class="list-group list-group-flush"> + {% for com in contributor_commentaries %} + <li class="list-group-item"> + {% include 'commentaries/_commentary_card_content.html' with commentary=com %} + </li> + {% endfor %} + </ul> + </div> + </div> + </div> {% endif %} {% if contributor_theses %} -<section> - <hr class="hr12"> - <div class="flex-greybox"> - <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 %} - {% include 'theses/_thesislink_header_as_li.html' with thesislink=thesis %} - {% endfor %} - </ul> - </div> -</section> + <hr> + <div class="row"> + <div class="col-12"> + <h2 class="highlight">Theses <span class="btn btn-secondary ml-2" data-toggle="toggle" data-target="#mytheseslist">View/hide theses</span></h2> + </div> + <div class="col-12" id="mytheseslist"> + <h3>Theses for which this Contributor is identified as an author:</h3> + <div> + <ul class="list-group list-group-flush"> + {% for thesis in contributor_theses %} + <li class="list-group-item"> + {% include 'theses/_thesislink_card_content.html' with thesislink=thesis %} + </li> + {% endfor %} + </ul> + </div> + </div> + </div> {% endif %} {% 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 }} - {% endfor %} - </ul> - </div> -</section> + <hr> + <div class="row"> + <div class="col-12"> + <h2 class="highlight">Comments <span class="btn btn-secondary ml-2" data-toggle="toggle" data-target="#mycommentslist">View/hide comments</span></h2> + </div> + <div class="col-12" id="mycommentslist"> + <ul class="list-group list-group-flush"> + {% for comment in contributor_comments %} + <li class="list-group-item"> + {% include 'comments/_comment_card_content.html' with comment=comment %} + </li> + {% endfor %} + </ul> + </div> + </div> {% endif %} {% if contributor_authorreplies %} -<section> - <hr class="hr12"> - <div class="flex-greybox"> - <h1>Author Replies</h1> - <button id="myauthorrepliesbutton">View/hide author replies</button> - </div> - <div id="myauthorreplieslist"> - <ul> - {% for reply in contributor_authorreplies %} - {{ reply.header_as_li }} - {% endfor %} - </ul> - </div> -</section> + <hr> + <div class="row"> + <div class="col-12"> + <h2 class="highlight">Author Replies <span class="btn btn-secondary ml-2" data-toggle="toggle" data-target="#myauthorreplieslist">View/hide author replies</span></h2> + </div> + <div class="col-12" id="myauthorreplieslist"> + <ul class="list-group list-group-flush"> + {% for reply in contributor_authorreplies %} + <li class="list-group-item"> + {% include 'comments/_comment_card_extended_content.html' with comment=reply %} + </li> + {% endfor %} + </ul> + </div> + </div> {% endif %} -{% endblock bodysup %} +{% endblock content %} diff --git a/scipost/templates/scipost/index.html b/scipost/templates/scipost/index.html index 2b03326f8a296976e7827f58156adc9d4c42cc8a..3e750cc98753c4307cf32430c0c3accbdb8ff23e 100644 --- a/scipost/templates/scipost/index.html +++ b/scipost/templates/scipost/index.html @@ -71,11 +71,9 @@ <div class="card-block"> <h1 class="card-title mb-0"><a href="{% url 'journals:journals' %}">Journals</a></h1> <h4 class="card-subtitle mb-2 text-muted">SciPost publishes a portfolio of high-quality two-way open access scientific journals.</h4> - <div class="SciPostPhysicsBanner"> - <h2 class="py-0"> - <a class="pb-0" href="{% url 'journals:scipost_physics' %}">SciPost Physics</a> - </h2> - </div> + <h2 class="banner"> + <a href="{% url 'journals:scipost_physics' %}">SciPost Physics</a> + </h2> {% if issue and publications %} <h4 class="card-text text-center">A selection from the {% if issue.is_current %}current{% else %}last{% endif %} issue:</h4> {% if issue %} diff --git a/scipost/templates/scipost/personal_page.html b/scipost/templates/scipost/personal_page.html index 8969b01a8ce301c6bddb8bac6625ce3f8a127410..a71ba32e9ed293f2bedc3ace6d73206b24e36024 100644 --- a/scipost/templates/scipost/personal_page.html +++ b/scipost/templates/scipost/personal_page.html @@ -82,9 +82,7 @@ <div class="row"> <div class="col-12"> - <div class="panel"> - <h1>Welcome to your SciPost Personal Page, {{ appellation }}</h1> - </div> + <h1 class="highlight">Welcome to your SciPost Personal Page, {{ appellation }}</h1> </div> </div> @@ -110,8 +108,10 @@ <div class="TabSection" id="Account"> <div class="row"> <div class="col-12"> - <div class="panel"> - <h2>Your Account</h2> + <div class="card card-grey"> + <div class="card-block"> + <h2 class="card-title mb-0">Your Account</h2> + </div> </div> </div> </div> @@ -173,8 +173,10 @@ <hr> <div class="row"> <div class="col-12"> - <div class="panel"> - <h2>Your Availability</h2> + <div class="card card-grey"> + <div class="card-block"> + <h2 class="card-title mb-0">Your Availability</h2> + </div> </div> </div> </div> @@ -213,286 +215,319 @@ {% if 'SciPost Administrators' in user_groups or 'Editorial Administrators' in user_groups or 'Editorial College' in user_groups or 'Vetting Editors' in user_groups or 'Ambassadors' in user_groups or 'Junior Ambassadors' in user_groups %} -<div class="TabSection" id="EdActions"> - - <div class="row"> - <div class="col-12"> - <div class="panel"> - <h2>Pending Editorial Actions</h2> + <div class="TabSection" id="EdActions"> + <div class="row"> + <div class="col-12"> + <div class="card card-grey"> + <div class="card-block"> + <h2 class="card-title mb-0">Pending Editorial Actions</h2> + </div> + </div> </div> </div> - </div> - <div class="row"> - {% if 'SciPost Administrators' in user_groups or 'Advisory Board' in user_groups or 'Ambassadors' in user_groups or 'Junior Ambassadors' in user_groups %} - <div class="col-md-4"> - <h3>Registration actions</h3> - <ul> - {% if perms.scipost.can_vet_registration_requests %} - <li><a href="{% url 'scipost:vet_registration_requests' %}">Vet Registration requests</a> ({{ nr_reg_to_vet }})</li> - <li>Awaiting validation ({{ nr_reg_awaiting_validation }}) (no action necessary)</li> - {% endif %} - {% if perms.scipost.can_draft_registration_invitations %} - <li><a href="{% url 'scipost:draft_registration_invitation' %}">Draft a Registration Invitation</a></li> - {% endif %} + <div class="row"> + {% if 'SciPost Administrators' in user_groups or 'Advisory Board' in user_groups or 'Ambassadors' in user_groups or 'Junior Ambassadors' in user_groups %} + <div class="col-md-4"> + <h3>Registration actions</h3> + <ul> + {% if perms.scipost.can_vet_registration_requests %} + <li><a href="{% url 'scipost:vet_registration_requests' %}">Vet Registration requests</a> ({{ nr_reg_to_vet }})</li> + <li>Awaiting validation ({{ nr_reg_awaiting_validation }}) (no action necessary)</li> + {% endif %} + {% if perms.scipost.can_draft_registration_invitations %} + <li><a href="{% url 'scipost:draft_registration_invitation' %}">Draft a Registration Invitation</a></li> + {% endif %} + {% if perms.scipost.can_manage_registration_invitations %} + <li><a href="{% url 'scipost:registration_invitations' %}">Manage Registration Invitations</a></li> + {% endif %} + </ul> + {% if perms.scipost.can_manage_registration_invitations %} - <li><a href="{% url 'scipost:registration_invitations' %}">Manage Registration Invitations</a></li> + <h3>Notifications</h3> + <ul> + <li><a href="{% url 'scipost:citation_notifications' %}">Manage citation notifications</a></li> + </ul> {% endif %} - </ul> - {% if perms.scipost.can_manage_registration_invitations %} - <h3>Notifications</h3> - <ul> - <li><a href="{% url 'scipost:citation_notifications' %}">Manage citation notifications</a></li> - </ul> + <h3>Email communications</h3> + <ul> + {% if perms.scipost.can_email_group_members %} + <li><a href="{% url 'scipost:email_group_members' %}">Email Group Members</a></li> + {% endif %} + {% if perms.scipost.can_email_particulars %} + <li><a href="{% url 'scipost:send_precooked_email' %}">Send a precooked email</a></li> + <li><a href="{% url 'scipost:email_particular' %}">Email a particular individual/address</a></li> + {% endif %} + </ul> + </div> {% endif %} - <h3>Email communications</h3> - <ul> - {% if perms.scipost.can_email_group_members %} - <li><a href="{% url 'scipost:email_group_members' %}">Email Group Members</a></li> - {% endif %} - {% if perms.scipost.can_email_particulars %} - <li><a href="{% url 'scipost:send_precooked_email' %}">Send a precooked email</a></li> - <li><a href="{% url 'scipost:email_particular' %}">Email a particular individual/address</a></li> - {% endif %} - </ul> - </div> - {% endif %} + <div class="col-md-4"> + <h3>Vetting actions</h3> + <ul> + {% if perms.scipost.can_vet_commentary_requests %} + <li><a href="{% url 'commentaries:vet_commentary_requests' %}">Vet Commentary Page requests</a> ({{ nr_commentary_page_requests_to_vet }})</li> + {% endif %} + {% if perms.scipost.can_vet_comments %} + <li><a href="{% url 'comments:vet_submitted_comments' %}">Vet submitted Comments</a> ({{ nr_comments_to_vet }})</li> + {% endif %} + {% if perms.scipost.can_vet_thesislink_requests %} + <li><a href="{% url 'theses:unvetted_thesislinks' %}">Vet Thesis Link Requests</a> ({{ nr_thesislink_requests_to_vet }})</li> + {% endif %} + {% if perms.scipost.can_vet_authorship_claims %} + <li><a href="{% url 'scipost:vet_authorship_claims' %}">Vet Authorship Claims</a> ({{ nr_authorship_claims_to_vet }})</li> + {% endif %} + {% if perms.scipost.can_vet_submitted_reports %} + <li><a href="{% url 'submissions:vet_submitted_reports' %}">Vet submitted Reports</a> ({{ nr_reports_to_vet }})</li> + {% endif %} + </ul> - <div class="col-md-4"> - <h3>Vetting actions</h3> - <ul> - {% if perms.scipost.can_vet_commentary_requests %} - <li><a href="{% url 'commentaries:vet_commentary_requests' %}">Vet Commentary Page requests</a> ({{ nr_commentary_page_requests_to_vet }})</li> - {% endif %} - {% if perms.scipost.can_vet_comments %} - <li><a href="{% url 'comments:vet_submitted_comments' %}">Vet submitted Comments</a> ({{ nr_comments_to_vet }})</li> + {% if perms.scipost.can_attend_VGMs %} + <h3>Virtual General Meetings</h3> + <ul> + <li><a href="{% url 'virtualmeetings:VGMs' %}">List of VGMs</a></li> + </ul> {% endif %} - {% if perms.scipost.can_vet_thesislink_requests %} - <li><a href="{% url 'theses:unvetted_thesislinks' %}">Vet Thesis Link Requests</a> ({{ nr_thesislink_requests_to_vet }})</li> + </div> + + {% if 'Editorial Administrators' in user_groups or 'Editorial College' in user_groups %} + <div class="col-md-4"> + <h3>Info</h3> + <ul> + <li><a href="{% url 'submissions:editorial_workflow' %}">How-to guide: summary of the editorial workflow</a></li> + </ul> + + <h3>Submissions assignments</h3> + <ul> + {% if perms.scipost.can_view_pool %} + <li><a href="{% url 'submissions:assignments' %}">Your assignments</a></li> + <li><a href="{% url 'scipost:Fellow_activity_overview' %}">View assignments overview</a></li> {% endif %} - {% if perms.scipost.can_vet_authorship_claims %} - <li><a href="{% url 'scipost:vet_authorship_claims' %}">Vet Authorship Claims</a> ({{ nr_authorship_claims_to_vet }})</li> + {% if perms.scipost.can_assign_submissions %} + <li>Assign Submissions via the <a href="{% url 'submissions:pool' %}">Submissions Pool</a> ({{ nr_submissions_to_assign }})</li> {% endif %} - {% if perms.scipost.can_vet_submitted_reports %} - <li><a href="{% url 'submissions:vet_submitted_reports' %}">Vet submitted Reports</a> ({{ nr_reports_to_vet }})</li> + {% if perms.scipost.can_take_charge_of_submissions %} + <li>Accept or decline assignments via the <a href="{% url 'submissions:pool' %}">Submissions Pool</a> ({{ nr_assignments_to_consider }})</li> {% endif %} - </ul> + </ul> - {% if perms.scipost.can_attend_VGMs %} - <h3>Virtual General Meetings</h3> - <ul> - <li><a href="{% url 'virtualmeetings:VGMs' %}">List of VGMs</a></li> - </ul> + <h3>Voting</h3> + <ul> + <li>Prepare Editorial Recommendations for voting via the <a href="{% url 'submissions:pool' %}">Submissions Pool</a> ({{ nr_recommendations_to_prepare_for_voting }})</li> + </ul> + </div> {% endif %} </div> - {% if 'Editorial Administrators' in user_groups or 'Editorial College' in user_groups %} - <div class="col-md-4"> - <h3>Info</h3> - <ul> - <li><a href="{% url 'submissions:editorial_workflow' %}">How-to guide: summary of the editorial workflow</a></li> - </ul> - - <h3>Submissions assignments</h3> - <ul> - {% if perms.scipost.can_view_pool %} - <li><a href="{% url 'submissions:assignments' %}">Your assignments</a></li> - <li><a href="{% url 'scipost:Fellow_activity_overview' %}">View assignments overview</a></li> - {% endif %} - {% if perms.scipost.can_assign_submissions %} - <li>Assign Submissions via the <a href="{% url 'submissions:pool' %}">Submissions Pool</a> ({{ nr_submissions_to_assign }})</li> - {% endif %} - {% if perms.scipost.can_take_charge_of_submissions %} - <li>Accept or decline assignments via the <a href="{% url 'submissions:pool' %}">Submissions Pool</a> ({{ nr_assignments_to_consider }})</li> - {% endif %} - </ul> - - <h3>Voting</h3> - <ul> - <li>Prepare Editorial Recommendations for voting via the <a href="{% url 'submissions:pool' %}">Submissions Pool</a> ({{ nr_recommendations_to_prepare_for_voting }})</li> - </ul> + {% if active_assignments %} + <div class="row"> + <div class="col-12"> + <h3 class="highlight">Submissions for which you are Editor-in-charge</h3> + </div> + <div class="col-12"> + <ul class="list-group list-group-flush"> + {% for assignment in active_assignments %} + <li class="list-group-item"> + {% include 'submissions/_submission_card_eic_content.html' with submission=assignment.submission %} + </li> + {% endfor %} + </ul> + </div> </div> {% endif %} </div> - - {% if active_assignments %} - <div class="row"> - <div class="col-12"> - <h3>Submissions for which you are Editor-in-charge</h3> - <ul> - {% for assignment in active_assignments %} - {{ assignment.header_as_li_for_eic }} - {% endfor %} - </ul> - </div> - </div> {% endif %} -</div> -{% endif %} -{% if perms.scipost.can_referee %} -<div class="TabSection" id="Refereeing"> - <div class="row"> - <div class="col-12"> - <div class="panel"> - <h2>Refereeing Tasks</h2> - <ul class="mb-0"> - <li><a href="{% url 'submissions:accept_or_decline_ref_invitations' %}">Accept/decline refereeing invitations</a> ({{ nr_ref_inv_to_consider }})</li> - </ul> + {% if perms.scipost.can_referee %} + <div class="TabSection" id="Refereeing"> + <div class="row"> + <div class="col-12"> + <div class="card card-grey"> + <div class="card-block"> + <h2 class="card-title">Refereeing Tasks</h2> + <ul class="mb-0"> + <li><a href="{% url 'submissions:accept_or_decline_ref_invitations' %}">Accept/decline refereeing invitations</a> ({{ nr_ref_inv_to_consider }})</li> + </ul> + </div> + </div> </div> </div> - </div> - {% if pending_ref_tasks %} - <div class="row"> - <div class="col-12"> - <h3>Pending Refereeing Tasks:</h3> - <ul> - {% for task in pending_ref_tasks %} - <li>{{ task.submission }}, due {{ task.submission.reporting_deadline }}. - <a href="{% url 'submissions:submit_report' arxiv_identifier_w_vn_nr=task.submission.arxiv_identifier_w_vn_nr %}">Submit your Report</a> - <a href="{% url 'submissions:communication' arxiv_identifier_w_vn_nr=task.submission.arxiv_identifier_w_vn_nr comtype='RtoE' referee_id=contributor.user.contributor.id %}">Write to the Editor-in-charge</a>. - </li> - {% endfor %} - </ul> + {% if pending_ref_tasks %} + <div class="row"> + <div class="col-12"> + <h3>Pending Refereeing Tasks:</h3> + </div> + <div class="col-12"> + <ul class="list-group list-group-flush"> + {% for task in pending_ref_tasks %} + <li class="list-group-item"> + {% include 'submissions/_refereeing_invitation_card_content.html' with invitation=task %} + </li> + {% endfor %} + </ul> + </div> </div> + {% endif %} </div> {% endif %} -</div> -{% endif %} -<div class="TabSection" id="Submissions"> - <div class="row"> - <div class="col-12"> - <div class="panel"> - <h2>Submissions</h2> - <ul class="mb-0"> - {% 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> - {% endif %} - <li><a href="{% url 'submissions:submit_manuscript' %}">Submit an arXiv preprint to a SciPost Journal</a></li> - </ul> + <div class="TabSection" id="Submissions"> + <div class="row"> + <div class="col-12"> + <div class="card card-grey"> + <div class="card-block"> + <h2 class="card-title">Submissions</h2> + <ul class="mb-0"> + {% 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> + {% endif %} + <li><a href="{% url 'submissions:submit_manuscript' %}">Submit an arXiv preprint to a SciPost Journal</a></li> + </ul> + </div> + </div> </div> </div> - </div> - {% if own_submissions %} - <div class="row" id="mysubmissionslist"> - <div class="col-12"> - <h3>Submissions for which you are identified as an author:</h3> - <ul class="mt-3"> - {% for sub in own_submissions %} - {{ sub.header_as_li_for_authors }} - {% if contributor.user.contributor == sub.submitted_by %} - <p><a href="{% url 'submissions:communication' arxiv_identifier_w_vn_nr=sub.arxiv_identifier_w_vn_nr comtype='AtoE' %}">Write to the Editor-in-charge</a>.</p> - {% endif %} - {% endfor %} - </ul> + {% if own_submissions %} + <div class="row" id="mysubmissionslist"> + <div class="col-12"> + <h3>Submissions for which you are identified as an author:</h3> + </div> + <div class="col-12"> + <ul class="list-group list-group-flush"> + {% for sub in own_submissions %} + <li class="list-group-item"> + {% include 'submissions/_submission_card_author_content.html' with submission=sub current_user=request.user %} + </li> + {% endfor %} + </ul> + </div> </div> + {% endif %} </div> - {% endif %} -</div> -<div class="TabSection" id="Commentaries"> - <div class="row"> - <div class="col-12"> - <div class="panel"> - <h2>Commentaries</h2> - <ul class="mb-0"> - {% 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> - {% endif %} - <li><a href="{% url 'commentaries:request_commentary' %}">Request opening a SciPost Commentary Page</a></li> - </ul> + <div class="TabSection" id="Commentaries"> + <div class="row"> + <div class="col-12"> + <div class="card card-grey"> + <div class="card-block"> + <h2 class="card-title">Commentaries</h2> + <ul class="mb-0"> + {% 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> + {% endif %} + <li><a href="{% url 'commentaries:request_commentary' %}">Request opening a SciPost Commentary Page</a></li> + </ul> + </div> + </div> </div> </div> - </div> - {% if own_commentaries %} - <div class="row" id="mycommentarieslist"> - <div class="col-12"> - <h3>Commentaries for which you are identified as an author:</h3> - <ul> - {% for com in own_commentaries %} - {{ com.header_as_li }} - {% endfor %} - </ul> + {% if own_commentaries %} + <div class="row" id="mycommentarieslist"> + <div class="col-12"> + <h3>Commentaries for which you are identified as an author:</h3> + </div> + <div class="col-12"> + <ul class="list-group list-group-flush"> + {% for com in own_commentaries %} + <li class="list-group-item"> + {% include 'commentaries/_commentary_card_content.html' with commentary=com %} + </li> + {% endfor %} + </ul> + </div> </div> + {% endif %} </div> - {% endif %} -</div> -<div class="TabSection" id="Theses"> - <div class="row"> - <div class="col-12"> - <div class="panel"> - <h2>Theses</h2> - <ul class="mb-0"> - {% 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> - {% endif %} - <li><a href="{% url 'theses:request_thesislink' %}">Request a SciPost ThesisLink</a></li> - </ul> + <div class="TabSection" id="Theses"> + <div class="row"> + <div class="col-12"> + <div class="card card-grey"> + <div class="card-block"> + <h2 class="card-title">Theses</h2> + <ul class="mb-0"> + {% 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> + {% endif %} + <li><a href="{% url 'theses:request_thesislink' %}">Request a SciPost ThesisLink</a></li> + </ul> + </div> + </div> </div> </div> + {% if own_thesislinks %} + <div class="row" id="mytheseslist"> + <div class="col-12"> + <h3>Theses for which you are identified as an author:</h3> + </div> + <div class="col-12"> + <ul class="list-group list-group-flush"> + {% for thesis in own_thesislinks %} + <li class="list-group-item"> + {% include 'theses/_thesislink_card_content.html' with thesislink=thesis %} + </li> + {% endfor %} + </ul> + </div> + </div> + {% endif %} </div> - {% if own_thesislinks %} - <div class="row" id="mytheseslist"> - <div class="col-12"> - <h3>Theses for which you are identified as an author:</h3> - <ul> - {% for thesis in own_thesislinks %} - {% include 'theses/_thesislink_header_as_li.html' with thesislink=thesis %} - {% endfor %} - </ul> - </div> - </div> - {% endif %} -</div> -<div class="TabSection" id="Comments"> - <div class="row"> - <div class="col-12"> - <div class="panel"> - <h2>Your Comments</h2> + <div class="TabSection" id="Comments"> + <div class="row"> + <div class="col-12"> + <div class="card card-grey"> + <div class="card-block"> + <h2 class="card-title mb-0">Your Comments</h2> + </div> + </div> </div> </div> - </div> - <div class="row" id="mycommentslist"> - <div class="col-12"> - <ul> - {% for own_comment in own_comments %} - {{ own_comment.header_as_li }} - {% empty %} - <li>You have not commented yet.</li> - {% endfor %} - </ul> + + <div class="row" id="mycommentslist"> + <div class="col-12"> + <ul class="list-group list-group-flush"> + {% for own_comment in own_comments %} + <li class="list-group-item"> + {% include 'comments/_comment_card_extended_content.html' with comment=own_comment %} + </li> + {% empty %} + <li class="list-group-item">You have not commented yet.</li> + {% endfor %} + </ul> + </div> </div> </div> -</div> -{% if own_authorreplies %} -<div class="TabSection" id="AuthorReplies"> - <div class="row"> - <div class="col-12"> - <div class="panel"> - <h2>Your Author Replies</h2> + <div class="TabSection" id="AuthorReplies"> + <div class="row"> + <div class="col-12"> + <div class="card card-grey"> + <div class="card-block"> + <h2 class="card-title mb-0">Your Author Replies</h2> + </div> + </div> </div> </div> - </div> - <div class="row" id="myauthorreplieslist"> - <div class="col-12"> - <ul> - {% for own_reply in own_authorreplies %} - {{ own_reply.header_as_li }} - {% endfor %} - </ul> + + <div class="row" id="myauthorreplieslist"> + <div class="col-12"> + <ul class="list-group list-group-flush"> + {% for own_reply in own_authorreplies %} + <li class="list-group-item"> + {% include 'comments/_comment_card_extended_content.html' with comment=own_reply %} + </li> + {% empty %} + <li class="list-group-item">You have not Author Replies yet.</li> + {% endfor %} + </ul> + </div> </div> </div> -</div> -{% endif %} {% endif %} diff --git a/scipost/templates/scipost/search.html b/scipost/templates/scipost/search.html index 911e4686ed965a1f8a4ebb054ac3e25b8a0adcaa..dd9d6d630935dfd9ee83abfe95198de6019530f2 100644 --- a/scipost/templates/scipost/search.html +++ b/scipost/templates/scipost/search.html @@ -17,16 +17,16 @@ <hr> <div class="row"> <div class="col-12"> - <div class="panel"> - <h2>Publications</h2> - </div> + <h2 class="highlight">Publications ({{publication_search_list|length}})</h2> </div> </div> <div class="row"> <div class="col-12"> {% for publication in publication_search_list %} - {{ publication.header_as_li }} + <div class="card card-publication"> + {% include 'journals/_publication_card_content.html' with publication=publication %} + </div> {% endfor %} </div> </div> @@ -46,7 +46,6 @@ {% endif %} </span> </div> - </div> </div> {% endif %} @@ -56,16 +55,16 @@ <hr> <div class="row"> <div class="col-12"> - <div class="panel"> - <h2>Commentaries</h2> - </div> + <h2 class="highlight">Commentaries ({{commentary_search_list|length}})</h2> </div> </div> <div class="row"> <div class="col-12"> - <ul> + <ul class="list-group list-group-flush"> {% for commentary in commentary_search_list %} - {{ commentary.header_as_li }} + <li class="list-group-item"> + {% include 'commentaries/_commentary_card_content.html' with commentary=commentary %} + </li> {% endfor %} </ul> </div> @@ -86,7 +85,6 @@ {% endif %} </span> </div> - </div> </div> {% endif %} @@ -96,16 +94,16 @@ <hr> <div class="row"> <div class="col-12"> - <div class="panel"> - <h2>Submissions</h2> - </div> + <h2 class="highlight">Submissions ({{submission_search_list|length}})</h2> </div> </div> <div class="row"> <div class="col-12"> - <ul> + <ul class="list-group list-group-flush"> {% for submission in submission_search_list %} - {{ submission.header_as_li }} + <li class="list-group-item"> + {% include 'submissions/_submission_card_content.html' with submission=submission %} + </li> {% endfor %} </ul> </div> @@ -134,39 +132,40 @@ <hr> <div class="row"> <div class="col-12"> - <div class="panel"> - <h2>Theses</h2> - </div> + <h2 class="highlight">Theses ({{thesislink_search_list|length}})</h2> </div> </div> <div class="row"> <div class="col-12"> - <ul> + <ul class="list-group list-group-flush"> {% for thesislink in thesislink_search_list %} - {% include 'theses/_thesislink_header_as_li.html' with thesislink=thesislink %} + <li class="list-group-item"> + {% include 'theses/_thesislink_card_content.html' with thesislink=thesislink %} + </li> {% endfor %} - </ul> - {% endif %} + </ul> + </div> +</div> +{% endif %} - {% if comment_search_list %} - <div class="row"> - <div class="col-12"> - <div class="panel"> - <h2>Comments</h2> - </div> - </div> - </div> - <div class="row"> - <div class="col-12"> - <ul> - {% for comment in comment_search_list %} - {{ comment.header_as_li }} - {% endfor %} - </ul> - </div> - </div> - {% endif %} +{% if comment_search_list %} +<hr> +<div class="row"> + <div class="col-12"> + <h2 class="highlight">Comments ({{comment_search_list|length}})</h2> + </div> +</div> +<div class="row"> + <div class="col-12"> + <ul class="list-group list-group-flush"> + {% for comment in comment_search_list %} + <li class="list-group-item"> + {% include 'comments/_comment_card_extended_content.html' with comment=comment %} + </li> + {% endfor %} + </ul> </div> </div> +{% endif %} {% endblock content %} diff --git a/scipost/templates/scipost/vet_authorship_claims.html b/scipost/templates/scipost/vet_authorship_claims.html index ba894d8b264de40d938f78bc9eb1677f8646f19d..71ca952c25d72dbb55d9036785181cddfcb79929 100644 --- a/scipost/templates/scipost/vet_authorship_claims.html +++ b/scipost/templates/scipost/vet_authorship_claims.html @@ -6,42 +6,56 @@ {% endblock headsup %} -{% block bodysup %} +{% block content %} -<section> - <div class="flex-greybox"> - <h1>Vet Authorship Claims</h1> +<div class="row"> + <div class="col-12"> + <h1 class="highlight">Vet Authorship Claims</h1> </div> - {% if not claims_to_vet %} - <h3>There are no authorship claims to vet</h3> - {% else %} +</div> - <hr class="hr12"> - <ul> +{% if not claims_to_vet %} + <div class="row"> + <div class="col-12"> + <h3>There are no authorship claims to vet</h3> + </div> + </div> +{% else %} + + <ul class="list-group list-group-flush"> {% for claim in claims_to_vet %} - {% if claim.submission %} - <h4>Contributor {{ claim.claimant.user.first_name }} {{ claim.claimant.user.last_name }} claims to be an author of Submission:</h4> - {{ claim.submission.header_as_li }} - {% elif claim.commentary %} - <h4>Contributor {{ claim.claimant.user.first_name }} {{ claim.claimant.user.last_name }} claims to be an author of Submission:</h4> - {{ claim.commentary.header_as_li }} - {% elif claim.thesislink %} - <h4>Contributor {{ claim.claimant.user.first_name }} {{ claim.claimant.user.last_name }} claims to be an author of Thesis:</h4> - {% include 'theses/_thesislink_header_as_li.html' with thesislink=claim.thesislink %} - {% endif %} - - <form action="{% url 'scipost:vet_authorship_claim' claim_id=claim.id claim=1%}" method="post"> - {% csrf_token %} - <input type="submit" value="Accept" /> - </form> - <form action="{% url 'scipost:vet_authorship_claim' claim_id=claim.id claim=0%}" method="post"> - {% csrf_token %} - <input type="submit" value="Deny" /> - </form> + <li class="list-group-item"> + <div class="card w-100"> + {% if claim.submission %} + <div class="card-header"> + <h4>Contributor {{ claim.claimant.user.first_name }} {{ claim.claimant.user.last_name }} claims to be an author of Submission:</h4> + </div> + {% include 'submissions/_submission_card_content.html' with submission=claim.submission %} + {% elif claim.commentary %} + <div class="card-header"> + <h4>Contributor {{ claim.claimant.user.first_name }} {{ claim.claimant.user.last_name }} claims to be an author of Commentary:</h4> + </div> + {% include 'commentaries/_commentary_card_content.html' with commentary=claim.commentary %} + {% elif claim.thesislink %} + <div class="card-header"> + <h4>Contributor {{ claim.claimant.user.first_name }} {{ claim.claimant.user.last_name }} claims to be an author of Thesis:</h4> + </div> + {% include 'theses/_thesislink_card_content.html' with thesislink=claim.thesislink %} + {% endif %} + <div class="card-footer"> + <form class="d-inline-block" action="{% url 'scipost:vet_authorship_claim' claim_id=claim.id claim=1%}" method="post"> + {% csrf_token %} + <input class="btn btn-secondary" type="submit" value="Accept" /> + </form> + <form class="d-inline-block ml-1" action="{% url 'scipost:vet_authorship_claim' claim_id=claim.id claim=0%}" method="post"> + {% csrf_token %} + <input class="btn btn-danger" type="submit" value="Deny" /> + </form> + </div> + </div> + </li> {% endfor %} </ul> {% endif %} -</section> - -{% endblock bodysup %} +{% endblock content %} diff --git a/scipost/views.py b/scipost/views.py index 16fe27bf23c0e91f4685aac54438831a17cf3e39..311914d0356ea12f32757ec0b628bcefe544f429 100644 --- a/scipost/views.py +++ b/scipost/views.py @@ -1450,15 +1450,21 @@ def EdCol_bylaws(request): @permission_required('scipost.can_view_pool', return_403=True) def Fellow_activity_overview(request, Fellow_id=None): - Fellows = Contributor.objects.filter( + fellows = Contributor.objects.filter( user__groups__name='Editorial College').order_by('user__last_name') - context = {'Fellows': Fellows, } + context = {'fellows': fellows} if Fellow_id: - Fellow = get_object_or_404(Contributor, pk=Fellow_id) - context['Fellow'] = Fellow - assignments_of_Fellow = EditorialAssignment.objects.filter( - to=Fellow).order_by('-date_created') - context['assignments_of_Fellow'] = assignments_of_Fellow + fellow = get_object_or_404(Contributor, pk=Fellow_id) + context['fellow'] = fellow + + assignments_ongoing = (EditorialAssignment.objects.get_for_user_in_pool(request.user) + .filter(accepted=True, completed=False, to=fellow) + .order_by('-date_created')) + context['assignments_ongoing'] = assignments_ongoing + + assignments_completed = (EditorialAssignment.objects.get_for_user_in_pool(request.user) + .filter(completed=True, to=fellow).order_by('-date_created')) + context['assignments_completed'] = assignments_completed return render(request, 'scipost/Fellow_activity_overview.html', context) diff --git a/submissions/models.py b/submissions/models.py index f720ae1baa5310d8db70a8c3716bfd2768d3111f..93399cfad740fbba40a67515038e48918c9ec45d 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -167,9 +167,7 @@ class Submission(ArxivCallable, models.Model): @property def reporting_deadline_has_passed(self): - if timezone.now() > self.reporting_deadline: - return True - return False + return timezone.now() > self.reporting_deadline @transaction.atomic def finish_submission(self): @@ -270,57 +268,6 @@ class Submission(ArxivCallable, models.Model): }) return template.render(context) - def header_as_li(self): - # for search lists - header = ('<li>' - '<p>' - '<a href="/submission/{{ arxiv_identifier_w_vn_nr }}" ' - 'class="pubtitleli">{{ title }}</a></p>' - '<p>by {{ author_list }}</p>' - '<p>Version {{ arxiv_vn_nr }}') - if self.is_current: - header += ' (current version)' - else: - header += ' (deprecated version {{ arxiv_vn_nr }})' - header += ('</p><p> Submitted {{ submission_date }} to {{ to_journal }}' - ' - latest activity: {{ latest_activity }}</p>' - '</li>') - context = Context({'arxiv_identifier_w_vn_nr': self.arxiv_identifier_w_vn_nr, - 'arxiv_vn_nr': self.arxiv_vn_nr, - 'title': self.title, 'author_list': self.author_list, - 'submission_date': self.submission_date, - 'to_journal': journals_submit_dict[self.submitted_to_journal], - 'latest_activity': self.latest_activity.strftime('%Y-%m-%d %H:%M')}) - template = Template(header) - return template.render(context) - - def header_as_li_for_authors(self): - # includes status specification - header = ('<li>' - '<p><a href="/submission/{{ arxiv_identifier_w_vn_nr }}" ' - 'class="pubtitleli">{{ title }}</a></p>' - '<p>by {{ author_list }}</p>' - '<p>Version {{ arxiv_vn_nr }}') - if self.is_current: - header += ' (current version)' - else: - header += ' (deprecated version {{ arxiv_vn_nr }})' - header += ('</p><p>Submitted {{ submission_date }} to {{ to_journal }}' - ' - latest activity: {{ latest_activity }}</p>' - '<p>Status: {{ status }}</p>' - '</li>') - context = Context({ - 'arxiv_identifier_w_vn_nr': self.arxiv_identifier_w_vn_nr, - 'arxiv_vn_nr': self.arxiv_vn_nr, - 'title': self.title, 'author_list': self.author_list, - 'submission_date': self.submission_date, - 'to_journal': journals_submit_dict[self.submitted_to_journal], - 'latest_activity': self.latest_activity.strftime('%Y-%m-%d %H:%M'), - 'status': submission_status_dict[self.status] - }) - template = Template(header) - return template.render(context) - def count_accepted_invitations(self): return self.refereeinvitation_set.filter(accepted=True).count() @@ -369,59 +316,6 @@ class Submission(ArxivCallable, models.Model): context = Context({}) return template.render(context) - def header_as_li_for_Fellows(self): - # for submissions pool - header = ('<li>' - '<p><a href="/submission/{{ arxiv_identifier_w_vn_nr }}" ' - 'class="pubtitleli">{{ title }}</a></p>' - '<p>by {{ author_list }}</p>' - '<p>Version {{ arxiv_vn_nr }}') - if self.is_current: - header += ' (current version)' - else: - header += ' (deprecated version {{ arxiv_vn_nr }})' - header += ('</p><p> Submitted {{ submission_date }} to {{ to_journal }}' - ' - latest activity: {{ latest_activity }}</p>') - if self.status == 'unassigned': - header += ('<p style="color: red">Status: {{ status }}.' - ' You can volunteer to become Editor-in-charge by ' - '<a href="/submissions/volunteer_as_EIC/{{ arxiv_identifier_w_vn_nr }}">' - 'clicking here</a>.</p>') - else: - header += '<p>Editor-in-charge: {{ EIC }}</p><p>Status: {{ status }}</p>' - header += self.refereeing_status_as_p() - header += '</li>' - context = Context({'arxiv_identifier_w_vn_nr': self.arxiv_identifier_w_vn_nr, - 'arxiv_vn_nr': self.arxiv_vn_nr, - 'title': self.title, 'author_list': self.author_list, - 'submission_date': self.submission_date, - 'to_journal': journals_submit_dict[self.submitted_to_journal], - 'latest_activity': self.latest_activity.strftime('%Y-%m-%d %H:%M'), - 'EIC': str(self.editor_in_charge), - 'status': submission_status_dict[self.status]}) - template = Template(header) - return template.render(context) - - def simple_header_as_li(self): - # for Lists - header = ('<li>' - '<p>' - '<a href="/submission/{{ arxiv_identifier_w_vn_nr }}" ' - 'class="pubtitleli">{{ title }}</a></p>' - '<p>by {{ author_list }}</p>' - '<p>Version {{ arxiv_vn_nr }}') - if self.is_current: - header += ' (current version)' - else: - header += ' (deprecated version {{ arxiv_vn_nr }})' - header += ('</p>' - '</li>') - context = Context({'arxiv_identifier_w_vn_nr': self.arxiv_identifier_w_vn_nr, - 'arxiv_vn_nr': self.arxiv_vn_nr, - 'title': self.title, 'author_list': self.author_list}) - template = Template(header) - return template.render(context) - def version_info_as_li(self): # for listing all versions of a Submission header = ('<li>' @@ -471,6 +365,13 @@ ASSIGNMENT_REFUSAL_REASONS = ( assignment_refusal_reasons_dict = dict(ASSIGNMENT_REFUSAL_REASONS) +class EditorialAssignmentManager(models.Manager): + def get_for_user_in_pool(self, user): + return self.exclude(submission__authors=user.contributor)\ + .exclude(Q(submission__author_list__icontains=user.last_name), + ~Q(submission__authors_false_claims=user.contributor)) + + class EditorialAssignment(models.Model): submission = models.ForeignKey(Submission, on_delete=models.CASCADE) to = models.ForeignKey(Contributor, on_delete=models.CASCADE) @@ -483,6 +384,8 @@ class EditorialAssignment(models.Model): date_created = models.DateTimeField(default=timezone.now) date_answered = models.DateTimeField(blank=True, null=True) + objects = EditorialAssignmentManager() + def __str__(self): return (self.to.user.first_name + ' ' + self.to.user.last_name + ' to become EIC of ' + self.submission.title[:30] + ' by ' + self.submission.author_list[:30] + @@ -516,45 +419,6 @@ class EditorialAssignment(models.Model): template = Template(info) return template.render(context) - def header_as_li_for_eic(self): - header = ('<li>' - '<p><a href="/submission/{{ arxiv_identifier_w_vn_nr }}" ' - 'class="pubtitleli">{{ title }}</a></p>' - '<p>by {{ author_list }}</p>' - '<p> (submitted {{ date }} to {{ to_journal }})</p>' - '<p>Status: {{ status }}</p><p>Manage this Submission from its ' - '<a href="/submissions/editorial_page/{{ arxiv_identifier_w_vn_nr }}">' - 'Editorial Page</a>.' - '</p>' - '</li>') - template = Template(header) - context = Context({'arxiv_identifier_w_vn_nr': self.submission.arxiv_identifier_w_vn_nr, - 'title': self.submission.title, - 'author_list': self.submission.author_list, - 'date': self.submission.submission_date, - 'to_journal': journals_submit_dict[self.submission.submitted_to_journal], - 'status': submission_status_dict[self.submission.status]}) - return template.render(context) - - def header_as_li(self): - """ Same as above, but without link to Editorial Page. """ - header = ('<li>' - '<p><a href="/submission/{{ arxiv_identifier_w_vn_nr }}" ' - 'class="pubtitleli">{{ title }}</a></p>' - '<p>by {{ author_list }}</p>' - '<p> (submitted {{ date }} to {{ to_journal }})</p>' - '<p>Status: {{ status }}</p>' - '</li>') - template = Template(header) - context = Context({ - 'arxiv_identifier_w_vn_nr': self.submission.arxiv_identifier_w_vn_nr, - 'title': self.submission.title, - 'author_list': self.submission.author_list, - 'date': self.submission.submission_date, - 'to_journal': journals_submit_dict[self.submission.submitted_to_journal], - 'status': submission_status_dict[self.submission.status]}) - return template.render(context) - class RefereeInvitation(models.Model): submission = models.ForeignKey(Submission, on_delete=models.CASCADE) diff --git a/submissions/templates/submissions/_refereeing_invitation_card_content.html b/submissions/templates/submissions/_refereeing_invitation_card_content.html new file mode 100644 index 0000000000000000000000000000000000000000..e90930c773afc24efa3ea9b0e676e25d2f7f617b --- /dev/null +++ b/submissions/templates/submissions/_refereeing_invitation_card_content.html @@ -0,0 +1,10 @@ +<div class="card-block"> + <h3 class="card-title">{% if invitation.submission.reporting_deadline_has_passed %}<span class="label label-sm label-danger mr-2">overdue</span> {% endif %}{{ invitation.submission }}</h3> + <h4 class="card-subtitle text-muted">due: {{ invitation.submission.reporting_deadline }}</h4> + + <div class="d-block"> + <a class="d-inline-block" href="{% url 'submissions:submit_report' arxiv_identifier_w_vn_nr=invitation.submission.arxiv_identifier_w_vn_nr %}">Submit your Report</a> <span class="text-blue">|</span> + <a class="d-inline-block" href="{% url 'submissions:communication' arxiv_identifier_w_vn_nr=invitation.submission.arxiv_identifier_w_vn_nr comtype='RtoE' referee_id=request.user.contributor.id %}">Write to the Editor-in-charge</a>. + </div> + +</div> diff --git a/submissions/templates/submissions/_remark_add_form.html b/submissions/templates/submissions/_remark_add_form.html new file mode 100644 index 0000000000000000000000000000000000000000..1541145e29fca3ec142bae5ec2d6fde733a54bea --- /dev/null +++ b/submissions/templates/submissions/_remark_add_form.html @@ -0,0 +1,26 @@ +{% load bootstrap %} + +<script> +$(document).ready(function(){ + $('#ref_reason').hide(); + + $('#id_accept').on('change', function() { + if ($('#id_accept_1').is(':checked')) { + $('#ref_reason').show(); + } + else { + $('#ref_reason').hide(); + } + }); + + }); +</script> + +<button class="btn btn-secondary mb-2" data-toggle="toggle" data-target="#remarkForm{{ submission.id }}" id="remarkButton{{ submission.id }}">Add a remark on this Submission</button> +<div class="submitRemarkForm pb-2" id="remarkForm{{ submission.id }}" style="display:none;"> + <form action="{% url 'submissions:add_remark' submission.arxiv_identifier_w_vn_nr %}" method="post"> + {% csrf_token %} + {{ form|bootstrap:'0,12' }} + <input class="btn btn-secondary" type="submit" value="Submit" /> + </form> +</div> diff --git a/submissions/templates/submissions/_single_report.html b/submissions/templates/submissions/_single_report.html new file mode 100644 index 0000000000000000000000000000000000000000..ef15a1b73e89f08adffe69a19aebbd318de8e7e6 --- /dev/null +++ b/submissions/templates/submissions/_single_report.html @@ -0,0 +1,60 @@ +{% load scipost_extras %} +{% load submissions_extras %} + +<div class="row"> + <div class="col-12"> + <div class="report"> + {% if user.contributor == submission.editor_in_charge or user|is_in_group:'Editorial Administrators' and not is_author or user|is_in_group:'Editorial Administrators' and not is_author_unchecked %} + + <div class="reportid"> + <h3>{% if report.anonymous %}(chose public anonymity) {% endif %}<a href="{% url 'scipost:contributor_info' report.author.id %}">{{ report.author.user.first_name }} {{ report.author.user.last_name }}</a> + on {{ report.date_submitted|date:'Y-n-j' }}</h3> + </h3> + </div> + + {% if report.flagged %} + <h4 class="text-danger font-weight-bold">CAUTION: check if this referee has been flagged by the authors</h4> + {% endif %} + + <div class="row"> + <div class="col-12"> + <h3 class="highlight tight">Qualification</h3> + <div class="pl-md-4">{{ report.get_qualification_display}}</div> + </div> + </div> + + {% include 'submissions/_single_report_content.html' with report=report %} + + <div class="row"> + <div class="col-12"> + <h3>Remarks for editors</h3> + <div class="pl-md-4">{{ report.remarks_for_editors }}</div> + </div> + </div> + <div class="row"> + <div class="col-12"> + <h3>Recommendation</h3> + <div class="pl-md-4">{{report.get_recommendation_display}}</div> + </div> + </div> + {% else %} + <div class="reportid"> + <h3 id="report_id{{report.id}}">{% if report.anonymous %}Anonymous Report {{report.id}}{% else %}<a href="{% url 'scipost:contributor_info' report.author.id %}">{{ report.author.user.first_name }} {{ report.author.user.last_name }}</a>{% endif %} + on {{ report.date_submitted|date:'Y-n-j' }}</h3> + </h3> + </div> + {# {{report.print_identifier}}#} + + {# {{ report.print_contents }}#} + {% include 'submissions/_single_report_content.html' with report=report %} + {% endif %} + + <hr class="small"> + <h3><a href="{% url 'comments:reply_to_report' report_id=report.id %}">Reply to this Report</a> (authors only)</h3> + + {% for reply in report.comment_set.vetted %} + {% include 'comments/_single_comment_with_link.html' with comment=reply perms=perms user=user %} + {% endfor %} + </div> + </div> +</div> diff --git a/submissions/templates/submissions/_single_report_content.html b/submissions/templates/submissions/_single_report_content.html new file mode 100644 index 0000000000000000000000000000000000000000..82e06f943f39743d148e56b154382759fe1b2fa8 --- /dev/null +++ b/submissions/templates/submissions/_single_report_content.html @@ -0,0 +1,27 @@ +<div class="row"> + <div class="col-12"> + <h3 class="highlight tight">Strengths</h3> + <div class="pl-md-4">{{ report.strengths|linebreaks }}</div> + </div> +</div> +<div class="row"> + <div class="col-12"> + <h3 class="highlight tight">Weaknesses</h3> + <div class="pl-md-4">{{ report.weaknesses|linebreaks }}</div> + </div> +</div> +<div class="row"> + <div class="col-12"> + <h3 class="highlight tight">Report</h3> + <div class="pl-md-4">{{ report.report|linebreaks }}</div> + </div> +</div> +<div class="row"> + <div class="col-12"> + <h3 class="highlight tight">Requested changes</h3> + <div class="pl-md-4"> + <p>{{ report.requested_changes|linebreaks }}</p> + {% include 'submissions/_single_report_ratings.html' with report=report %} + </div> + </div> +</div> diff --git a/submissions/templates/submissions/_single_report_ratings.html b/submissions/templates/submissions/_single_report_ratings.html new file mode 100644 index 0000000000000000000000000000000000000000..0ea7b074ed8dd315f18d2ed6d6aecfcab29f529a --- /dev/null +++ b/submissions/templates/submissions/_single_report_ratings.html @@ -0,0 +1,10 @@ +<div class="reportRatings"> + <ul> + <li>validity: {{report.get_validity_display}}</li> + <li>significance: {{report.get_significance_display}}</li> + <li>originality: {{report.get_originality_display}}</li> + <li>clarity: {{report.get_clarity_display}}</li> + <li>formatting: {{report.get_formatting_display}}</li> + <li>grammar: {{report.get_grammar_display}}</li> + </ul> +</div> diff --git a/submissions/templates/submissions/_submission_assignment_request.html b/submissions/templates/submissions/_submission_assignment_request.html new file mode 100644 index 0000000000000000000000000000000000000000..8b253bb83047c04ecdc63cc809e3c7a1ea569681 --- /dev/null +++ b/submissions/templates/submissions/_submission_assignment_request.html @@ -0,0 +1,29 @@ +{% load bootstrap %} + +<div class="card-block"> + {{ assignment.submission.header_as_table }} + <br /> + + <h4>Abstract:</h4> + <p>{{ assignment.submission.abstract }}</p> +</div> +<div class="card-footer"> + <h1>Accept or Decline this Assignment</h1> + <h3 class="mb-2">By accepting, you will be required to start a refereeing round on the next screen.</h3> + + <form action="{% url 'submissions:accept_or_decline_assignment_ack' assignment_id=assignment.id %}" method="post"> + {% csrf_token %} + <div class="form-group row"> + <div class="col-12"> + {{ consider_assignment_form.accept }} + </div> + </div> + <div class="row" id="ref_reason"> + <div class="col-12"> + <p>Please select a reason for declining this assignment</p> + {{ consider_assignment_form.refusal_reason|bootstrap:'0,12' }} + </div> + </div> + <input class="btn btn-secondary" type="submit" value="Submit" /> + </form> +</div> diff --git a/submissions/templates/submissions/_submission_card_author_content.html b/submissions/templates/submissions/_submission_card_author_content.html new file mode 100644 index 0000000000000000000000000000000000000000..f653408362c24a276babd4278640d06688b756dd --- /dev/null +++ b/submissions/templates/submissions/_submission_card_author_content.html @@ -0,0 +1,15 @@ +{% extends 'submissions/_submission_card_base.html' %} + +{% block card_block_footer %} + {{block.super}} + <p class="card-text">by {{submission.author_list}}</p> + <p class="card-text text-muted">Version {{submission.arxiv_vn_nr}} ({% if submission.is_current %}current version{% else %}deprecated version {{submission.arxiv_vn_nr}}{% endif %})</p> + <p class="card-text text-muted">Submitted {{submission.submission_date}} to {{submission.get_submitted_to_journal_display}} - latest activity: {{submission.latest_activity}}</p> + <p class="card-text">Status: {{submission.get_status_display}}</p> + + {% if current_user and current_user.contributor == submission.submitted_by %} + <p> + <a href="{% url 'submissions:communication' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr comtype='AtoE' %}">Write to the Editor-in-charge</a>. + </p> + {% endif %} +{% endblock %} diff --git a/submissions/templates/submissions/_submission_card_base.html b/submissions/templates/submissions/_submission_card_base.html new file mode 100644 index 0000000000000000000000000000000000000000..355d2f2e137b96c0c708c7b9b25def988627f611 --- /dev/null +++ b/submissions/templates/submissions/_submission_card_base.html @@ -0,0 +1,7 @@ +<div class="card-block"> + <h3 class="card-title"> + <a href="{% url 'submissions:submission' submission.arxiv_identifier_w_vn_nr %}">{{submission.title}}</a> + </h3> + + {% block card_block_footer %}{% endblock %} +</div> diff --git a/submissions/templates/submissions/_submission_card_content.html b/submissions/templates/submissions/_submission_card_content.html index 324763720467f6f4fdfb49f023246eb5f6ee4679..ed9d01a7aef68db99bbdce1b013860b2d2c1c1e9 100644 --- a/submissions/templates/submissions/_submission_card_content.html +++ b/submissions/templates/submissions/_submission_card_content.html @@ -1,8 +1,8 @@ -<div class="card-block"> - <h3 class="card-title"> - <a href="{% url 'submissions:submission' submission.arxiv_identifier_w_vn_nr %}">{{submission.title}}</a> - </h3> +{% extends 'submissions/_submission_card_base.html' %} + +{% block card_block_footer %} + {{block.super}} <p class="card-text">by {{submission.author_list}}</p> <p class="card-text text-muted">Version {{submission.arxiv_vn_nr}} ({% if submission.is_current %}current version{% else %}deprecated version {{submission.arxiv_vn_nr}}{% endif %})</p> <p class="card-text text-muted">Submitted {{submission.submission_date}} to {{submission.get_submitted_to_journal_display}} - latest activity: {{submission.latest_activity}}</p> -</div> +{% endblock %} diff --git a/submissions/templates/submissions/_submission_card_contributor_content.html b/submissions/templates/submissions/_submission_card_contributor_content.html new file mode 100644 index 0000000000000000000000000000000000000000..4f5b8fbe93eb705b4d1e3f6b7fc01315f7646fc7 --- /dev/null +++ b/submissions/templates/submissions/_submission_card_contributor_content.html @@ -0,0 +1,8 @@ +{% extends 'submissions/_submission_card_base.html' %} + +{% block card_block_footer %} + {{block.super}} + <p class="card-text">by {{submission.author_list}}</p> + <p class="card-text text-muted">Submitted {{submission.submission_date}} to {{submission.get_submitted_to_journal_display}}</p> + <p class="card-text text-muted">Status: {{submission.get_status_display}}</p> +{% endblock %} diff --git a/submissions/templates/submissions/_submission_card_eic_content.html b/submissions/templates/submissions/_submission_card_eic_content.html new file mode 100644 index 0000000000000000000000000000000000000000..41d94af29220d1f0b69ec2e5db8b7edf75c070c1 --- /dev/null +++ b/submissions/templates/submissions/_submission_card_eic_content.html @@ -0,0 +1,8 @@ +{% extends 'submissions/_submission_card_base.html' %} + +{% block card_block_footer %} + {{block.super}} + <p class="card-text text-muted">by {{submission.author_list}} (submitted {{submission.submission_date}} to {{submission.get_submitted_to_journal_display}})</p> + <p class="card-text text-muted">Status: {{submission.get_status_display}}</p> + <p class="card-text mt-2">Manage this Submission from its <a href="{% url 'submissions:editorial_page' submission.arxiv_identifier_w_vn_nr %}">Editorial Page</a>.</p> +{% endblock %} diff --git a/submissions/templates/submissions/_submission_card_fellow_content.html b/submissions/templates/submissions/_submission_card_fellow_content.html index e75e6caf6aafae299b180123a9fb87817d074084..ac70f328dc94adadfb72beb81d9d836b3146f045 100644 --- a/submissions/templates/submissions/_submission_card_fellow_content.html +++ b/submissions/templates/submissions/_submission_card_fellow_content.html @@ -1,7 +1,8 @@ -<div class="card-block"> - <h3 class="card-title"> - <a href="{% url 'submissions:submission' submission.arxiv_identifier_w_vn_nr %}">{{submission.title}}</a> - </h3> +{% extends 'submissions/_submission_card_base.html' %} + +{% block card_block_footer %} + {{block.super}} + <p class="card-text">by {{submission.author_list}}</p> <p class="card-text text-muted">Version {{submission.arxiv_vn_nr}} ({% if submission.is_current %}current version{% else %}deprecated version {{submission.arxiv_vn_nr}}{% endif %})</p> <p class="card-text text-muted">Submitted {{submission.submission_date}} to {{submission.get_submitted_to_journal_display}} - latest activity: {{submission.latest_activity}}</p> @@ -15,5 +16,4 @@ {% endif %} {% include 'submissions/_submission_refereeing_status.html' with submission=submission %} - {# {{submission.refereeing_status_as_p}}#} -</div> +{% endblock %} diff --git a/submissions/templates/submissions/_submission_card_in_pool.html b/submissions/templates/submissions/_submission_card_in_pool.html new file mode 100644 index 0000000000000000000000000000000000000000..e4dda343e3a45bc1f82041f584ddf765486a2505 --- /dev/null +++ b/submissions/templates/submissions/_submission_card_in_pool.html @@ -0,0 +1,66 @@ +{% load guardian_tags %} +{% load scipost_extras %} +{% load submissions_extras %} + + +{% include 'submissions/_submission_card_fellow_content.html' with submission=submission %} + +<div class="card-block"> + {% if submission.remark_set.all %} + <h4>Remarks on this submission:</h4> + <ul> + {% for rem in submission.remark_set.all %} + {{ rem.as_li }} + {% endfor %} + </ul> + {% endif %} + + {% if remark_form %} + {% include 'submissions/_remark_add_form.html' with submission=submission form=remark_form %} + {% endif %} + + {% get_obj_perms request.user for submission as "sub_perms" %} + {% if "can_take_editorial_actions" in sub_perms or request.user|is_in_group:'Editorial Administrators' %} + {% if submission|required_actions %} + <div class="required-actions"> + <h3 class="pt-0">Required actions:</h3> + <ul> + {% for todoitem in submission|required_actions %} + <li>{{ todoitem }}</li> + {% endfor %} + </ul> + </div> + {% endif %} + + <h4> + <a href="{% url 'submissions:editorial_page' submission.arxiv_identifier_w_vn_nr %}">Go to this Submission's Editorial Page</a> + </h4> + {% endif %} + + {% if perms.scipost.can_assign_submissions %} + {% if submission.editorialassignment_set.all %} + <h4>EIC Assignment requests:</h4> + <ul> + {% for assignment in submission.editorialassignment_set.all %} + {{ assignment.info_as_li }} + {% endfor %} + </ul> + {% endif %} + {% if submission.editor_in_charge == None %} + <h4>Actions:</h4> + <ul> + <li><a href="{% url 'submissions:assign_submission' submission.arxiv_identifier_w_vn_nr %}">Send a new assignment request</a></li> + <li><a href="{% url 'submissions:assignment_failed' submission.arxiv_identifier_w_vn_nr %}">Close pre-screening: failure to find EIC</a></li> + </ul> + {% endif %} + {% endif %} + + {% if request.user|is_in_group:'Editorial Administrators' %} + <h4> + <a href="{% url 'submissions:communication' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr comtype='StoE' %}">Send a communication to the Editor-in-charge</a> + </h4> + {% if submission.status == 'accepted' %} + <h4>After proofs have been accepted, you can <a href="{% url 'journals:initiate_publication' %}">initiate the publication process</a> (leads to the validation page)</h4> + {% endif %} + {% endif %} +</div> diff --git a/submissions/templates/submissions/assignments.html b/submissions/templates/submissions/assignments.html index 9fa1e95e0cdad78833979b564e726cbe4311fa2b..ed4ba37f61f4da762b7137600fcbae98dbc24c82 100644 --- a/submissions/templates/submissions/assignments.html +++ b/submissions/templates/submissions/assignments.html @@ -1,8 +1,12 @@ {% extends 'scipost/base.html' %} +{% load guardian_tags %} +{% load scipost_extras %} +{% load submissions_extras %} + {% block pagetitle %}: Assignments{% endblock pagetitle %} -{% block bodysup %} +{% block content %} <script> $(document).ready(function(){ @@ -16,92 +20,74 @@ $(document).ready(function(){ else { $('#ref_reason').hide(); } - }); - - $(".submitRemarkForm").hide(); - - $(".submitRemarkButton").click( function() { - $(this).next("div").toggle(); - }); }); +}); </script> -{% load guardian_tags %} -{% load scipost_extras %} -{% load submissions_extras %} - - {% if assignments_to_consider %} -<section> - - {% for assignment_to_consider in assignments_to_consider %} - - <div class="flex-greybox"> - <h1>Assignment request: can you act as Editor-in-charge? (see below to accept/decline):</h1> - </div> - <br> - <hr> - - {{ assignment_to_consider.submission.header_as_table }} - <br /> - <h4>Abstract:</h4> - <p>{{ assignment_to_consider.submission.abstract }}</p> - <br/> - - <hr> - <div class="flex-greybox"> - <h1>Accept or Decline this Assignment</h1> - </div> - <h3>By accepting, you will be required to start a refereeing round on the next screen.</h3> - <form action="{% url 'submissions:accept_or_decline_assignment_ack' assignment_id=assignment_to_consider.id %}" method="post"> - {% csrf_token %} - {{ consider_assignment_form.accept }} - <div id="ref_reason"> - <p>Please select a reason for declining this assignment:</p> - {{ consider_assignment_form.refusal_reason }} + <div class="row"> + <div class="col-12"> + <div class="highlight d-block p-3"> + <h1 class="p-0">Assignment request</h1> + <h3 class="p-0 mt-1 d-block text-muted">Can you act as Editor-in-charge? (see below to accept/decline)</h3> + </div> + </div> </div> - <input type="submit" value="Submit" /> - </form> - - <hr class="hr6"/> - {% endfor %} - -</section> -<hr class="hr12"/> + {% for assignment_to_consider in assignments_to_consider %} + <div class="row"> + <div class="col-12"> + <div class="card"> + {% include 'submissions/_submission_assignment_request.html' with assignment=assignment_to_consider %} + </div> + </div> + </div> + {% endfor %} +<hr> {% endif %} {% if current_assignments %} -<section> - <div class="flex-container"> - <div class="flex-greybox"> - <h1>Your current assignments:</h1> + <div class="row"> + <div class="col-12"> + <h1 class="highlight">Your current assignments:</h1> + </div> </div> - </div> - <ul> - {% for assignment in current_assignments %} - {{ assignment.submission.header_as_li_for_Fellows }} - <div class="flex-container"> - <div class-"flex-whitebox" style="background-color: #ffaaaa;"> - <h3>Required actions:</h3> - <ul> - {% for todoitem in assignment.submission|required_actions %} - <li>{{ todoitem }}</li> - {% endfor %} - </ul> - </div> + <div class="row"> + <div class="col-12"> + <ul class="list-group list-group-flush"> + {% for assignment in current_assignments %} + <li class="list-group-item"> + {% include 'submissions/_submission_card_fellow_content.html' with submission=assignment.submission %} + <div class="card-block"> + {% with actions=assignment.submission|required_actions %} + <div class="required-actions{% if not actions %} no-actions{% endif %}"> + <h3>{% if actions %}Required actions{% else %}No required actions{% endif %}</h3> + {% if actions %} + <ul> + {% for todoitem in assignment.submission|required_actions %} + <li>{{ todoitem }}</li> + {% endfor %} + </ul> + {% endif %} + </div> + {% endwith %} + <h4 class="d-block mt-2"> + <a href="{% url 'submissions:editorial_page' arxiv_identifier_w_vn_nr=assignment.submission.arxiv_identifier_w_vn_nr %}">Go to this Submission's Editorial Page</a> + </h4> + </div> + </li> + {% endfor %} + </ul> + </div> </div> - <h4><a href="{% url 'submissions:editorial_page' arxiv_identifier_w_vn_nr=assignment.submission.arxiv_identifier_w_vn_nr %}"> - Go to this Submission's Editorial Page</a></h4> - {% endfor %} - </ul> -</section> {% else %} -<section> - <p>You currently have no assignments to take care of.</p> -</section> + <div class="row"> + <div class="col-12"> + <p>You currently have no assignments to take care of.</p> + </div> + </div> {% endif %} -{% endblock bodysup %} +{% endblock content %} diff --git a/submissions/templates/submissions/pool.html b/submissions/templates/submissions/pool.html index b0a5e39d7226ed24706fb783a3480814a559bc27..4c505ce342baad574f12648e53de04a411a4284d 100644 --- a/submissions/templates/submissions/pool.html +++ b/submissions/templates/submissions/pool.html @@ -9,28 +9,6 @@ {% block content %} -<script> -$(document).ready(function(){ - - $('#ref_reason').hide(); - - $('#id_accept').on('change', function() { - if ($('#id_accept_1').is(':checked')) { - $('#ref_reason').show(); - } - else { - $('#ref_reason').hide(); - } - }); - - $(".submitRemarkForm").hide(); - - $(".submitRemarkButton").click( function() { - $(this).next("div").toggle(); - }); - }); -</script> - {% if request.user|is_in_group:'Editorial Administrators' and recommendations_undergoing_voting %} <div class="row"> <div class="col-12"> @@ -145,33 +123,7 @@ $(document).ready(function(){ <div class="row"> <div class="col-12"> <div class="card"> - <div class="card-block"> - {{ assignment_to_consider.submission.header_as_table }} - <br /> - - <h4>Abstract:</h4> - <p>{{ assignment_to_consider.submission.abstract }}</p> - </div> - <div class="card-footer"> - <h1>Accept or Decline this Assignment</h1> - <h3 class="mb-2">By accepting, you will be required to start a refereeing round on the next screen.</h3> - - <form action="{% url 'submissions:accept_or_decline_assignment_ack' assignment_id=assignment_to_consider.id %}" method="post"> - {% csrf_token %} - <div class="form-group row"> - <div class="col-12"> - {{ consider_assignment_form.accept }} - </div> - </div> - <div class="row" id="ref_reason"> - <div class="col-12"> - <p>Please select a reason for declining this assignment</p> - {{ consider_assignment_form.refusal_reason|bootstrap:'0,12' }} - </div> - </div> - <input class="btn btn-secondary" type="submit" value="Submit" /> - </form> - </div> + {% include 'submissions/_submission_assignment_request.html' with assignment=assignment_to_consider %} </div> </div> </div> @@ -281,71 +233,7 @@ $(document).ready(function(){ <!-- Submissions list --> {% for sub in submissions_in_pool %} <div class="card card-outline-secondary mt-1"> - {% include 'submissions/_submission_card_fellow_content.html' with submission=sub %} - - <div class="card-block"> - {% if sub.remark_set.all %} - <h4>Remarks on this submission:</h4> - <ul> - {% for rem in sub.remark_set.all %} - {{ rem.as_li }} - {% endfor %} - </ul> - {% endif %} - <button class="btn btn-secondary mb-2 submitRemarkButton" id="remarkButton{{ submission.id }}">Add a remark on this Submission</button> - <div class="submitRemarkForm pb-2" id="remarkForm{{ submission.id }}"> - <form action="{% url 'submissions:add_remark' arxiv_identifier_w_vn_nr=sub.arxiv_identifier_w_vn_nr %}" method="post"> - {% csrf_token %} - {{ remark_form|bootstrap:'0,12' }} - <input class="btn btn-secondary" type="submit" value="Submit" /> - </form> - </div> - - {% get_obj_perms request.user for sub as "sub_perms" %} - {% if "can_take_editorial_actions" in sub_perms or request.user|is_in_group:'Editorial Administrators' %} - {% if sub|required_actions %} - <div class="required-actions"> - <h3 class="pt-0">Required actions:</h3> - <ul> - {% for todoitem in sub|required_actions %} - <li>{{ todoitem }}</li> - {% endfor %} - </ul> - </div> - {% endif %} - - <h4> - <a href="{% url 'submissions:editorial_page' arxiv_identifier_w_vn_nr=sub.arxiv_identifier_w_vn_nr %}">Go to this Submission's Editorial Page</a> - </h4> - {% endif %} - - {% if perms.scipost.can_assign_submissions %} - {% if sub.editorialassignment_set.all %} - <h4>EIC Assignment requests:</h4> - <ul> - {% for assignment in sub.editorialassignment_set.all %} - {{ assignment.info_as_li }} - {% endfor %} - </ul> - {% endif %} - {% if sub.editor_in_charge == None %} - <h4>Actions:</h4> - <ul> - <li><a href="{% url 'submissions:assign_submission' arxiv_identifier_w_vn_nr=sub.arxiv_identifier_w_vn_nr %}">Send a new assignment request</a></li> - <li><a href="{% url 'submissions:assignment_failed' arxiv_identifier_w_vn_nr=sub.arxiv_identifier_w_vn_nr %}">Close pre-screening: failure to find EIC</a></li> - </ul> - {% endif %} - {% endif %} - - {% if request.user|is_in_group:'Editorial Administrators' %} - <h4> - <a href="{% url 'submissions:communication' arxiv_identifier_w_vn_nr=sub.arxiv_identifier_w_vn_nr comtype='StoE' %}">Send a communication to the Editor-in-charge</a> - </h4> - {% if sub.status == 'accepted' %} - <h4>After proofs have been accepted, you can <a href="{% url 'journals:initiate_publication' %}">initiate the publication process</a> (leads to the validation page)</h4> - {% endif %} - {% endif %} - </div> + {% include 'submissions/_submission_card_in_pool.html' with submission=sub remark_form=remark_form %} </div> {% endfor %} </div> diff --git a/submissions/templates/submissions/submission_detail.html b/submissions/templates/submissions/submission_detail.html index 3e793e6ced6e4fdf739845e90fc5ef1584e0fb95..15a64f60c15819593496a5c3a0f5a9efc7a77d3a 100644 --- a/submissions/templates/submissions/submission_detail.html +++ b/submissions/templates/submissions/submission_detail.html @@ -14,12 +14,6 @@ $("#invitedreportsbutton").click(function(){ $("#invitedreportslist").toggle(); }); - $("#contributedreportsbutton").click(function(){ - $("#contributedreportslist").toggle(); - }); - $("#commentsbutton").click(function(){ - $("#commentslist").toggle(); - }); var comment_text_input = $("#id_comment_text"); @@ -145,81 +139,18 @@ <hr> <div class="row"> <div class="col-12"> - <div class="panel"> - <h2>Invited Reports on this Submission</h2> - <button class="btn btn-secondary" id="invitedreportsbutton">Toggle invited reports view</button> + <div class="card card-grey"> + <div class="card-block"> + <h2 class="card-title">Invited Reports on this Submission</h2> + <button class="btn btn-secondary" data-toggle="toggle" data-target="#invitedreportslist">Toggle invited reports view</button> + </div> </div> </div> </div> -<div class="row" id="invitedreportslist"> +<div id="invitedreportslist"> {% for report in invited_reports %} - <div class="col-12"> - <div class="report"> - {% if user.contributor == submission.editor_in_charge or user|is_in_group:'Editorial Administrators' and not is_author or user|is_in_group:'Editorial Administrators' and not is_author_unchecked %} - {% if report.flagged %} - <h4 style="color: red">CAUTION: check if this referee has been flagged by the authors</h4> - {% endif %} - {{ report.print_contents_for_editors }} - {% else %} - {{ report.print_identifier }} - {{ report.print_contents }} - {% endif %} - - <hr class="small"> - <h3 class="mb-3"><a href="{% url 'comments:reply_to_report' report_id=report.id %}">Reply to this Report</a> (authors only)</h3> - - {% for reply in author_replies %} - {% if reply.in_reply_to_report %} - {% if reply.in_reply_to_report.id == report.id %} - <div class="report nested_report"> - <div class="row"> - <div class="col-12"> - {{ reply.print_identifier }} - {{ reply.categories_as_ul }} - <div class="opinionsDisplay"> - {% if user.is_authenticated and perms.scipost.can_express_opinion_on_comments %} - {% if user.contributor != reply.author %} - <form action="{% url 'comments:express_opinion' comment_id=reply.id opinion='A' %}" method="post"> - {% csrf_token %} - <input type="submit" class="agree" value="Agree {{ reply.nr_A }} "/> - </form> - <form action="{% url 'comments:express_opinion' comment_id=reply.id opinion='N' %}" method="post"> - {% csrf_token %} - <input type="submit" class="notsure" value="Not sure {{ reply.nr_N }}"/> - </form> - <form action="{% url 'comments:express_opinion' comment_id=reply.id opinion='D'%}" method="post"> - {% csrf_token %} - <input type="submit" class="disagree" value="Disagree {{ reply.nr_D }}"/> - </form> - {% else %} - {{ reply.opinions_as_ul }} - {% endif %} - {% endif %} - </div> - </div> - <div class="col-12"> - <p>{{ reply.comment_text|linebreaks }}</p> - {% if reply.file_attachment %} - <h3>Attachment:</h3> - <p> - <a target="_blank" href="{{ reply.file_attachment.url }}"> - {% if reply.file_attachment|is_image %} - <img class="attachment attachment-comment" src="{{ reply.file_attachment.url }}"> - {% else %} - {{ reply.file_attachment|filename }}<br><small>{{ reply.file_attachment.size|filesizeformat }}</small> - {% endif %} - </a> - </p> - {% endif %} - </div> - </div> - </div> - {% endif %} - {% endif %} - {% endfor %} - </div> - </div> + {% include 'submissions/_single_report.html' with report=report user=request.user perms=perms %} {% endfor %} </div> @@ -229,76 +160,18 @@ <hr> <div class="row"> <div class="col-12"> - <div class="panel"> - <h2>Contributed Reports on this Submission</h2> - <button class="btn btn-secondary" id="contributedreportsbutton">Toggle contributed reports view</button> + <div class="card card-grey"> + <div class="card-block"> + <h2 class="card-title">Contributed Reports on this Submission</h2> + <button class="btn btn-secondary" data-toggle="toggle" data-target="#contributedreportslist">Toggle contributed reports view</button> + </div> </div> </div> </div> -<div class="row" id="contributedreportslist"> +<div id="contributedreportslist"> {% for report in contributed_reports %} - <div class="col-12"> - <div class="report"> - {% if user.contributor == submission.editor_in_charge or user|is_in_group:'Editorial Administrators' and not is_author or user|is_in_group:'Editorial Administrators' and not is_author_unchecked %} - {% if report.flagged %} - <h4 style="color: red">CAUTION: check if this referee has been flagged by the authors</h4> - {% endif %} - {{ report.print_contents_for_editors }} - {% else %} - {{ report.print_identifier }} - {{ report.print_contents }} - {% endif %} - - <hr class="small"> - <h3><a href="{% url 'comments:reply_to_report' report_id=report.id %}">Reply to this Report</a> (authors only)</h3> - - {% for reply in author_replies %} - {% if reply.in_reply_to_report %} - {% if reply.in_reply_to_report.id == report.id %} - <div class="row"> - <div class="col-1"></div> - <hr style="border-style: dotted;" /> - - <div class="flex-container"> - <div class="flex-commentbox"> - {{ reply.print_identifier }} - {{ reply.categories_as_ul }} - <div class="opinionsDisplay"> - {% if user.is_authenticated and perms.scipost.can_express_opinion_on_comments %} - {% if user.contributor != reply.author %} - <form action="{% url 'comments:express_opinion' comment_id=reply.id opinion='A' %}" method="post"> - {% csrf_token %} - <input type="submit" class="agree" value="Agree {{ reply.nr_A }} "/> - </form> - <form action="{% url 'comments:express_opinion' comment_id=reply.id opinion='N' %}" method="post"> - {% csrf_token %} - <input type="submit" class="notsure" value="Not sure {{ reply.nr_N }}"/> - </form> - <form action="{% url 'comments:express_opinion' comment_id=reply.id opinion='D'%}" method="post"> - {% csrf_token %} - <input type="submit" class="disagree" value="Disagree {{ reply.nr_D }}"/> - </form> - {% else %} - {{ reply.opinions_as_ul }} - {% endif %} - {% endif %} - </div> - </div> - </div> - </div> - <div class="row"> - <div class="col-1"></div> - <div class="col-10"> - <p>{{ reply.comment_text|linebreaks }}</p> - </div> - </div> - - {% endif %} - {% endif %} - {% endfor %} - </div> - </div> + {% include 'submissions/_single_report.html' with report=report user=request.user perms=perms %} {% endfor %} </div> diff --git a/submissions/templates/submissions/submissions.html b/submissions/templates/submissions/submissions.html index 4abd6ffd43c7d5e22b2ce747a91ecfd61cc48bd5..08e868ff3505519edb3c14721c56bb7f83dcd464 100644 --- a/submissions/templates/submissions/submissions.html +++ b/submissions/templates/submissions/submissions.html @@ -40,9 +40,9 @@ </div> </div> +<hr> <div class="row"> <div class="col-12"> - <hr class="hr12"> {% if recent %} <h2>Recent Submissions:</h2> {% elif browse %} @@ -52,16 +52,20 @@ {% endif %} {% if object_list %} {% if is_paginated %} - <p> - {% if page_obj.has_previous %} - <a href="?{% url_replace page=page_obj.previous_page_number %}">Previous</a> - {% endif %} - Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}. - {% if page_obj.has_next %} - <a href="?{% url_replace page=page_obj.next_page_number %}">Next</a> - {% endif %} - </p> + <p> + {% if page_obj.has_previous %} + <a href="?{% url_replace page=page_obj.previous_page_number %}">Previous</a> + {% endif %} + Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}. + {% if page_obj.has_next %} + <a href="?{% url_replace page=page_obj.next_page_number %}">Next</a> + {% endif %} + </p> {% endif %} + + </div> + <div class="col-12"> + <ul class="list-group list-group-flush"> {% for submission in object_list %} <li class="list-group-item"> diff --git a/submissions/templates/submissions/submissions_by_status.html b/submissions/templates/submissions/submissions_by_status.html index 82a4babfa350f766ac8af7373d850a4815e0b7b7..260620dec68e83973eb23b1916aa969299c4545c 100644 --- a/submissions/templates/submissions/submissions_by_status.html +++ b/submissions/templates/submissions/submissions_by_status.html @@ -1,98 +1,28 @@ {% extends 'scipost/base.html' %} -{% block pagetitle %}: Submissions by status{% endblock pagetitle %} - -{% block bodysup %} - -<script> -$(document).ready(function(){ - - $('#ref_reason').hide(); - - $('#id_accept').on('change', function() { - if ($('#id_accept_1').is(':checked')) { - $('#ref_reason').show(); - } - else { - $('#ref_reason').hide(); - } - }); - - $(".submitRemarkForm").hide(); - - $(".submitRemarkButton").click( function() { - $(this).next("div").toggle(); - }); - }); - -</script> - {% load guardian_tags %} {% load scipost_extras %} {% load submissions_extras %} +{% block pagetitle %}: Submissions by status{% endblock pagetitle %} + +{% block content %} -<section> - <div class="flex-container"> - <div class="flex-greybox"> - <h1>SciPost Submissions with status {{ status }}</h1> +<div class="row"> + <div class="col-12"> + <h1 class="highlight">SciPost Submissions with status {{ submissions_of_status.first.get_status_display }}</h1> </div> - </div> - - <ul> - {% for sub in submissions_of_status %} - {% if request.user|is_not_author_of_submission:sub.arxiv_identifier_w_vn_nr %} - <br/> - {{ sub.header_as_li_for_Fellows }} - {% if sub.remark_set.all %} - <h4>Remarks on this submission:</h4> - <ul> - {% for rem in sub.remark_set.all %} - {{ rem.as_li }} - {% endfor %} - </ul> - {% endif %} - <button class="submitRemarkButton" id="remarkButton{{ submission.id }}">Add a remark on this Submission</button> - <div class="submitRemarkForm" id="remarkForm{{ submission.id }}"> - <form action="{% url 'submissions:add_remark' arxiv_identifier_w_vn_nr=sub.arxiv_identifier_w_vn_nr %}" method="post"> - {% csrf_token %} - {{ remark_form.as_p }} - <input type="submit" value="Submit" /> - </form> +</div> + +<div class="row"> + <div class="col-12"> + <!-- Submissions list --> + {% for sub in submissions_of_status %} + <div class="card card-outline-secondary mt-1"> + {% include 'submissions/_submission_card_in_pool.html' with submission=sub remark_form=remark_form %} + </div> + {% endfor %} </div> - {% get_obj_perms request.user for sub as "sub_perms" %} - {% if "can_take_editorial_actions" in sub_perms or request.user|is_in_group:'Editorial Administrators' %} - <h4><a href="{% url 'submissions:editorial_page' arxiv_identifier_w_vn_nr=sub.arxiv_identifier_w_vn_nr %}"> - Go to this Submission's Editorial Page</a></h4> - {% endif %} - {% if perms.scipost.can_assign_submissions %} - {% if sub.editorialassignment_set.all %} - <h4>EIC Assignment requests:</h4> - <ul> - {% for assignment in sub.editorialassignment_set.all %} - {{ assignment.info_as_li }} - {% endfor %} - </ul> - {% endif %} - {% if sub.editor_in_charge == None %} - <h4>Actions:</h4> - <ul> - <li><a href="{% url 'submissions:assign_submission' arxiv_identifier_w_vn_nr=sub.arxiv_identifier_w_vn_nr %}">Send a new assignment request</a></li> - <li><a href="{% url 'submissions:assignment_failed' arxiv_identifier_w_vn_nr=sub.arxiv_identifier_w_vn_nr %}">Close pre-screening: failure to find EIC</a></li> - </ul> - {% endif %} - {% endif %} - {% if request.user|is_in_group:'Editorial Administrators' %} - <h4><a href="{% url 'submissions:communication' arxiv_identifier_w_vn_nr=sub.arxiv_identifier_w_vn_nr comtype='StoE' %}">Send a communication to the Editor-in-charge</a></h4> - {% if sub.status == 'accepted' %} - <h4>After proofs have been accepted, you can - <a href="{% url 'journals:initiate_publication' %}">initiate the publication process</a> (leads to the validation page)</h4> - {% endif %} - {% endif %} - {% endif %} - {% endfor %} - </ul> - -</section> +</div> -{% endblock bodysup %} +{% endblock content %} diff --git a/submissions/views.py b/submissions/views.py index 93e008ea3a86bbeff4ce7cc9d51a55cefbfc2c99..89a633c257136419cb47da29464d8caf8d900716 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -384,10 +384,12 @@ def submissions_by_status(request, status): if status not in submission_status_dict.keys(): errormessage = 'Unknown status.' return render(request, 'scipost/error.html', {'errormessage': errormessage}) - submissions_of_status = Submission.objects.filter( - status=status).order_by('-submission_date') - context = {'status': submission_status_dict[status], - 'submissions_of_status': submissions_of_status, } + submissions_of_status = (Submission.objects.get_pool(request.user) + .filter(status=status).order_by('-submission_date')) + context = { + 'submissions_of_status': submissions_of_status, + 'remark_form': RemarkForm() + } return render(request, 'submissions/submissions_by_status.html', context) diff --git a/theses/managers.py b/theses/managers.py index 79e971b796332fa2fd46270961a988389b00d0f2..68dc44574b8722927314cc063cbd22ef26c02a58 100644 --- a/theses/managers.py +++ b/theses/managers.py @@ -1,7 +1,4 @@ -import datetime - from django.db import models -from django.utils import timezone class ThesisLinkManager(models.Manager): diff --git a/theses/models.py b/theses/models.py index 0b5d333757c72aeb3d893454b2a520faad373f69..f744431a5831180e6c0c7751ec668379659790b7 100644 --- a/theses/models.py +++ b/theses/models.py @@ -1,10 +1,8 @@ from django.utils import timezone from django.db import models -from django.template import Template, Context -from journals.models import SCIPOST_JOURNALS_DOMAINS, journals_domains_dict -from scipost.constants import SCIPOST_DISCIPLINES, SCIPOST_SUBJECT_AREAS,\ - subject_areas_dict, disciplines_dict +from journals.models import SCIPOST_JOURNALS_DOMAINS +from scipost.constants import SCIPOST_DISCIPLINES, SCIPOST_SUBJECT_AREAS from scipost.models import Contributor from .managers import ThesisLinkManager @@ -70,16 +68,3 @@ class ThesisLink(models.Model): def __str__(self): return self.title - - def simple_header_as_li(self): - # for Lists - context = Context({ - 'id': self.id, 'title': self.title, 'author': self.author}) - header = ( - '<li><div class="flex-container">' - '<div class="flex-whitebox0"><p><a href="/thesis/{{ id }}" ' - 'class="pubtitleli">{{ title }}</a></p>' - '<p>' + self.THESIS_TYPES_DICT[self.type] + - ' thesis by {{ author }} </div></div></li>') - template = Template(header) - return template.render(context) diff --git a/theses/templates/theses/_thesislink_card_content.html b/theses/templates/theses/_thesislink_card_content.html new file mode 100644 index 0000000000000000000000000000000000000000..89fbde9224a364d55fb1851c9e474345a82a8d2c --- /dev/null +++ b/theses/templates/theses/_thesislink_card_content.html @@ -0,0 +1,15 @@ +{% load theses_extras %} + +<div class="card-block"> + <h3 class="card-title"> + <a href="{% url 'theses:thesis' thesislink_id=thesislink.id %}">{{ thesislink.title }}</a> + </h3> + <p class="card-text"> + {{ thesislink.get_type_display }} thesis by {{ thesislink.author }} + (supervisor(s): {{ thesislink.supervisor }}) in + {{ thesislink.get_discipline_display }}, {{ thesislink.get_domain_display }} {{ thesislink.get_subject_area_display }}. + </p> + <p class="card-text text-muted"> + Defense date: {{ thesislink.defense_date }}. Latest activity: {{ thesislink.latest_activity|date:"DATE_FORMAT" }}. + </p> +</div> diff --git a/theses/templates/theses/_thesislink_header_as_li.html b/theses/templates/theses/_thesislink_header_as_li.html deleted file mode 100644 index bb6f8503518925af1ddf5fa8048fdcbc05da9590..0000000000000000000000000000000000000000 --- a/theses/templates/theses/_thesislink_header_as_li.html +++ /dev/null @@ -1,12 +0,0 @@ -{% load theses_extras %} - -<li> - <p> - <a href="{% url 'theses:thesis' thesislink_id=thesislink.id %}" class="pubtitleli">{{ thesislink.title }}</a> - </p> - <p>{{ thesislink|type }} thesis by {{ thesislink.author }} - (supervisor(s): {{ thesislink.supervisor }}) in - {{ thesislink|discipline }}, {{ thesislink|domain }} {{ thesislink|subject_area }}. - </p> - <p>Defense date: {{ thesislink.defense_date }}. Latest activity: {{ thesislink.latest_activity|date:"DATE_FORMAT" }}.</p> -</li> diff --git a/theses/templates/theses/theses.html b/theses/templates/theses/theses.html deleted file mode 100644 index 6abaedb7eb8c1764cbcdee25d1b3f0e222cfde93..0000000000000000000000000000000000000000 --- a/theses/templates/theses/theses.html +++ /dev/null @@ -1,87 +0,0 @@ -{% extends 'scipost/base.html' %} - -{% load bootstrap %} - -{% block pagetitle %}: Theses{% endblock pagetitle %} - -{% block headsup %} -<script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"></script> -{% endblock headsup %} - -{% block content %} - -<div class="row"> - <div class="col-md-4"> - <div class="panel page-header-panel"> - <h1>SciPost Theses</h1> - <h3><a href="{% url 'theses:request_thesislink' %}">Request a new Thesis Link</a></h3> - </div> - </div> - <div class="col-md-4"> - <div class="panel page-header-panel"> - <h2>Search SciPost Theses:</h2> - <form class="small" action="{% url 'theses:theses' %}" method="get"> - <table> - {{ form|bootstrap:'4,8,sm' }} - </table> - <input class="btn btn-sm btn-secondary" type="submit" name="Submit" /> - </form> - </div> - </div> - <div class="col-md-4"> - <div class="panel page-header-panel"> - <h2>View SciPost Theses</h2> - <ul> - <li>Physics: last <a href="{% url 'theses:browse' discipline='physics' nrweeksback=1 %}">week</a>, <a href="{% url 'theses:browse' discipline='physics' nrweeksback=4 %}">month</a> or <a href="{% url 'theses:browse' discipline='physics' nrweeksback=52 %}">year</a> </li> - </ul> - </div> - </div> - </div> - - {% if search_results or form.has_changed %} - <div class="row"> - <div class="col-12"> - <hr class="hr12"> - <h3>Search results:</h3> - {% if search_results %} - <ul> - {% for thesislink in search_results %} - {% include 'theses/_thesislink_header_as_li.html' with thesislink=thesislink %} - {% endfor %} - </ul> - {% elif form.has_changed %} - <h3>No match found for your search query.</h3> - {% endif %} - </div> -</div> -{% endif %} - -{% if recent_theses %} -<div class="row"> - <div class="col-12"> - <hr class="hr12"> - <h2>Recently active Thesis Links:</h2> - <ul> - {% for thesislink in recent_theses %} - {% include 'theses/_thesislink_header_as_li.html' with thesislink=thesislink %} - {% endfor %} - </ul> - </div> -</div> -{% endif %} - -{% if thesislink_browse_list %} -<div class="row"> - <div class="col-12"> - <hr class="hr12"> - <h2>Thesis Links in {{ discipline }} in the last {{ nrweeksback }} week{% if nrweeksback == '1' %}{% else %}s{% endif %}:</h2> - <ul> - {% for thesislink in thesislink_browse_list %} - {% include 'theses/_thesislink_header_as_li.html' with thesislink=thesislink %} - {% endfor %} - </ul> - </div> -</div> -{% endif %} - -{% endblock content %} diff --git a/theses/templates/theses/thesis_detail.html b/theses/templates/theses/thesis_detail.html index edde03144f188effb6c6fad2c30bf6783b4ac6b9..12a49b417caea35912379368119483f12134d5b5 100644 --- a/theses/templates/theses/thesis_detail.html +++ b/theses/templates/theses/thesis_detail.html @@ -8,9 +8,6 @@ <script> $(document).ready(function(){ - $("#commentsbutton").click(function(){ - $("#commentslist").toggle(); - }); var comment_text_input = $("#id_comment_text"); @@ -33,11 +30,9 @@ {% block content %} <div class="row"> - <div class="col-12"> - <div class="panel"> - <h1>SciPost Thesis Link</h1> + <div class="col-12"> + <h1 class="highlight">SciPost Thesis Link</h1> </div> - </div> </div> <hr /> diff --git a/theses/templates/theses/thesislink_list.html b/theses/templates/theses/thesislink_list.html new file mode 100644 index 0000000000000000000000000000000000000000..c735fd247c1ef7fe05aa75e5887e59007d2f5b54 --- /dev/null +++ b/theses/templates/theses/thesislink_list.html @@ -0,0 +1,86 @@ +{% extends 'scipost/base.html' %} + +{% load bootstrap %} +{% load request_filters %} + +{% block pagetitle %}: Theses{% endblock pagetitle %} + +{% block headsup %} +<script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"></script> +{% endblock headsup %} + +{% block content %} + +<div class="row"> + <div class="col-md-4"> + <div class="card card-grey"> + <div class="card-block min-height-190"> + <h1 class="card-title">SciPost Theses</h1> + <h3><a href="{% url 'theses:request_thesislink' %}">Request a new Thesis Link</a></h3> + </div> + </div> + </div> + <div class="col-md-4"> + <div class="card card-grey"> + <div class="card-block min-height-190"> + <h2 class="card-title">Search SciPost Theses:</h2> + <form class="small" action="{% url 'theses:theses' %}" method="get"> + {{ form|bootstrap:'4,8,sm' }} + <input class="btn btn-sm btn-secondary" type="submit" name="Submit" /> + </form> + </div> + </div> + </div> + <div class="col-md-4"> + <div class="card card-grey"> + <div class="card-block min-height-190"> + <h2 class="card-title">View SciPost Theses</h2> + <ul> + <li>Physics: last <a href="{% url 'theses:browse' discipline='physics' nrweeksback=1 %}">week</a>, <a href="{% url 'theses:browse' discipline='physics' nrweeksback=4 %}">month</a> or <a href="{% url 'theses:browse' discipline='physics' nrweeksback=52 %}">year</a> </li> + </ul> + </div> + </div> + </div> +</div> + +<hr> +<div class="row"> + <div class="col-12"> + {% if recent %} + <h2>Recently active Thesis Links:</h2> + {% elif browse %} + <h2>Thesis Links in {{ discipline }} in the last {{ nrweeksback }} week{{ nrweeksback|pluralize }}:</h2> + {% else %} + <h2>Search results:</h3> + {% endif %} + + {% if object_list %} + {% if is_paginated %} + <p> + {% if page_obj.has_previous %} + <a href="?{% url_replace page=page_obj.previous_page_number %}">Previous</a> + {% endif %} + Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}. + {% if page_obj.has_next %} + <a href="?{% url_replace page=page_obj.next_page_number %}">Next</a> + {% endif %} + </p> + {% endif %} + + </div> + <div class="col-12"> + + <ul class="list-group list-group-flush"> + {% for thesislink in object_list %} + <li class="list-group-item"> + {% include 'theses/_thesislink_card_content.html' with thesislink=thesislink %} + </li> + {% endfor %} + </ul> + {% else %} + <h3>No match found for your search query.</h3> + {% endif %} + </div> +</div> + +{% endblock content %} diff --git a/theses/urls.py b/theses/urls.py index a0734fdb52195d0ffaa5864a8ed649fe7129630d..5f8baf0e35cb4f7e7564746256b3cb99b58589a8 100644 --- a/theses/urls.py +++ b/theses/urls.py @@ -5,8 +5,8 @@ from . import views urlpatterns = [ # Thesis Links - url(r'^$', views.theses, name='theses'), - url(r'^browse/(?P<discipline>[a-z]+)/(?P<nrweeksback>[0-9]+)/$', views.browse, name='browse'), + url(r'^$', views.ThesisListView.as_view(), name='theses'), + url(r'^browse/(?P<discipline>[a-z]+)/(?P<nrweeksback>[0-9]+)/$', views.ThesisListView.as_view(), name='browse'), url(r'^(?P<thesislink_id>[0-9]+)/$', views.thesis_detail, name='thesis'), url(r'^request_thesislink$', views.RequestThesisLink.as_view(), name='request_thesislink'), url(r'^unvetted_thesislinks$', views.UnvettedThesisLinks.as_view(), name='unvetted_thesislinks'), diff --git a/theses/views.py b/theses/views.py index 87d39a7f6d182336dc43c3e32c1de106acd1bdc7..9f6a10f83005fa86da1c877ea2a5b45b8222cea7 100644 --- a/theses/views.py +++ b/theses/views.py @@ -86,47 +86,44 @@ class VetThesisLink(UpdateView): return kwargs -def theses(request): - form = ThesisLinkSearchForm(request.GET) - if form.is_valid() and form.has_changed(): - search_results = ThesisLink.objects.search_results(form) - recent_theses = [] - else: - recent_theses = ThesisLink.objects.latest(5) - search_results = [] - - context = { - 'form': form, 'search_results': search_results, - 'recent_theses': recent_theses - } - return render(request, 'theses/theses.html', context) - - -def browse(request, discipline, nrweeksback): - if request.method == 'POST': - form = ThesisLinkSearchForm(request.POST) - if form.is_valid() and form.has_changed(): - thesislink_search_list = ThesisLink.objects.filter( - title__icontains=form.cleaned_data['title_keyword'], - author__icontains=form.cleaned_data['author'], - abstract__icontains=form.cleaned_data['abstract_keyword'], - supervisor__icontains=form.cleaned_data['supervisor'], - vetted=True, +class ThesisListView(ListView): + model = ThesisLink + form = ThesisLinkSearchForm + thesis_search_list = [] + paginate_by = 10 + + def get_queryset(self): + # Context is not saved to View object by default + self.pre_context = self.kwargs + + # Browse is discipline is given + if 'discipline' in self.kwargs: + self.pre_context['browse'] = True + + # Queryset for browsing + if self.kwargs.get('browse', False): + return self.model.objects.vetted().filter( + discipline=self.kwargs['discipline'], + latest_activity__gte=timezone.now() + datetime.timedelta( + weeks=-int(self.kwargs['nrweeksback'])), ) - thesislink_search_list.order_by('-pub_date') - else: - thesislink_search_list = [] - context = {'form': form, 'thesislink_search_list': thesislink_search_list} - return HttpResponseRedirect(request, 'theses/theses.html', context) - else: - form = ThesisLinkSearchForm() - thesislink_browse_list = (ThesisLink.objects.filter( - vetted=True, discipline=discipline, - latest_activity__gte=timezone.now() + datetime.timedelta(weeks=-int(nrweeksback)))) - context = {'form': form, 'discipline': discipline, - 'nrweeksback': nrweeksback, - 'thesislink_browse_list': thesislink_browse_list} - return render(request, 'theses/theses.html', context) + + # Queryset for searchform is processed by managers + form = self.form(self.request.GET) + if form.is_valid() and form.has_changed(): + return self.model.objects.search_results(form) + self.pre_context['recent'] = True + return self.model.objects.vetted() + + def get_context_data(self, **kwargs): + # Update the context data from `get_queryset` + context = super().get_context_data(**kwargs) + context.update(self.pre_context) + + # Search form added to context + context['form'] = self.form(initial=self.request.GET) + + return context def thesis_detail(request, thesislink_id):