SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 35fa7c17 authored by George Katsikas's avatar George Katsikas :goat:
Browse files

refactor reports form, add recommendation preview

parent e9ae01f5
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ $(function () { ...@@ -40,7 +40,7 @@ $(function () {
}) })
.trigger("keyup"); .trigger("keyup");
$('#id_validity, #id_originality, #id_significance, #id_clarity, #id_formatting, #id_grammar').on('change', function(){ $('#id_validity, #id_originality, #id_significance, #id_clarity, #id_formatting, #id_grammar, #id_recommendation').on('change', function(){
set_preview_select(this); set_preview_select(this);
}).trigger('change'); }).trigger('change');
......
...@@ -2802,6 +2802,7 @@ class ReportPDFForm(forms.ModelForm): ...@@ -2802,6 +2802,7 @@ class ReportPDFForm(forms.ModelForm):
class ReportForm(forms.ModelForm): class ReportForm(forms.ModelForm):
"""Write Report form.""" """Write Report form."""
required_css_class = "required-asterisk"
report_type = REPORT_NORMAL report_type = REPORT_NORMAL
class Meta: class Meta:
...@@ -2824,6 +2825,45 @@ class ReportForm(forms.ModelForm): ...@@ -2824,6 +2825,45 @@ class ReportForm(forms.ModelForm):
"anonymous", "anonymous",
] ]
widgets = {
"strengths": forms.Textarea(
attrs={
"placeholder": (
"Give a point-by-point "
"(numbered 1-, 2-, ...) list of the paper's strengths"
),
"rows": 10,
"cols": 100,
}
),
"weaknesses": forms.Textarea(
attrs={
"placeholder": (
"Give a point-by-point "
"(numbered 1-, 2-, ...) list of the paper's weaknesses"
),
"rows": 10,
"cols": 100,
}
),
"report": forms.Textarea(
attrs={
"placeholder": (
"Your general remarks. Are this Journal's acceptance criteria met? "
"Would you recommend publication in another Journal instead?"
),
"rows": 10,
"cols": 100,
}
),
"requested_changes": forms.Textarea(
attrs={
"placeholder": "Give a numbered (1-, 2-, ...) list of specifically requested changes",
"cols": 100,
}
),
}
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
if kwargs.get("instance"): if kwargs.get("instance"):
if kwargs["instance"].is_followup_report: if kwargs["instance"].is_followup_report:
...@@ -2841,57 +2881,13 @@ class ReportForm(forms.ModelForm): ...@@ -2841,57 +2881,13 @@ class ReportForm(forms.ModelForm):
self.submission = kwargs.pop("submission") self.submission = kwargs.pop("submission")
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.fields["strengths"].widget.attrs.update(
{
"placeholder": (
"Give a point-by-point "
"(numbered 1-, 2-, ...) list of the paper's strengths"
),
"rows": 10,
"cols": 100,
}
)
self.fields["weaknesses"].widget.attrs.update(
{
"placeholder": (
"Give a point-by-point "
"(numbered 1-, 2-, ...) list of the paper's weaknesses"
),
"rows": 10,
"cols": 100,
}
)
self.fields["report"].widget.attrs.update(
{
"placeholder": "Your general remarks. Are this Journal's acceptance criteria met? Would you recommend publication in another Journal instead?",
"rows": 10,
"cols": 100,
}
)
self.fields["requested_changes"].widget.attrs.update(
{
"placeholder": "Give a numbered (1-, 2-, ...) list of specifically requested changes",
"cols": 100,
}
)
self.fields["file_attachment"].label = (
"File attachment (2MB limit; for a figure or similar - please avoid annotated pdfs)"
)
# Required fields on submission; optional on save as draft # Required fields on submission; optional on save as draft
if "save_submit" in self.data: self.fields["report"].required = True
required_fields = ["report", "recommendation"] self.fields["recommendation"].required = True
else: if "save_draft" in self.data:
required_fields = [] self.fields["report"].required = False
required_fields_label = ["report", "recommendation"] self.fields["recommendation"].required = False
for field in required_fields:
self.fields[field].required = True
# Let user know the field is required!
for field in required_fields_label:
self.fields[field].label += " *"
if self.submission.eicrecommendations.active().exists(): if self.submission.eicrecommendations.active().exists():
# An active EICRecommendation is already formulated. This Report will be flagged. # An active EICRecommendation is already formulated. This Report will be flagged.
......
...@@ -29,6 +29,12 @@ ...@@ -29,6 +29,12 @@
<div class="ps-md-4"><p style="white-space: pre-wrap;" data-receive="report-requested_changes"></p></div> <div class="ps-md-4"><p style="white-space: pre-wrap;" data-receive="report-requested_changes"></p></div>
</div> </div>
</div> </div>
<div class="row" id="previewRecommendation">
<div class="col">
<h3 class="highlight tight">Recommendation</h3>
<div class="ps-md-4"><p style="white-space: pre-wrap;" data-receive="report-recommendation"></p></div>
</div>
</div>
<div class="ratings" id="previewRatings"> <div class="ratings" id="previewRatings">
<ul> <ul>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment