-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 3478-submission_summary
Signed-off-by: Andy Byers <[email protected]>
- Loading branch information
Showing
31 changed files
with
575 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Generated by Django 4.2 on 2024-07-17 09:52 | ||
|
||
from django.db import migrations | ||
from utils import migration_utils | ||
|
||
OLD_VALUE_ONE = 'Dear {{ review_assignment.editor.first_name }}, <br><br>This is a notification that the reviewer status on "{{ article.safe_title }}" in {{ article.journal.name }} has been updated. You can view more information on the journal site: {{ review_in_review_url }} <br><br>All best wishes, <br>{{ request.user.signature }}' | ||
OLD_VALUE_TWO = 'Dear {{ review_assignment.editor.full_name }}, <br/><br/>This is a notification that the reviewer status on "{{ article.safe_title }}" in {{ article.journal.name }} has been updated. You can view more information on the journal site: {{ review_in_review_url }} <br/><br/>Regards,' | ||
OLD_VALUE_THREE = 'Dear {{ review_assignment.editor.full_name }}, <br/><br/>This is a notification that the reviewer status on "{{ article.safe_title }}" in {{ article.journal.name }} has been updated. You can view more information on the journal site: {{ review_in_review_url }} <br/><br/>Regards, <br/>{{ request.user.signature }}' | ||
OLD_VALUE_FOUR = 'Dear {{ review_assignment.editor.full_name }}, <br><br>This is a notification that the reviewer status on "{{ article.safe_title }}" in {{ article.journal.name }} has been updated. You can view more information on the journal website at: {{ review_in_review_url }} <br><br>Best wishes,<br> <br>{{ request.user.signature }}' | ||
OLD_VALUE_FIVE = 'Dear {{ review_assignment.editor.full_name }}, <br><br>This is a notification that the reviewer status on "{{ article.safe_title }}" in {{ article.journal.name }} has been updated. You can view more information on the journal site: {{ review_in_review_url }} <br><br>Regards, <br>{{ request.user.signature }}' | ||
OLD_VALUE_SIX = 'Dear {{ review_assignment.editor.full_name }}, <br><br>This is a notification that the reviewer status on "{{ article.safe_title }}" in {{ article.journal.name }} has been updated. You can view more information on the journal site: {{ review_in_review_url }} <br><br>Regards,' | ||
NEW_VALUE = "<p>Dear {{ review_assignment.editor.full_name }},</p><p>{{ review_assignment.reviewer.full_name }} has completed their review of \"{{ review_assignment.article.title }}\"{% if review_assignment.decision %} with this recommendation: {{ review_assignment.get_decision_display }}{% endif %}.</p><p>You can view more information on the journal site: {% journal_url 'review_view_review' review_assignment.article.pk review_assignment.pk %}</p><p>Regards,</p>" | ||
|
||
|
||
def replace_review_completed_ack(apps, schema_editor): | ||
migration_utils.update_default_setting_values( | ||
apps, | ||
setting_name='review_complete_acknowledgement', | ||
group_name='email', | ||
values_to_replace=[OLD_VALUE_ONE, OLD_VALUE_TWO, OLD_VALUE_THREE, OLD_VALUE_FOUR, OLD_VALUE_FIVE, OLD_VALUE_SIX], | ||
replacement_value=NEW_VALUE, | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0095_auto_20240605_1024'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
replace_review_completed_ack, | ||
reverse_code=migrations.RunPython.noop, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from django import template | ||
from django.utils import timezone | ||
|
||
|
||
register = template.Library() | ||
|
||
@register.simple_tag | ||
def offset_date(days=0, input_type="date"): | ||
""" | ||
Get a string representing today's date or the now datetime, | ||
with an offset of X days. | ||
:param days: number of days from now that the date should be set | ||
:param date: date or datetime-local | ||
Usage: | ||
<input | ||
id="due" | ||
name="due" | ||
type="{{ input_type }}" | ||
value="{% offset_date days=3 input_type=input_type %}"> | ||
See admin.core.widgets.soon_date_buttons for a use case. | ||
""" | ||
due = timezone.now() + timezone.timedelta(days=days) | ||
if input_type == "date": | ||
return due.strftime("%Y-%m-%d") | ||
elif input_type == "datetime-local": | ||
return due.strftime("%Y-%m-%dT%H:%M") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django import template | ||
from uuid import uuid4 | ||
|
||
register = template.Library() | ||
|
||
@register.simple_tag | ||
def get_uuid4(): | ||
return f'u{str(uuid4())}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/repository/migrations/0044_alter_repositoryfield_help_text.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Generated by Django 4.2 on 2024-06-26 10:12 | ||
|
||
from django.db import migrations, models | ||
from django.template.defaultfilters import striptags | ||
|
||
|
||
def strip_html_tags_from_repo_field_help_text(apps, schema_editor): | ||
RepositoryField = apps.get_model('repository', 'RepositoryField') | ||
|
||
for field in RepositoryField.objects.all(): | ||
field.help_text = striptags(field.help_text) | ||
field.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('repository', '0043_auto_20240402_1256'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='repositoryfield', | ||
name='help_text', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.RunPython( | ||
strip_html_tags_from_repo_field_help_text, | ||
reverse_code=migrations.RunPython.noop, | ||
) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// Deprecated. Use select_all.html instead. | ||
|
||
$("#checkall").click(function () { | ||
$('input:checkbox').not(this).prop('checked', this.checked); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{% comment %} | ||
Easily select or deselect all the checkboxes for a given field. | ||
|
||
Make sure to wrap this widget and the checkboxes in fieldset. | ||
|
||
Usage: | ||
|
||
<fieldset> | ||
<legend>Which colours?</legend> | ||
{% include "admin/core/widgets/select_all.html" %} | ||
<input id="red" name="red" type="checkbox"><label for="red">Red</label> | ||
<input id="blue" name="blue" type="checkbox"><label for="blue">Blue</label> | ||
</fieldset> | ||
|
||
{% endcomment %} | ||
|
||
{% load uuid %} | ||
|
||
{% get_uuid4 as pid %} | ||
|
||
<div id="{{ pid }}" style="button-group"> | ||
<button class="button selectall" type="button"> | ||
<span class="fa fa-check"></span> | ||
Select all | ||
</button> | ||
<button class="button deselectall" type="button"> | ||
<span class="fa fa-close"></span> | ||
Deselect all | ||
</button> | ||
</div> | ||
<script defer type="module"> | ||
function toggleInputsInFieldset(event) { | ||
const checked = event.currentTarget.classList.contains('selectall'); | ||
const fieldset = event.currentTarget.closest('fieldset'); | ||
const checkboxes = fieldset.querySelectorAll('input[type="checkbox"]'); | ||
Array.from(checkboxes).forEach(checkbox => { | ||
checkbox.checked = checked; | ||
}); | ||
} | ||
const selectAll = document.querySelector('#{{ pid }} .selectall'); | ||
selectAll.addEventListener('click', toggleInputsInFieldset); | ||
const deselectAll = document.querySelector('#{{ pid }} .deselectall'); | ||
deselectAll.addEventListener('click', toggleInputsInFieldset); | ||
</script> |
Oops, something went wrong.