From 19b78c82eef7dedda30253ac5397b91d3bc81111 Mon Sep 17 00:00:00 2001 From: Jorran de Wit <jorrandewit@outlook.com> Date: Sun, 21 May 2017 11:46:33 +0200 Subject: [PATCH] Append explicit (re)submission form message notices --- submissions/forms.py | 5 +-- .../templates/submissions/new_submission.html | 9 ++++- .../submissions/prefill_using_identifier.html | 34 ------------------- submissions/views.py | 17 +++++++++- 4 files changed, 25 insertions(+), 40 deletions(-) diff --git a/submissions/forms.py b/submissions/forms.py index 266b66824..c024b162a 100644 --- a/submissions/forms.py +++ b/submissions/forms.py @@ -88,9 +88,6 @@ class SubmissionChecks: self.last_submission = submission if submission.status == STATUS_REVISION_REQUESTED: self.is_resubmission = True - # resubmessage = ('There already exists a preprint with this arXiv identifier ' - # 'but a different version number. \nYour Submission will be ' - # 'handled as a resubmission.') elif submission.status in [STATUS_REJECTED, STATUS_REJECTED_VISIBLE]: error_message = ('This arXiv preprint has previously undergone refereeing ' 'and has been rejected. Resubmission is only possible ' @@ -100,7 +97,7 @@ class SubmissionChecks: else: error_message = ('There exists a preprint with this arXiv identifier ' 'but an earlier version number, which is still undergoing ' - 'peer refereeing.' + 'peer refereeing. ' 'A resubmission can only be performed after request ' 'from the Editor-in-charge. Please wait until the ' 'closing of the previous refereeing round and ' diff --git a/submissions/templates/submissions/new_submission.html b/submissions/templates/submissions/new_submission.html index e0dbc27ad..7cb8592ad 100644 --- a/submissions/templates/submissions/new_submission.html +++ b/submissions/templates/submissions/new_submission.html @@ -34,7 +34,14 @@ $(document).ready(function(){ <div class="row"> <div class="col-12"> - <h1 class="highlight">Submit a manuscript to SciPost</h1> + <div class="card card-grey"> + <div class="card-block"> + <h1 class="card-title mb-0">Submit a manuscript to SciPost</h1> + {% if form.arxiv_identifier_w_vn_nr.value %}<h2 class="my-1 py-0 text-blue">{{form.arxiv_identifier_w_vn_nr.value}}{% if form.is_resubmission.value %} <small>(resubmission)</small>{% endif %}</h2>{% endif %} + </div> + </div> + </div> + <div class="col-12"> <p class="mb-1"> Before submitting, make sure you agree with the <a href="{% url 'journals:journals_terms_and_conditions' %}">SciPost Journals Terms and Conditions</a>. </p> diff --git a/submissions/templates/submissions/prefill_using_identifier.html b/submissions/templates/submissions/prefill_using_identifier.html index 5af8f507c..fd3781c6f 100644 --- a/submissions/templates/submissions/prefill_using_identifier.html +++ b/submissions/templates/submissions/prefill_using_identifier.html @@ -6,35 +6,6 @@ {% block content %} -<script> -$(document).ready(function(){ - $("#id_submission_type").closest('tr').hide() - - $('select#id_submitted_to_journal').on('change', function (){ - var selection = $(this).val(); - switch(selection){ - case "SciPost Physics": - $("#id_submission_type").closest('tr').show() - break; - default: - $("#id_submission_type").closest('tr').hide() - } -}); - - var isresub = $("#id_is_resubmission").val(); - switch(isresub){ - case "True": - $("#id_author_comments").closest('tr').show() - $("#id_list_of_changes").closest('tr').show() - break; - default: - $("#id_author_comments").closest('tr').hide() - $("#id_list_of_changes").closest('tr').hide() - } - -}); -</script> - <div class="row"> <div class="col-12"> <h1 class="highlight">Submit a manuscript to SciPost</h1> @@ -71,11 +42,6 @@ $(document).ready(function(){ </div> </div> - - {% if resubmessage %} - <h3 class="text-success">{{ resubmessage }}</h3> - {% endif %} - {% else %} <h3>You are currently not allowed to submit a manuscript.</h3> {% endif %} diff --git a/submissions/views.py b/submissions/views.py index ba4a51f9e..2aeb15ffc 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -77,6 +77,12 @@ class RequestSubmission(CreateView): SubmissionUtils.send_authors_submission_ack_email() return super().form_valid(form) + def form_invalid(self, form): + # r = form.errors + for error_messages in form.errors.values(): + messages.warning(self.request, *error_messages) + return super().form_invalid(form) + @permission_required('scipost.can_submit_manuscript', raise_exception=True) def prefill_using_arxiv_identifier(request): @@ -84,7 +90,16 @@ def prefill_using_arxiv_identifier(request): if query_form.is_valid(): prefill_data = query_form.request_arxiv_preprint_form_prefill_data() form = RequestSubmissionForm(initial=prefill_data) - messages.success(request, strings.acknowledge_arxiv_query, fail_silently=True) + + # Submit message to user + if query_form.submission_is_resubmission(): + resubmessage = ('There already exists a preprint with this arXiv identifier ' + 'but a different version number. \nYour Submission will be ' + 'handled as a resubmission.') + messages.success(request, resubmessage, fail_silently=True) + else: + messages.success(request, strings.acknowledge_arxiv_query, fail_silently=True) + context = { 'form': form, } -- GitLab