Skip to content

Commit

Permalink
Merge pull request #4113 from BirkbeckCTP/b_1_5_2
Browse files Browse the repository at this point in the history
B 1 5 2
  • Loading branch information
mauromsl authored Apr 22, 2024
2 parents ac081f4 + 666aee7 commit 306c2f8
Show file tree
Hide file tree
Showing 16 changed files with 64 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Janeway is a web-based platform for publishing journals, preprints, conference proceedings, and books. It is developed and maintained by a team of developers at the Open Library of Humanities, part of Birkbeck, University of London.

# Technology
Janeway is written in Python (3.6+) and utilises the Django framework (3.2).
Janeway is written in Python (3.9+) and utilises the Django framework (3.2).


# Installation instructions
Expand Down
1 change: 0 additions & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
django_nose
coverage
ipdb
python-wordpress-xmlrpc
Expand Down
2 changes: 0 additions & 2 deletions src/core/dev_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
)
INSTALLED_APPS = [
'debug_toolbar',
'django_nose',
]


Expand All @@ -33,7 +32,6 @@ def show_toolbar(request):
DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": show_toolbar,
}
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

HIJACK_LOGIN_REDIRECT_URL = '/manager/'
HIJACK_USERS_ENABLED = True
Expand Down
1 change: 1 addition & 0 deletions src/core/forms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
RegistrationForm,
SectionForm,
SettingEmailForm,
SimpleTinyMCEForm,
UserCreationFormExtended,
XSLFileForm,
)
8 changes: 8 additions & 0 deletions src/core/forms/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,3 +816,11 @@ def __init__(self, *args, **kwargs):
email_context,
setting_name,
)

class SimpleTinyMCEForm(forms.Form):
""" A one-field form for populating a TinyMCE textarea
"""

