Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 18 additions & 2 deletions src/journal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2124,6 +2124,8 @@ def accessibility(request):
template = "admin/core/a11y.html"
elif request.journal:
template = "core/a11y.html"
elif request.repository:
template = "repository/a11y.html"
else:
template = "press/a11y.html"

Expand Down Expand Up @@ -2165,10 +2167,12 @@ def parse_audit_link(audit_str):
except (FileNotFoundError, json.JSONDecodeError):
vpat_data = {}

# For press a11y page, identify themes in use by journals
# For press a11y page, identify themes in use by journals and repositories
journal_themes = {}
if not request.journal: # This is the press-level page
repository_themes = {}
if not request.journal and not request.repository: # This is the press-level page
from core.models import SettingValue, Setting
from repository.models import Repository

press = request.press
all_journals = press.journals()
Expand All @@ -2193,9 +2197,21 @@ def parse_audit_link(audit_str):
theme_lower = theme.lower()
journal_themes[theme_lower] = {"has_vpat": theme_lower in vpat_data}

# Check all themes used by live repositories belonging to this press
repository_themes_in_use = set(
Repository.objects.filter(press=press, live=True).values_list(
"theme", flat=True
)
)
for theme in repository_themes_in_use:
theme_lower = theme.lower()
repository_themes[theme_lower] = {"has_vpat": theme_lower in vpat_data}

context = {
"vpat_data": vpat_data,
"journal_themes": journal_themes,
"repository_themes": repository_themes,
"other_themes_in_use": set(journal_themes) | set(repository_themes),
}
return render(request, template, context)

Expand Down
22 changes: 16 additions & 6 deletions src/themes/OLH/templates/press/a11y.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,37 @@ <h1 id="cms-title">{% trans "Accessibility" %} </h1>
{% include "common/elements/a11y/press.html" %}
{% include "common/elements/a11y/janeway.html" %}

{% if not journal_themes or journal_themes|length == 1 and 'olh' in journal_themes %}
{% if not other_themes_in_use or other_themes_in_use|length == 1 and 'olh' in other_themes_in_use %}
<h3>VPAT</h3>
{% include "common/elements/a11y/vpat.html" with vpat_data=vpat_data theme="olh" %}
{% else %}
<p>
{% blocktrans %}
Janeway has several themes, each of which has unique templates and is built on a different framework and so vary in accessibility.
This press-site uses a different theme to some of the journals-sites. VPATs for all themes in use are given below.
This press-site uses a different theme to some of the journal- or repository-sites it hosts. VPATs for all themes in use are given below.
{% endblocktrans%}
</p>

{% if 'olh' in journal_themes %}
{% if 'olh' in journal_themes and 'olh' in repository_themes %}
<h3>{% trans "OLH Theme VPAT (Press, Journals and Repositories)" %}</h3>
{% elif 'olh' in journal_themes %}
<h3>{% trans "OLH Theme VPAT (Press and Journals)" %}</h3>
{% elif 'olh' in repository_themes %}
<h3>{% trans "OLH Theme VPAT (Press and Repositories)" %}</h3>
{% else %}
<h3>{% trans "OLH Theme VPAT (Press)" %}</h3>
{% endif %}
{% include "common/elements/a11y/vpat.html" with vpat_data=vpat_data theme="olh" %}

{% if 'material' in journal_themes %}
<h3>{% trans "Material Theme VPAT (Journals)" %}</h3>
{% include "common/elements/a11y/vpat.html" with vpat_data=vpat_data theme="material" %}
{% if 'material' in journal_themes or 'material' in repository_themes %}
{% if 'material' in journal_themes and 'material' in repository_themes %}
<h3>{% trans "Material Theme VPAT (Journals and Repositories)" %}</h3>
{% elif 'material' in journal_themes %}
<h3>{% trans "Material Theme VPAT (Journals)" %}</h3>
{% else %}
<h3>{% trans "Material Theme VPAT (Repositories)" %}</h3>
{% endif %}
{% include "common/elements/a11y/vpat.html" with vpat_data=vpat_data theme="material" %}
{% endif %}

{% if 'clean' in journal_themes %}
Expand Down
20 changes: 20 additions & 0 deletions src/themes/OLH/templates/repository/a11y.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% extends "core/base.html" %}

{% block title %}{% trans "Accessibility" %}{% endblock %}

{% block body %}
<section id="content" aria-labelledby="cms-title">
<div class="row">
<div class="{% if page.display_toc %}border-right medium-8 small-12{% else %}medium-12{% endif %} columns">
<div id="main_article">
<h1 id="cms-title">{% trans "Accessibility" %} </h1>
<hr aria-hidden="true" />
{% include "common/elements/a11y/press.html" %}
{% include "common/elements/a11y/janeway.html" %}
{% include "common/elements/a11y/vpat.html" with vpat_data=vpat_data theme="olh" %}
</div>
</div>

</div>
</section>
{% endblock body %}
24 changes: 18 additions & 6 deletions src/themes/clean/templates/press/a11y.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ <h1> {% trans "Accessibility" %} </h1>
{% include "common/elements/a11y/press.html" %}
{% include "common/elements/a11y/janeway.html" %}

