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

#2711 review due dates are now in the default invitation and on the review page. #3018

Merged
merged 2 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/manager.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ Manager
manager/identifiers/index
manager/users/index
manager/other/index
manager/other/template_variables

151 changes: 151 additions & 0 deletions docs/source/manager/other/template_variables.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
Email Template Variables
========================

.. warning::
This section is a work in progress started in v1.4.3.

Templates
---------

Review Assignment
~~~~~~~~~~~~~~~~~
Template Code: review_assignment

This template is sent to potential reviewers inviting them to submit a review.

Objects in this Template's context:

- article, an Article object.
- editor, an Account object.
- review_assignment, a ReviewAssignment object.
- review_url, a reversed URL with FQDN.
- article_details, a string with article and review information in it inc. Title, due date etc.


Objects
-------
Listed here is a non-exhaustive list of the objects that you may have access to in an email template.

KEY

- Str is plain text.
- Int is a number.
- FK is Foreign Key, this means the attribute is a link to another object.
- M2M is Many to Many, this means the attribute links to multiple other objects of the given type.
- 121 is One to One, it means these two objects are linked.
- Bool is a Boolean value and will return True or False.
- DateTime is a field that stores a internationalised date and time.
- Email is a validated email address.

.. _Object Account:

Account
~~~~~~~
The account object stores information about users.

- email (Email, unique)
- username (Str)
- first_name (Str)
- middle_name (Str)
- last_name (Str)
- salutation (Str)
- biography (Str)
- orcid (Str)
- institution (Str)
- department (Str)
- twitter (Str)
- facebook (Str)
- linkedin (Str)
- website (Str)
- interest (M2M Interest)
- country (FK Country)
- preferred_timezone (Str, valid timezone)
- is_active (Bool)
- is_staff (Bool)
- date_joined (DateTime)

.. _Object Article:

Article
~~~~~~~
The article object contains the following attributes:

- journal (FK :ref:`Object Journal`)
- title (Str)
- abstract (Str)
- owner (FK :ref:`Object Account`)
- keywords (FK Keyword)
- language (Str)
- section (FK Section)
- license (FK License)
- publisher_notes (M2M PublisherNote)
- is_remote (Bool)
- remote_url (Str)
- authors (M2M Account)
- correspondence_author (FK :ref:`Object Account`)
- rights (Str)
- article_number (Int)

.. _Object Journal:

Journal
~~~~~~~
The journal object contains the following attributes:

- code (Str)
- name (Str)
- current_issue (FK Issue)
- carousel (121 Carousel)
- thumbnail_image (FK File)
- press_image_override (FK File)
- default_cover_image (ImageField)
- default_large_image (ImageField)
- header_image (ImageField)
- favicon (ImageField)
- description (Str)
- contact_info (Str)
- Keywords (Keyword)
- is_conference (Bool)
- is_archived (Bool)
- is_remote (Bool)
- remote_view_url (URLField)
- remote_submit_url (URLField)
- hide_from_press (Bool)
- sequence (Int)
- disable_front_end (Bool)

.. _Object Review Assignment:

ReviewAssignment
~~~~~~~~~~~~~~~~
- article (FK :ref:`Object Article`)
- reviewer (FK :ref:`Object Account`)
- editor (FK :ref:`Object Account`)
- form (FK ReviewForm)
- review_round (FK ReviewRound)
- date_due (DateTime)
- date_requested (DateTime)
- date_accepted (DateTime)
- date_complete (DateTime)
- decision (Str)
- visibility (Bool)
- access_code (Str, UUID format, though not enforced)
- is_complete (Bool)
- for_author_consumption (Bool)
- comments_for_editor (Str)
- review_file (FK File)
- display_review_file (Bool)

Using Object Variables in Templates
-----------------------------------
If I wanted to display the due date I could use:

{{ review_assignment.date_due }}

If I wanted to display the title of the issue this article is projected to be in I can use:

{{ article.projected_issue.display_title }}

If I wanted to display an article's journal's name I would use:

{{ article.journal.name }}
49 changes: 49 additions & 0 deletions src/core/migrations/0074_auto_20220721_1448.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2022-07-21 12:35
from __future__ import unicode_literals

from django.db import migrations
from django.utils import translation
from django.conf import settings as django_settings


OLD_DEFAULT_VALUE = 'Dear {{ review_assignment.reviewer.full_name }},<br/><br/>We are requesting that you undertake a review of "{{ article.title }}" in {{ article.journal.name }}.<br/><br/>We would be most grateful for your time as the feedback from our reviewers is of the utmost importance to our editorial decision-making processes.<br/><br/>You can let us know your decision or decline to undertake the review: {{ review_url }} <br/><br/>{{ article_details }}<br/><br/>Regards,<br/>{{ request.user.signature|safe }}'
VARIANT_ONE = 'Dear {{ review_assignment.reviewer.full_name }},<br/><br/>We are requesting that you undertake a review of "{{ article.title }}" in {{ article.journal.name }}.<br/><br/>We would be most grateful for your time as the feedback from our reviewers is of the utmost importance to our editorial decision making processes.<br/><br/>You can let us know your decision or decline to undertake the review: {{ review_url }} <br/><br/>Regards,<br/>{{ request.user.signature|safe }}<br/>{{ article_details }}'
VARIANT_TWO = 'Dear {{ review_assignment.reviewer.full_name }},<br/><br/>We are requesting that you undertake a review of "{{ article.title }}" in {{ article.journal.name }}.<br/><br/>We would be most grateful for your time as the feedback from our reviewers is of the utmost importance to our editorial decision making processes.<br/><br/>You can let us know your decision or decline to undertake the review: {{ review_url }} <br/><br/>Regards,<br/>{{ request.user.signature }}<br/>{{ article_details }}'

NEW_VALUE = 'Dear {{ review_assignment.reviewer.full_name }},<br/><br/>We are requesting that you undertake a review of "{{ article.title }}" in {{ article.journal.name }}.<br/><br/>We would be most grateful for your time as the feedback from our reviewers is of the utmost importance to our editorial decision-making processes.<br/><br/>You can let us know your decision or decline to undertake the review: {{ review_url }} <br/><br/> This review assignment is due on {{ review_assignment.date_due|date:"Y-m-d" }}. <br/><br/>{{ article_details }}<br/><br/>Regards,<br/>{{ request.user.signature|safe }}'


def update_default_setting(apps, schema_editor):
"""
Updates the review_assignment setting for a journal where it has not been edited.
"""
with translation.override(django_settings.LANGUAGE_CODE):
SettingValue = apps.get_model('core', 'SettingValue')
setting_value = SettingValue.objects.get(
setting__name='review_assignment',
journal=None,
)
language_var = "value_{}".format(django_settings.LANGUAGE_CODE)
setattr(setting_value, language_var, NEW_VALUE)
setting_value.save()

variants_to_delete = SettingValue.objects.filter(
setting__name='review_assignment',
journal__isnull=False,
)

for variant in variants_to_delete:
if getattr(variant, language_var) in [OLD_DEFAULT_VALUE, VARIANT_ONE, VARIANT_TWO]:
variant.delete()


class Migration(migrations.Migration):

dependencies = [
('core', '0073_auto_20220630_1608'),
]

operations = [
migrations.RunPython(update_default_setting, reverse_code=migrations.RunPython.noop),
]
4 changes: 2 additions & 2 deletions src/review/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ def get_reviewer_notification(
<b>Article Details:</b>
<b>Title</b>: {article.title}
<b>Section</b>: {section}
Keywords: {keywords}
Abstract:
<b>Keywords</b>: {keywords}
<b>Abstract</b>:
{article.abstract}
""".format(
article=article,
Expand Down
2 changes: 2 additions & 0 deletions src/templates/admin/elements/review/review_meta_block.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
{% endif %}
</ul>

<p><strong>Due Date</strong></p>
<p>{{ review_request.date_due|date:"Y-m-d" }}</p>

<p><strong>Abstract</strong></p>
{{ review_request.article.abstract|safe }}
Expand Down