def __init__(self, field_name, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields[field_name] = forms.CharField(widget=TinyMCE)
1 change: 1 addition & 0 deletions src/core/janeway_global_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@ def __len__(self):
"fullscreen_native": True,
"promotion": False,
"branding": False,
"convert_urls": False,
"menubar": "edit view insert format tools table help",
"content_css": STATIC_URL + "/admin/css/admin.css",
"plugins": "advlist autolink lists link image charmap preview anchor searchreplace visualblocks code"
Expand Down
8 changes: 2 additions & 6 deletions src/core/templatetags/debug_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ class TraceNode(template.Node):
"""

def render(self, context):
try:
from nose import tools
tools.set_trace() # Debugger will stop here
except (ModuleNotFoundError, ImportError):
import pdb
pdb.set_trace() # Debugger will stop here
import pdb
pdb.set_trace()
return ''


Expand Down
2 changes: 1 addition & 1 deletion src/janeway/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from packaging import version
__version__ = version.parse("1.5.1-RC-6")
__version__ = version.parse("1.5.2-RC-4")
2 changes: 1 addition & 1 deletion src/journal/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def notify_author(request, article):
kwargs = {
'request': request,
'article': article,
'user_message': request.POST.get('notify_author_email', 'No message from Editor.'),
'user_message': request.POST.get('email_to_author', 'No message from Editor.'),
'section_editors': request.POST.get('section_editors', False),
'peer_reviewers': request.POST.get('peer_reviewers', False),
}
Expand Down
9 changes: 7 additions & 2 deletions src/journal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
models as core_models,
plugin_loader,
logic as core_logic,
forms as core_forms,
views as core_views,
)
from identifiers import models as id_models
Expand Down Expand Up @@ -1021,6 +1020,12 @@ def publish_article(request, article_id):
doi_data, doi = logic.get_doi_data(article)
issues = request.journal.issues
new_issue_form = issue_forms.NewIssue(journal=article.journal)
notify_author_email_form = core_forms.SimpleTinyMCEForm(
'email_to_author',
initial = {
'email_to_author': logic.get_notify_author_text(request, article)
}
)
modal = request.GET.get('m', None)
pubdate_errors = []

Expand Down Expand Up @@ -1189,7 +1194,7 @@ def publish_article(request, article_id):
'new_issue_form': new_issue_form,
'modal': modal,
'pubdate_errors': pubdate_errors,
'notify_author_text': logic.get_notify_author_text(request, article)
'notify_author_email_form': notify_author_email_form,
}

return render(request, template, context)
Expand Down
5 changes: 5 additions & 0 deletions src/static/admin/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -817,3 +817,8 @@ ul.menu {
.summernote-div {
margin-bottom: 16px;
}

.ui-datepicker {
/* Temporary hotfix for compatibility with TinyMCE */
z-index: 10 !important;
}
6 changes: 4 additions & 2 deletions src/templates/admin/elements/publish/author.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% load foundation %}

<div class="reveal small" id="author" data-reveal data-animation-in="slide-in-up"
data-animation-out="slide-out-down">
<div class="card">
Expand All @@ -15,7 +17,7 @@ <h4><i class="fa fa-envelope-o">&nbsp;</i>Notify Author</h4>
<i>From: </i> {{ request.user.full_name }}({{ request.user.email }})<br />
<i>Subject: </i>{{ article.safe_title }} Publication
</p>
<textarea name="notify_author_email">{{ notify_author_text|linebreaksbr }}</textarea>
{{ notify_author_email_form|foundation }}

<input type="checkbox" name="section_editors" id="section_editors"><label for="section_editors" class="toggle">Notify Section Editors</label>
<br />
Expand All @@ -32,4 +34,4 @@ <h4><i class="fa fa-envelope-o">&nbsp;</i>Notify Author</h4>
<button class="close-button" data-close aria-label="Close reveal" type="button">
<span aria-hidden="true">&times;</span>
</button>
</div>
</div>
8 changes: 4 additions & 4 deletions src/templates/admin/elements/review/draft_decisions_js.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ <h4>{% trans "Confirmation" %}</h4>
"url": "{% url 'review_draft_decision_text' article.pk %}",
"data": data,
"success": function (data) {
$("#id_email_message").jqteVal(data.decision_text)
tinymce.get('id_email_message').setContent(data.decision_text)
toastr.success('Draft Email to Author reloaded.')
},
"error": function (xhr, status, error) {
Expand All @@ -81,7 +81,7 @@ <h4>{% trans "Confirmation" %}</h4>
date = $('#id_revision_request_due_date').val();

if (decision_selector.val() === '') {
$("#id_email_message").jqteVal('')
tinymce.get('id_email_message').setContent('')
} else if ((decision_selector.val() === 'minor_revisions') || (decision_selector.val() === 'major_revisions')) {
$('#div_due_date').show();
get_decision_text(decision_selector, date)
Expand All @@ -91,8 +91,8 @@ <h4>{% trans "Confirmation" %}</h4>
}
}
function decision_change() {

if ($('#id_email_message').val()) {
let emailMessagecContent = tinymce.get('id_email_message').getContent()
if (emailMessagecContent) {
$('#confirm_switch_email_template').foundation();
$('#confirm_switch_email_template').foundation('open');
} else {
Expand Down
1 change: 0 additions & 1 deletion src/templates/admin/review/draft_decision.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ <h4>Decline Draft Decision</h4>
{% endblock %}

{% block js %}
{% include "admin/elements/jqte.html" %}
<script src="{% static "admin/js/csrf.js" %}"></script>
{% include "admin/elements/review/draft_decisions_js.html" %}
{% endblock %}
1 change: 0 additions & 1 deletion src/templates/admin/review/revision/request_revisions.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ <h4><strong><span class="fa fa-warning"></span> Potential problems detected</str

{% block js %}
{% include "elements/datepicker.html" with target="#id_date_due" %}
{% include "elements/jqte.html" %}
{% if form.modal %}
{% include "admin/elements/open_modal.html" with target=form.modal.id %}
{% endif %}
Expand Down
29 changes: 29 additions & 0 deletions src/utils/migrations/0032_upgrade_1_5_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-

from django.db import migrations, models
from django.utils import timezone

VERSION = "1.5.2"


def rollback(apps, schema_editor):
version_model = apps.get_model("utils", "Version")
latest_version = version_model.objects.get(number=VERSION, rollback=None)
latest_version.rollback = timezone.now()
latest_version.save()

def upgrade(apps, schema_editor):
version_model = apps.get_model("utils", "Version")
new_version = version_model.objects.create(number=VERSION)
new_version.save()

class Migration(migrations.Migration):

dependencies = [
('utils', '0031_upgrade_1_5_1'),
('core', '0087_merge_20240315_1649'),
]

operations = [
migrations.RunPython(upgrade, reverse_code=rollback),
]

0 comments on commit 306c2f8

Please sign in to comment.