Skip to content

Commit 8affa77

Browse files
Make display conditional and add note in target application
1 parent b51372e commit 8affa77

4 files changed

Lines changed: 33 additions & 11 deletions

File tree

doajtest/testbook/new_application_form/maned_form.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,22 @@ tests:
107107
- step: an admin account (admin1)
108108
- step: Login as `admin1`
109109
- step: Go to Application page at `/admin/application/1234`
110+
results:
111+
- if the status is not accepted, the "Mark as full review" checkbox is not visible
110112
- step: Select the status as `Accepted` in Change Status
111-
- step: Click on the "Mark as full review" checkbox in the side panel
113+
results:
114+
- "Mark as full review" checkbox in the side panel is visible
115+
- step: Click on the "Mark as full review" checkbox
112116
results:
113117
- "Mark as full review" checkbox is filled
114118
- step: Click "Save" button
115119
results:
116120
- The last full review date is saved in the associated journal
117-
- a new note will be created
121+
- a new note will be created in the application
122+
- It will have the message "Last full review completed on {date} by `{username}`"
123+
- your username and user id will be shown on that note
124+
- the date and time you save the application will be shown
125+
- a new note will be created in the journal (search for the journal and click on edit to see note)
118126
- It will have the message "Last full review completed on {date} by `{username}`"
119127
- your username and user id will be shown on that note
120128
- the date and time you save the application will be shown

portality/forms/application_processors.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,15 @@ def finalise(self, account, save_target=True, email_alert=True):
426426
if (self.target.application_type == constants.APPLICATION_TYPE_UPDATE_REQUEST and
427427
self.form.mark_as_full_review.data):
428428
now = dates.now_str()
429+
# Add last full review note to update request application
430+
n = Messages.LAST_FULL_REVIEW_NOTE.format(date=now, username=account.id)
431+
self.target.add_note(n, date=now, author_id=account.id)
432+
self.target.save()
433+
# Add last full review note to journal
429434
j.last_full_review = now
430435
n = Messages.LAST_FULL_REVIEW_NOTE.format(date=now, username=account.id)
431436
j.add_note(n, date=now, author_id=account.id)
432-
437+
j.save()
433438
# record the url the journal is available at in the admin are and alert the user
434439
if has_request_context(): # fixme: if we handle alerts via a notification service we won't have to toggle on request context
435440
jurl = url_for("doaj.toc", identifier=j.toc_id)
@@ -474,13 +479,6 @@ def finalise(self, account, save_target=True, email_alert=True):
474479

475480
# the application was neither accepted or rejected, so just save it
476481
else:
477-
if (self.source.current_journal is not None and j is not None and
478-
self.form.mark_as_full_review.data and
479-
self.target.application_type == constants.APPLICATION_TYPE_UPDATE_REQUEST):
480-
now = dates.now_str()
481-
j.last_full_review = now
482-
n = Messages.LAST_FULL_REVIEW_NOTE.format(date=now, username=account.id)
483-
j.add_note(n, date=now, author_id=account.id)
484482
self.target.set_last_manual_update()
485483
self.target.save()
486484

portality/static/js/application_form.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,15 @@ doaj.af.ManEdApplicationForm = class extends doaj.af.EditorialApplicationForm {
718718
$("#modal-quick_reject").show();
719719
});
720720

721+
$("#application_status").on("change", (e) => {
722+
e.preventDefault();
723+
if ($("#application_status").val() === "accepted") {
724+
$("#mark_as_full_review_div").show();
725+
} else {
726+
$("#mark_as_full_review_div").hide();
727+
}
728+
});
729+
721730
let that = this;
722731
$("#submit_quick_reject").on("click", function(event) {
723732
if ($("#quick_reject").val() === "" && $("#quick_reject_details").val() === "") {

portality/templates-v2/management/_application-form/includes/_editorial_side_panel.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ <h3 class="label"> Locked for editing until <span id="lock_expires"
1010
{% if obj.application_type==constants.APPLICATION_TYPE_UPDATE_REQUEST and fs %}
1111
{% for f in fs.fields() %}
1212
{% set field_template = f.template %}
13-
{% include field_template %}
13+
{% if obj.application_status == constants.APPLICATION_STATUS_ACCEPTED %}
14+
{% set show=true %}
15+
{% else %}
16+
{% set show=false %}
17+
{% endif %}
18+
<div id="mark_as_full_review_div" {% if not show %}style="display: none"{% endif %}>
19+
{% include field_template %}
20+
</div>
1421
{% endfor %}
1522
{% endif %}
1623
<div class="editorial_panel--exit_buttons">

0 commit comments

Comments
 (0)