Skip to content

Commit

Permalink
Merge pull request #3855 from BirkbeckCTP/b_1_5_1
Browse files Browse the repository at this point in the history
Merge of 1.5.1-RC-4
  • Loading branch information
mauromsl authored Jan 2, 2024
2 parents c368e02 + c0c6d94 commit 63d3200
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 34 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ maxminddb==1.5.4
mock
mozilla-django-oidc==1.2.4
orcid==1.0.3
packaging==23.2
pdfkit==1.0.0
pdfminer.six
psycopg2-binary~=2.8.6
Expand All @@ -52,7 +53,6 @@ python-dateutil==2.8.1
python-docx==0.8.11
python-magic==0.4.13
requests==2.31.0
semver==3.0.0
six==1.14.0
sqlparse==0.4.4
swapper==1.3.0
Expand Down
2 changes: 1 addition & 1 deletion src/core/janeway_global_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def filter(self, record):

# New XML galleys will be associated with this stylesheet by default when they
# are first uploaded
DEFAULT_XSL_FILE_LABEL = 'Janeway default (1.4.3)'
DEFAULT_XSL_FILE_LABEL = 'Janeway default (1.5.1)'

# Skip migrations by default on sqlite for faster execution
if (
Expand Down
8 changes: 4 additions & 4 deletions src/core/plugin_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.utils import OperationalError, ProgrammingError
from semver import Version
from packaging import version

from core.workflow import ELEMENT_STAGES, STAGES_ELEMENTS
from janeway import __version__ as janeway_version
from submission.models import PLUGIN_WORKFLOW_STAGES
from utils import models
from utils.logic import get_janeway_version


def get_dirs(directory):
Expand Down Expand Up @@ -88,12 +88,12 @@ def load(directory="plugins", prefix="plugins", permissive=False):
def validate_plugin_version(plugin_settings):
valid = None
try:
wants_version = Version.parse(plugin_settings.JANEWAY_VERSION)
wants_version = version.parse(plugin_settings.JANEWAY_VERSION)
except AttributeError:
# No MIN version pinned by plugin
return

current_version = get_janeway_version()
current_version = version.parse(janeway_version.base_version)
valid = current_version >= wants_version

if not valid:
Expand Down
4 changes: 2 additions & 2 deletions src/janeway/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from semver import Version
__version__ = Version.parse("1.5.1-RC-1")
from packaging import version
__version__ = version.parse("1.5.1-RC-4")
4 changes: 2 additions & 2 deletions src/journal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2624,10 +2624,10 @@ def get_facet_queryset(self):

def get_order_by_choices(self):
return [
('title', _('Titles A-Z')),
('-title', _('Titles Z-A')),
('-date_published', _('Newest')),
('date_published', _('Oldest')),
('title', _('Titles A-Z')),
('-title', _('Titles Z-A')),
('correspondence_author__last_name', _('Author Name')),
('primary_issue__volume', _('Volume')),
]
Expand Down
12 changes: 11 additions & 1 deletion src/press/migrations/0032_auto_20231116_1057.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@

from django.db import migrations, models

def set_constraints_immediately(apps, schema_editor):
"""Circumvents psql not allowing transactions with DDL operations"""
if schema_editor.connection.vendor.startswith("postgresql"):
schema_editor.execute("SET CONSTRAINTS ALL IMMEDIATE")

def set_constraints_deferred(apps, schema_editor):
if schema_editor.connection.vendor.startswith("postgresql"):
schema_editor.execute("SET CONSTRAINTS ALL DEFERRED")


class Migration(migrations.Migration):

dependencies = [
('press', '0031_press_journal_footer_text'),
]

operations = [
migrations.RunPython(set_constraints_immediately, reverse_code=set_constraints_deferred),
migrations.AlterField(
model_name='press',
name='description',
Expand All @@ -28,4 +37,5 @@ class Migration(migrations.Migration):
field=models.TextField(blank=True, default='', help_text='Text that will appear in the footer of every journal, to display publisher address or other essential info. ', verbose_name='Journal footer text'),
preserve_default=False,
),
migrations.RunPython(set_constraints_deferred, reverse_code=set_constraints_immediately),
]
4 changes: 2 additions & 2 deletions src/static/common/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ article .list-romanupper {
color: #fff;
}
.no-list-type {
list-style-type: none;
list-style-type: none !important;
}
.no-list-type:first-child p {
display: inline;
Expand Down Expand Up @@ -297,4 +297,4 @@ article .list-romanupper {
background: #f0f0f0;
padding: 15px;
margin-top: 15px;
}
}
9 changes: 5 additions & 4 deletions src/submission/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,11 @@ class EditorArticleInfoSubmit(ArticleInfo):

def __init__(self, *args, **kwargs):
super(EditorArticleInfoSubmit, self).__init__(*args, **kwargs)
self.fields['section'].label_from_instance = lambda obj: obj.display_name_public_submission
self.fields['section'].help_text = "As an editor you will see all " \
"sections even if they are " \
"closed for public submission"
if self.fields.get('section'):
self.fields['section'].label_from_instance = lambda obj: obj.display_name_public_submission
self.fields['section'].help_text = "As an editor you will see all " \
"sections even if they are " \
"closed for public submission"


class AuthorForm(forms.ModelForm):
Expand Down
4 changes: 2 additions & 2 deletions src/templates/common/elements/journal/social_meta.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<meta name="twitter:card" content="summary">
{% if journal_settings.general.twitter_handle %}<meta name="twitter:site" content="{{ journal_settings.general.twitter_handle }}">{% endif %}
<meta name="twitter:title" content="{{ article.title }}">
<meta name="twitter:description" content="{{ article.abstract }}">
<meta name="twitter:description" content="{{ article.abstract|striptags }}">
{% if article.correspondence_author.twitter_handle %}<meta name="twitter:creator" content="{{ article.correspondence_author.twitter_handle }}">{% endif %}
<meta name="twitter:image" content="{{ article.get_meta_image_path }}">

<meta property="og:title" content="{{ article.title }}" />
<meta property="og:type" content="article" />
<meta property="og:url" content="{{ article.url }}" />
<meta property="og:image" content="{{ article.get_meta_image_path }}" />
<meta property="og:description" content="{{ article.abstract }}" />
<meta property="og:description" content="{{ article.abstract|striptags }}" />
<meta property="og:site_name" content="{{ request.journal.name }}" />
7 changes: 7 additions & 0 deletions src/themes/material/assets/mat.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
html {
line-height: 1.5;
font-family: "Roboto", sans-serif;
font-weight: normal;
color: rgba(0,0,0,0.87);
}

.container {
margin: 0 auto;
max-width: 1500px;
Expand Down
1 change: 1 addition & 0 deletions src/themes/material/templates/core/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<link rel="icon" href="{{ request.repository.favicon.url }}" type="image/vnd.microsoft.icon"/>
{% endif %}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Roboto" rel="stylesheet">
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@materializecss/[email protected]/dist/css/materialize.min.css">
Expand Down
76 changes: 61 additions & 15 deletions src/transform/xsl/default.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,12 @@
</ol>
</xsl:template>

<xsl:template match="table-wrap-foot/fn-group">
<ol class="table-footnotes">
<xsl:apply-templates/>
</ol>
</xsl:template>

<xsl:template match="fn-group/fn">
<xsl:call-template name="referenced-footnote" />
</xsl:template>
Expand Down Expand Up @@ -850,6 +856,8 @@
<xsl:apply-templates select="*[name()!='sec'] | node()"/>
</div>
</xsl:template>

<xsl:template match="sec/label"/>

<xsl:template match="sec[not(@sec-type='datasets')]/title | boxed-text/caption/title">
<xsl:if test="node() != ''">
Expand Down Expand Up @@ -3547,6 +3555,15 @@
<xsl:attribute name="class">
<xsl:value-of select="'list-romanlower'"/>
</xsl:attribute>
<xsl:if test="@continued-from">
<xsl:variable name="continued-from-id" select="@continued-from"/>
<xsl:variable name="count-list-items">
<xsl:number count="list-item[ancestor::list[@id=$continued-from-id]]" level="any"/>
</xsl:variable>
<xsl:attribute name="start">
<xsl:value-of select="$count-list-items + 1"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</ol>
</xsl:when>
Expand All @@ -3555,6 +3572,15 @@
<xsl:attribute name="class">
<xsl:value-of select="'list-romanupper'"/>
</xsl:attribute>
<xsl:if test="@continued-from">
<xsl:variable name="continued-from-id" select="@continued-from"/>
<xsl:variable name="count-list-items">
<xsl:number count="list-item[ancestor::list[@id=$continued-from-id]]" level="any"/>
</xsl:variable>
<xsl:attribute name="start">
<xsl:value-of select="$count-list-items + 1"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</ol>
</xsl:when>
Expand All @@ -3563,6 +3589,15 @@
<xsl:attribute name="class">
<xsl:value-of select="'list-alphalower'"/>
</xsl:attribute>
<xsl:if test="@continued-from">
<xsl:variable name="continued-from-id" select="@continued-from"/>
<xsl:variable name="count-list-items">
<xsl:number count="list-item[ancestor::list[@id=$continued-from-id]]" level="any"/>
</xsl:variable>
<xsl:attribute name="start">
<xsl:value-of select="$count-list-items + 1"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</ol>
</xsl:when>
Expand All @@ -3571,9 +3606,23 @@
<xsl:attribute name="class">
<xsl:value-of select="'list-alphaupper'"/>
</xsl:attribute>
<xsl:if test="@continued-from">
<xsl:variable name="continued-from-id" select="@continued-from"/>
<xsl:variable name="count-list-items">
<xsl:number count="list-item[ancestor::list[@id=$continued-from-id]]" level="any"/>
</xsl:variable>
<xsl:attribute name="start">
<xsl:value-of select="$count-list-items + 1"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</ol>
</xsl:when>
<xsl:otherwise>
<ul>
<xsl:apply-templates/>
</ul>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
Expand All @@ -3584,10 +3633,10 @@
<xsl:template match="list-item">
<xsl:choose>
<xsl:when test="not(parent::list[@list-type='gloss']) and not(parent::list[@list-type='sentence-gloss'])">
<!-- Target list-items that have a title so we can use the title as the list-item-type -->
<!-- See also match="title" where we handle wrapping the title in a span -->
<!-- Target list-items that have a label so we can use the title as the list-item-type -->
<!-- See also match="label" where we handle wrapping the label in a span -->
<xsl:choose>
<xsl:when test="name(*[1]) = 'title'">
<xsl:when test="name(*[1]) = 'label'">
<li class="no-list-type">
<xsl:apply-templates/>
</li>
Expand Down Expand Up @@ -3689,18 +3738,15 @@
</xsl:template>

<xsl:template match="title">
<xsl:choose>
<xsl:when test="name(parent::*) = 'list-item'">
<span class="jats-list-type">
<xsl:value-of select="node()" />
</span>
</xsl:when>
<xsl:otherwise>
<strong>
<xsl:apply-templates/>
</strong>
</xsl:otherwise>
</xsl:choose>
<strong>
<xsl:apply-templates/>
</strong>
</xsl:template>

<xsl:template match="list-item/label">
<span class="jats-list-type">
<xsl:value-of select="node()" />
</span>
</xsl:template>

<xsl:template match="disp-quote">
Expand Down

0 comments on commit 63d3200

Please sign in to comment.