diff --git a/commentaries/forms.py b/commentaries/forms.py index 68796e3f47c79a283dad7513eb569ecbc7e83bd4..fd158ef1e844320d32828170c0e609905bcb846e 100644 --- a/commentaries/forms.py +++ b/commentaries/forms.py @@ -9,11 +9,13 @@ from .models import Commentary, COMMENTARY_PUBLISHED, COMMENTARY_PREPRINT from scipost.services import DOICaller, ArxivCaller from scipost.models import Contributor +import strings + class DOIToQueryForm(forms.Form): VALID_DOI_REGEXP = r'^(?i)10.\d{4,9}/[-._;()/:A-Z0-9]+$' - doi = forms.RegexField(regex=VALID_DOI_REGEXP, strip=False, widget=forms.TextInput( - {'label': 'DOI', 'placeholder': 'ex.: 10.21468/00.000.000000'})) + doi = forms.RegexField(regex=VALID_DOI_REGEXP, strip=True, help_text=strings.doi_query_help_text, + widget=forms.TextInput({'label': 'DOI', 'placeholder': strings.doi_query_placeholder})) def clean_doi(self): input_doi = self.cleaned_data['doi'] @@ -41,7 +43,9 @@ class ArxivQueryForm(forms.Form): IDENTIFIER_PATTERN_OLD = r'^[-.a-z]+/[0-9]{7,}v[0-9]{1,2}$' VALID_ARXIV_IDENTIFIER_REGEX = "(?:{})|(?:{})".format(IDENTIFIER_PATTERN_NEW, IDENTIFIER_PATTERN_OLD) - identifier = forms.RegexField(regex=VALID_ARXIV_IDENTIFIER_REGEX, strip=True) + identifier = forms.RegexField(regex=VALID_ARXIV_IDENTIFIER_REGEX, strip=True, + help_text=strings.arxiv_query_help_text, widget=forms.TextInput( + {'placeholder': strings.arxiv_query_placeholder})) def clean_identifier(self): identifier = self.cleaned_data['identifier'] diff --git a/commentaries/templates/commentaries/request_arxiv_preprint.html b/commentaries/templates/commentaries/request_arxiv_preprint.html index 75007dbae7018d0bd3234cf67838066423e3ecbf..d6e82ffa8b0c6bf2d9d31f768d16c33229aaf5f8 100644 --- a/commentaries/templates/commentaries/request_arxiv_preprint.html +++ b/commentaries/templates/commentaries/request_arxiv_preprint.html @@ -7,19 +7,29 @@ {% block content %} <div class="row"> - <form action="{% url 'commentaries:prefill_using_arxiv_identifier' %}" method="post"> - {% csrf_token %} - {{ arxiv_query_form|bootstrap }} - <input class="btn btn-secondary" type="submit" value="Query arXiv"/> - </form> + <div class="col-12"> + <h1 class="page-header">Request Activation of a Commentary Page</h1> + </div> </div> <div class="row"> - <form id="requestForm" action="{% url 'commentaries:request_arxiv_preprint' %}" method="post"> - {% csrf_token %} - {{ form|bootstrap }} - <input class="btn btn-primary" type="submit" value="Submit"/> - </form> + <div class="col-12 col-md-8"> + <form action="{% url 'commentaries:prefill_using_arxiv_identifier' %}" method="post"> + {% csrf_token %} + {{ arxiv_query_form|bootstrap }} + <input class="btn btn-secondary" type="submit" value="Query arXiv"/> + </form> + </div> +</div> + +<div class="row"> + <div class="col-12 col-md-8"> + <form id="requestForm" action="{% url 'commentaries:request_arxiv_preprint' %}" method="post"> + {% csrf_token %} + {{ form|bootstrap }} + <input class="btn btn-primary" type="submit" value="Submit"/> + </form> + </div> </div> {% endblock content%} diff --git a/commentaries/templates/commentaries/request_published_article.html b/commentaries/templates/commentaries/request_published_article.html index b03456af351362e39fd2d848da0fed807f4f1f85..f9bc472a30b3fbd4ecea56deeab5928d56074dd4 100644 --- a/commentaries/templates/commentaries/request_published_article.html +++ b/commentaries/templates/commentaries/request_published_article.html @@ -7,21 +7,29 @@ {% block content %} <div class="row"> - {# <h3><em>For published papers, you can prefill the form (except for domain, subject area and abstract) using the DOI:</em></h3>#} - {# <p><em>(give the DOI as 10.[4 to 9 digits]/[string], without prefix, as per the placeholder)</em></p>#} - <form action="{% url 'commentaries:prefill_using_DOI' %}" method="post"> - {% csrf_token %} - {{ doi_query_form|bootstrap }} - <input class="btn btn-secondary" type="submit" value="Query DOI"/> - </form> + <div class="col-12"> + <h1 class="page-header">Request Activation of a Commentary Page</h1> + </div> </div> <div class="row"> - <form id="requestForm" action="{% url 'commentaries:request_published_article' %}" method="post"> - {% csrf_token %} - {{ form|bootstrap }} - <input class="btn btn-primary" type="submit" value="Submit"/> - </form> + <div class='col-12 col-md-8'> + <form action="{% url 'commentaries:prefill_using_DOI' %}" method="post"> + {% csrf_token %} + {{ doi_query_form|bootstrap }} + <input class="btn btn-secondary" type="submit" value="Query DOI"/> + </form> + </div> +</div> + +<div class="row"> + <div class='col-12 col-md-8'> + <form id="requestForm" action="{% url 'commentaries:request_published_article' %}" method="post"> + {% csrf_token %} + {{ form|bootstrap }} + <input class="btn btn-primary" type="submit" value="Submit"/> + </form> + </div> </div> {% endblock content%} diff --git a/strings/__init__.py b/strings/__init__.py index 6e35b4e9eea62ea6859adb444cc9875eb6bc1acb..67211441f87a16a389af55fef305130bd0ad69bb 100644 --- a/strings/__init__.py +++ b/strings/__init__.py @@ -13,6 +13,21 @@ acknowledge_submit_comment = ( acknowledge_doi_query = "Crossref query by DOI successful." acknowledge_arxiv_query = "Arxiv query successful." +doi_query_placeholder = 'ex.: 10.21468/00.000.000000' +doi_query_help_text = ( + 'For published papers, you can prefill the form (except for domain, subject area and abstract) using the DOI. ' + "(Give the DOI as 10.[4 to 9 digits]/[string], without prefix, as per the placeholder)." +) + +arxiv_query_placeholder = ( + "new style: YYMM.####(#)v#(#) or " + "old style: cond-mat/YYMM###v#(#)" +) +arxiv_query_help_text = ( + "For preprints, you can prefill the form using the arXiv identifier. " + "Give the identifier without prefix and do not forget the version number, as per the placeholder." +) + # Arxiv response is not valid arxiv_caller_errormessages = { 'preprint_does_not_exist':