{% if not journal_themes or journal_themes|length == 1 and 'clean' in journal_themes %}
{% if not other_themes_in_use or other_themes_in_use|length == 1 and 'clean' in other_themes_in_use %}
<h3>VPAT</h3>
{% include "common/elements/a11y/vpat.html" with vpat_data=vpat_data theme="clean" %}
{% else %}
<p>
{% blocktrans %}
Janeway has several themes, each of which has unique templates and is built on a different framework and so vary in accessibility.
This press-site uses a different theme to some of the journals-sites. VPATs for all themes in use are given below.
This press-site uses a different theme to some of the journal- or repository-sites it hosts. VPATs for all themes in use are given below.
{% endblocktrans%}
</p>

Expand All @@ -28,13 +28,25 @@ <h3>{% trans "Clean Theme VPAT (Press)" %}</h3>
{% endif %}
{% include "common/elements/a11y/vpat.html" with vpat_data=vpat_data theme="clean" %}

{% if 'olh' in journal_themes %}
<h3>{% trans "OLH Theme VPAT (Journals)" %}</h3>
{% if 'olh' in journal_themes or 'olh' in repository_themes %}
{% if 'olh' in journal_themes and 'olh' in repository_themes %}
<h3>{% trans "OLH Theme VPAT (Journals and Repositories)" %}</h3>
{% elif 'olh' in journal_themes %}
<h3>{% trans "OLH Theme VPAT (Journals)" %}</h3>
{% else %}
<h3>{% trans "OLH Theme VPAT (Repositories)" %}</h3>
{% endif %}
{% include "common/elements/a11y/vpat.html" with vpat_data=vpat_data theme="olh" %}
{% endif %}

{% if 'material' in journal_themes %}
<h3>{% trans "Material Theme VPAT (Journals)" %}</h3>
{% if 'material' in journal_themes or 'material' in repository_themes %}
{% if 'material' in journal_themes and 'material' in repository_themes %}
<h3>{% trans "Material Theme VPAT (Journals and Repositories)" %}</h3>
{% elif 'material' in journal_themes %}
<h3>{% trans "Material Theme VPAT (Journals)" %}</h3>
{% else %}
<h3>{% trans "Material Theme VPAT (Repositories)" %}</h3>
{% endif %}
{% include "common/elements/a11y/vpat.html" with vpat_data=vpat_data theme="material" %}
{% endif %}

Expand Down
3 changes: 3 additions & 0 deletions src/themes/material/templates/core/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
{% include "elements/journal_footer.html" %}
{% elif request.repository %}
{{ request.repository.footer|safe }}
<ul class="list-inline bar-sep">
<li><a href="{% url 'accessibility' %}">{% trans "Accessibility" %}</a></li>
</ul>
{% else %}
{% include "press/elements/press_footer.html" %}
{% endif %}
Expand Down
20 changes: 15 additions & 5 deletions src/themes/material/templates/press/a11y.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,36 @@ <h1> {% trans "Accessibility" %} </h1>
{% include "common/elements/a11y/press.html" %}
{% include "common/elements/a11y/janeway.html" %}

{% if not journal_themes or journal_themes|length == 1 and 'material' in journal_themes %}
{% if not other_themes_in_use or other_themes_in_use|length == 1 and 'material' in other_themes_in_use %}
<h3>VPAT</h3>
{% include "common/elements/a11y/vpat.html" with vpat_data=vpat_data theme="material" %}
{% else %}
<p>
{% blocktrans %}
Janeway has several themes, each of which has unique templates and is built on a different framework and so vary in accessibility.
This press-site uses a different theme to some of the journals-sites. VPATs for all themes in use are given below.
This press-site uses a different theme to some of the journal- or repository-sites it hosts. VPATs for all themes in use are given below.
{% endblocktrans%}
</p>

{% if 'material' in journal_themes %}
{% if 'material' in journal_themes and 'material' in repository_themes %}
<h3>{% trans "Material Theme VPAT (Press, Journals and Repositories)" %}</h3>
{% elif 'material' in journal_themes %}
<h3>{% trans "Material Theme VPAT (Press and Journals)" %}</h3>
{% elif 'material' in repository_themes %}
<h3>{% trans "Material Theme VPAT (Press and Repositories)" %}</h3>
{% else %}
<h3>{% trans "Material Theme VPAT (Press)" %}</h3>
{% endif %}
{% include "common/elements/a11y/vpat.html" with vpat_data=vpat_data theme="material" %}

{% if 'olh' in journal_themes %}
<h3>{% trans "OLH Theme VPAT (Journals)" %}</h3>
{% if 'olh' in journal_themes or 'olh' in repository_themes %}
{% if 'olh' in journal_themes and 'olh' in repository_themes %}
<h3>{% trans "OLH Theme VPAT (Journals and Repositories)" %}</h3>
{% elif 'olh' in journal_themes %}
<h3>{% trans "OLH Theme VPAT (Journals)" %}</h3>
{% else %}
<h3>{% trans "OLH Theme VPAT (Repositories)" %}</h3>
{% endif %}
{% include "common/elements/a11y/vpat.html" with vpat_data=vpat_data theme="olh" %}
{% endif %}

Expand Down
15 changes: 15 additions & 0 deletions src/themes/material/templates/repository/a11y.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% extends "core/base.html" %}

{% load static %}
{% load i18n %}
{% load materializecss %}

{% block title %}{% trans "Accessibility" %}{% endblock %}

{% block body %}
<h1> {% trans "Accessibility" %} </h1>
{% include "common/elements/a11y/press.html" %}
{% include "common/elements/a11y/janeway.html" %}
{% include "common/elements/a11y/vpat.html" with vpat_data=vpat_data theme="material" %}

{% endblock body %}
Loading