Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repository submission now has a review page before submission is complete #4357

Merged
merged 8 commits into from
Aug 16, 2024
7 changes: 7 additions & 0 deletions src/repository/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ def __init__(self, *args, **kwargs):
self.admin = kwargs.pop('admin', False)
elements = self.request.repository.additional_submission_fields()
super(PreprintInfo, self).__init__(*args, **kwargs)

if self.admin:
self.fields.pop('submission_agreement')
self.fields.pop('comments_editor')

# If using this form and there is an instance then this has
# previously been checked as it is required.
if self.instance:
self.fields['submission_agreement'].initial = True

self.fields['subject'].queryset = models.Subject.objects.filter(
enabled=True,
repository=self.request.repository,
Expand Down Expand Up @@ -487,6 +493,7 @@ class Meta:
'limit_access_to_submission',
'submission_access_request_text',
'submission_access_contact',
'review_submission_text',
'custom_js_code',
'review_helper',
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 4.2 on 2024-07-18 15:38

import core.model_utils
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('repository', '0043_auto_20240402_1256'),
]

operations = [
migrations.AddField(
model_name='historicalrepository',
name='review_submission_text',
field=core.model_utils.JanewayBleachField(blank=True, default='<p>Please review your submission carefully. Make any necessary changes to ensure that all information is accurate and complete.</p><p>When you are satisfied with your review click the button below to finalize your submission.</p>', help_text='Text that displays on the review page just before the author completes their submission.'),
),
migrations.AddField(
model_name='repository',
name='review_submission_text',
field=core.model_utils.JanewayBleachField(blank=True, default='<p>Please review your submission carefully. Make any necessary changes to ensure that all information is accurate and complete.</p><p>When you are satisfied with your review click the button below to finalize your submission.</p>', help_text='Text that displays on the review page just before the author completes their submission.'),
),
migrations.AlterField(
model_name='repositoryfield',
name='help_text',
field=models.TextField(blank=True, null=True),
),
]
15 changes: 14 additions & 1 deletion src/repository/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ class Repository(model_utils.AbstractSiteModel):
help_text='eg. preprints or articles',
)
managers = models.ManyToManyField('core.Account', blank=True)
submission_notification_recipients = models.ManyToManyField('core.Account', blank=True, related_name='submission_notification_repositories')
submission_notification_recipients = models.ManyToManyField(
'core.Account',
blank=True,
related_name='submission_notification_repositories',
)
logo = model_utils.SVGImageField(
blank=True,
null=True,
Expand Down Expand Up @@ -226,6 +230,15 @@ class Repository(model_utils.AbstractSiteModel):
help_text='Describe any supporting information you want users to supply when requesting'
'access permissions for this repository. Linked to Limit Access to Submissions.',
)
review_submission_text = model_utils.JanewayBleachField(
blank=True,
default="<p>Please review your submission carefully. Make any "
"necessary changes to ensure that all information is accurate "
"and complete.</p><p>When you are satisfied with your review "
"click the button below to finalize your submission.</p>",
help_text="Text that displays on the review page just before the "
"author completes their submission."
)
submission_access_contact = models.EmailField(
blank=True,
null=True,
Expand Down
31 changes: 14 additions & 17 deletions src/repository/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,21 +747,6 @@ def repository_files(request, preprint_id):

if 'complete' in request.POST:
if preprint.submission_file:
preprint.submit_preprint()
kwargs = {'request': request, 'preprint': preprint}
event_logic.Events.raise_event(
event_logic.Events.ON_PREPRINT_SUBMISSION,
**kwargs,
)

messages.add_message(
request,
messages.SUCCESS,
'{object} {title} submitted.'.format(
object=request.repository.object_name,
title=preprint.title
)
)
return redirect(
reverse(
'repository_review',
Expand Down Expand Up @@ -798,12 +783,24 @@ def repository_review(request, preprint_id):
models.Preprint,
pk=preprint_id,
owner=request.user,
date_submitted__isnull=False,
repository=request.repository,
)

if request.POST and 'complete' in request.POST:

preprint.submit_preprint()
kwargs = {'request': request, 'preprint': preprint}
event_logic.Events.raise_event(
event_logic.Events.ON_PREPRINT_SUBMISSION,
**kwargs,
)
messages.add_message(
request,
messages.SUCCESS,
'{object} {title} submitted.'.format(
object=request.repository.object_name,
title=preprint.title
)
)
return redirect(reverse('repository_dashboard'))

template = 'admin/repository/submit/review.html'
Expand Down
39 changes: 39 additions & 0 deletions src/static/admin/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -822,3 +822,42 @@ ul.menu {
/* Temporary hotfix for compatibility with TinyMCE */
z-index: 10 !important;
}

.key-value-pair {
font-family: "Open Sans", sans-serif;
margin-bottom: 1.25rem;
}

.key-value-pair.key-above .key {
font-size: 1rem;
line-height: 1.4;
text-align: left;
color: #696969;
margin-bottom: 0.31rem;
font-weight: normal;
}

.key-value-pair.key-above .value {
font-size: 1.125rem;
line-height: 1.4;
text-align: left;
}

.key-value-pair.key-above .value .inline-list {
display: inline;
list-style: none;
padding: 0;
margin: 0;
}

.key-value-pair.key-above .value .inline-list li {
display: inline;
}

.key-value-pair.key-above .value .inline-list li:after {
content: ", ";
}

.key-value-pair.key-above .value .inline-list li:last-child:after {
content: "";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<li>
<a href="{% url 'repository_dashboard' %}">
{{ request.repository.name }} Dashboard
</a>
</li>
<li>
{% if preprint %}
<a href="{% url 'repository_submit_with_id' preprint.pk %}">
Metadata
</a>
{% else %}
Metadata
{% endif %}
</li>

{% if files or review %}
<li>
<a href="{% url 'repository_authors' preprint.pk %}">
Add Authors
</a>
</li>
{% elif authors %}
<li>
Add Authors
</li>
{% endif %}

{% if review %}
<li>
<a href="{% url 'repository_files' preprint.pk %}">
Add Files
</a>
</li>
{% elif files %}
<li>
Add Files
</li>
{% endif %}


{% if review %}
<li>
Review Submission
</li>
{% endif %}
26 changes: 26 additions & 0 deletions src/templates/admin/elements/layout/key_value_above.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{% comment %}
This template should be wrapped in <dl></dl> tags when included. Example:
<dl>
{% include "admin/elements/layout/key_value_above.html" with key="Title" value=preprint.title %}
{% include "admin/elements/layout/key_value_above.html" with key="Abstract" value=preprint.abstract %}
</dl>
{% endcomment %}

<div class="key-value-pair key-above">
<dt class="key">
{{ key }}
</dt>
<dd class="value">
{% if list %}
<ul class="inline-list">
{% for item in value %}
<li>{{ item }}</li>
{% endfor %}
</ul>
{% elif render_line_breaks %}
{{ value|linebreaksbr|default:"No value supplied" }}
{% else %}
{{ value|default:"No value supplied" }}
{% endif %}
</dd>
</div>
7 changes: 2 additions & 5 deletions src/templates/admin/repository/submit/authors.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
{% endblock %}

{% block breadcrumbs %}
<li><a href="{% url 'repository_dashboard' %}">{{ request.repository.name }}
Dashboard</a></li>
<li>Start Submission</li>
<li>Add Authors</li>
{% include "admin/elements/breadcrumbs/repository_submission.html" with authors=True %}
{% endblock %}

{% block body %}
Expand Down Expand Up @@ -103,7 +100,7 @@ <h2>{% trans 'Authors' %}</h2>
<p>{% trans 'Once you have added all of your authors you can complete this stage.' %}</p>
<form method="POST">
{% csrf_token %}
<button name="complete" class="button">{% trans 'Complete Step 2 of 3' %}</button>
<button name="complete" class="button">{% trans 'Complete Step 2 of 4' %}</button>
</form>
</div>
</div>
Expand Down
8 changes: 2 additions & 6 deletions src/templates/admin/repository/submit/files.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
{% endblock %}

{% block breadcrumbs %}
<li><a href="{% url 'repository_dashboard' %}">{{ request.repository.name }}
Dashboard</a></li>
<li>Start Submission</li>
<li>Add Authors</li>
<li>Upload Files</li>
{% include "admin/elements/breadcrumbs/repository_submission.html" with files=True %}
{% endblock %}


Expand Down Expand Up @@ -90,7 +86,7 @@ <h2>Supplementary File</h2>
</div>
<form method="POST">
{% csrf_token %}
<button name="complete" class="button">{% trans 'Complete Step 3 of 3' %}</button>
<button name="complete" class="button">{% trans 'Complete Step 3 of 4' %}</button>
</form>
</div>
</div>
Expand Down
Loading