diff --git a/src/core/forms/forms.py b/src/core/forms/forms.py
index 1c9b44e4aa..9c9ce702f5 100755
--- a/src/core/forms/forms.py
+++ b/src/core/forms/forms.py
@@ -7,7 +7,6 @@
import json
from django import forms
-from django.forms.fields import Field
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from django.contrib.auth.forms import UserCreationForm
@@ -25,7 +24,6 @@
KeywordModelForm,
JanewayTranslationModelForm,
CaptchaForm,
- HTMLDateInput,
)
from utils.logger import get_logger
from submission import models as submission_models
diff --git a/src/templates/admin/workflow/manage_article_workflow.html b/src/templates/admin/workflow/manage_article_workflow.html
index 48502ad13c..80a3b02016 100644
--- a/src/templates/admin/workflow/manage_article_workflow.html
+++ b/src/templates/admin/workflow/manage_article_workflow.html
@@ -56,7 +56,7 @@
Archive
This article has already been archived.
{% else %}
Archiving an article will remove it from the workflow, essentially tombstoning it. You can still access it through the Article Archive.
-
@@ -64,4 +64,14 @@ Archive
-{% endblock %}
+ {% if form.modal %}
+ {% include "admin/elements/confirm_modal.html" with modal=form.modal form_id="archive-article" %}
+ {% endif %}
+{% endblock body %}
+
+{% block js %}
+ {% if form.modal %}
+ {% include "admin/elements/open_modal.html" with target=form.modal.id %}
+ {% endif %}
+{% endblock js %}
+
diff --git a/src/workflow/forms.py b/src/workflow/forms.py
new file mode 100644
index 0000000000..e490f6e774
--- /dev/null
+++ b/src/workflow/forms.py
@@ -0,0 +1,7 @@
+from core import forms as core_forms
+
+
+class ConfirmArchivingForm(core_forms.ConfirmableForm):
+ CONFIRMABLE_BUTTON_NAME = 'archive'
+ CONFIRMED_BUTTON_NAME = 'confirmed'
+ QUESTION = 'Are you certain you want to archive this article?'
diff --git a/src/workflow/views.py b/src/workflow/views.py
index 28e82608b4..54538f7383 100644
--- a/src/workflow/views.py
+++ b/src/workflow/views.py
@@ -5,7 +5,7 @@
from security.decorators import editor_user_required, has_journal
from submission import models as submission_models
-from workflow import logic
+from workflow import logic, forms
from utils import models as utils_models
from events import logic as event_logic
@@ -25,6 +25,7 @@ def manage_article_workflow(request, article_id):
pk=article_id,
journal=request.journal
)
+ form = forms.ConfirmArchivingForm()
if request.POST:
if 'stage_to' in request.POST:
@@ -42,32 +43,42 @@ def manage_article_workflow(request, article_id):
messages.INFO,
'Processing: {}'.format(stages_string),
)
- elif 'archive' in request.POST:
- utils_models.LogEntry.add_entry(
- types='Workflow',
- description='Article has been archived.',
- level='Info',
- actor=request.user,
- target=article,
+ return redirect(
+ reverse(
+ 'manage_article_workflow',
+ kwargs={'article_id': article.pk}
+ )
)
- article.stage = submission_models.STAGE_ARCHIVED
- article.save()
- messages.add_message(
- request,
- messages.SUCCESS,
- 'Article has been archived.',
- )
-
- return redirect(
- reverse(
- 'manage_article_workflow',
- kwargs={'article_id': article.pk}
+ elif 'archive' in request.POST or 'confirmed' in request.POST:
+ form = forms.ConfirmArchivingForm(
+ request.POST,
)
- )
-
+ if form.is_valid():
+ if form.is_confirmed():
+ utils_models.LogEntry.add_entry(
+ types='Workflow',
+ description='Article has been archived.',
+ level='Info',
+ actor=request.user,
+ target=article,
+ )
+ article.stage = submission_models.STAGE_ARCHIVED
+ article.save()
+ messages.add_message(
+ request,
+ messages.SUCCESS,
+ 'Article has been archived.',
+ )
+ return redirect(
+ reverse(
+ 'manage_article_workflow',
+ kwargs={'article_id': article.pk}
+ )
+ )
template = 'workflow/manage_article_workflow.html'
context = {
'article': article,
+ 'form': form,
}
return render(request, template, context)