Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
4 changes: 4 additions & 0 deletions src/core/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,10 @@ def get_settings_to_edit(display_group, journal, user):
},
)

a11y_settings = ["a11y_public_info"]
a11y_group_of_settings = process_setting_list(a11y_settings, "a11y", journal)
group_of_settings.extend(a11y_group_of_settings)

elif display_group == "proofing":
proofing_settings = ["max_proofreaders"]
group_of_settings = process_setting_list(proofing_settings, "general", journal)
Expand Down
21 changes: 21 additions & 0 deletions src/core/migrations/0110_setting_depends_on_press_field.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 4.2.20 on 2025-09-26 09:53

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("core", "0109_salutation_name_20250707_1420"),
]

operations = [
migrations.AddField(
model_name="setting",
name="depends_on_press_field",
field=models.CharField(
blank=True,
help_text="If set, this setting is only available when the specified press setting is enabled.",
max_length=100,
),
),
]
6 changes: 6 additions & 0 deletions src/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,12 @@ class Setting(models.Model):

is_translatable = models.BooleanField(default=False)

depends_on_press_field = models.CharField(
max_length=100,
blank=True,
help_text="If set, this setting is only available when the specified press setting is enabled.",
)

editable_by = models.ManyToManyField(
Role,
blank=True,
Expand Down
18 changes: 18 additions & 0 deletions src/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,24 @@ def settings_index(request):
editable_by__in=request.user.roles_for_journal(request.journal)
)

if request.journal:
press = request.journal.press
# Filter out press-dependent settings where the press setting is False
press_dependent_settings = settings.filter(
depends_on_press_field__isnull=False
).exclude(depends_on_press_field="")

# Get the press setting values for these settings
excluded_settings = []
for setting in press_dependent_settings:
press_setting_value = getattr(press, setting.depends_on_press_field, False)
if not press_setting_value:
excluded_settings.append(setting.id)

# Exclude settings where press setting is False
if excluded_settings:
settings = settings.exclude(id__in=excluded_settings)

template = "core/manager/settings/index.html"
context = {
"settings": settings,
Expand Down
2 changes: 2 additions & 0 deletions src/journal/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@
re_path(r"^reviewer/$", views.become_reviewer, name="become_reviewer"),
# Contact
re_path(r"^contact/$", views.contact, name="contact"),
# Accessibility
re_path(r"^accessibility/$", views.accessibility, name="accessibility"),
# Editorial team
re_path(r"^editorialteam/$", views.editorial_team, name="editorial_team"),
# Editorial team
Expand Down
18 changes: 18 additions & 0 deletions src/journal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2121,6 +2121,24 @@ def contact(request):
return render(request, template, context)


@decorators.frontend_enabled
def accessibility(request):
"""
Displays the accessibility information page.
:param request: HttpRequest object
:return: HttpResponse object
"""
if request.journal and request.journal.disable_front_end:
template = "admin/core/a11y.html"
elif request.journal:
template = "core/a11y.html"
else:
template = "press/a11y.html"

context = {}
return render(request, template, context)


@decorators.frontend_enabled
def editorial_team(request, group_id=None):
"""
Expand Down
3 changes: 3 additions & 0 deletions src/press/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ class Meta:
"tracking_code",
"disable_journals",
"privacy_policy_url",
"ally_info",
"allow_journal_a11y_info",
)
widgets = {
"theme": forms.Select(choices=logic.get_theme_list()),
"footer_description": TinyMCE(),
"journal_footer_text": TinyMCE(),
"description": TinyMCE(),
"ally_info": TinyMCE(),
}

def save(self, commit=True):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Generated by Django 4.2.20 on 2025-09-26 09:53

import core.model_utils
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("press", "0036_remove_press_password_reset_text_and_more"),
]

operations = [
migrations.AddField(
model_name="press",
name="allow_journal_a11y_info",
field=models.BooleanField(
default=False,
help_text="If enabled, journals can have their own accessibility information as well.",
verbose_name="Allow Journal Accessibility Information",
),
),
migrations.AddField(
model_name="press",
name="ally_info",
field=core.model_utils.JanewayBleachField(
blank=True,
help_text="This is information about the accessiblity of user-content. It will appear on the accessibility page under the press name.",
verbose_name="Press Accessibility Information",
),
),
]
10 changes: 10 additions & 0 deletions src/press/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,16 @@ class Press(AbstractSiteModel):
disable_journals = models.BooleanField(
default=False, help_text="If enabled, the journals page will no longer render."
)
ally_info = JanewayBleachField(
blank=True,
verbose_name="Press Accessibility Information",
help_text="This is information about the accessiblity of user-content. It will appear on the accessibility page under the press name.",
)
allow_journal_a11y_info = models.BooleanField(
default=False,
verbose_name="Allow Journal Accessibility Information",
help_text="If enabled, journals can have their own accessibility information as well.",
)

def __str__(self):
return "%s" % self.name
Expand Down
10 changes: 10 additions & 0 deletions src/templates/admin/elements/forms/group_journal.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,14 @@ <h2>Other</h2>
{% include "admin/elements/forms/field.html" with field=edit_form.use_credit %}
</div>

{% if request.press.allow_journal_a11y_info %}
<div class="title-area">
<h2>Accessibility</h2>
</div>
<div class="content">
<p>{% trans "Display journal specific accessibility information." %}</p>
{% include "admin/elements/forms/field.html" with field=edit_form.a11y_public_info %}
</div>
{% endif %}


5 changes: 5 additions & 0 deletions src/templates/admin/press/edit_press.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ <h2>Security</h2>
{{ form.password_length|foundation }}
{{ form.privacy_policy_url|foundation }}
{{ form.tracking_code|foundation }}
<div class="title-area">
<h2>Accessibility</h2>
</div>
{{ form.ally_info|foundation }}
{{ form.allow_journal_a11y_info|foundation }}
<button type="submit" name="save_press" class="success button">Save</button>
</form>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/templates/common/elements/a11y/janeway.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h2> Janeway A11y Placeholder </h2>
<p>janeway a11y text</p>
5 changes: 5 additions & 0 deletions src/templates/common/elements/a11y/journal.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% load settings %}
{% if request.press.allow_journal_a11y_info and request.journal|setting:'a11y_public_info'|safe %}
<h2>{{ request.journal.name }}</h2>
{{ request.journal|setting:'a11y_public_info'|safe }}
{% endif %}
4 changes: 4 additions & 0 deletions src/templates/common/elements/a11y/press.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% if press.ally_info%}
<h2>{{ press.name }}</h2>
{{ press.ally_info|safe }}
{% endif %}
20 changes: 20 additions & 0 deletions src/themes/OLH/templates/core/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/janeway.html" %}
{% include "common/elements/a11y/press.html" %}
{% include "common/elements/a11y/journal.html" %}
</div>
</div>

</div>
</section>
{% endblock body %}
1 change: 1 addition & 0 deletions src/themes/OLH/templates/elements/journal_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<li><a href="{% url 'cms_page' "privacy" %}">{% trans "Privacy Policy" %}</a></li>
{% endif %}
<li><a href="{% url 'contact' %}">{% trans "Contact" %}</a></li>
<li><a href="{% url 'accessibility' %}">{% trans "Accessibility" %}</a></li>
{% if not request.user.is_authenticated %}
<li>
<a href="{% url 'core_login' %}">
Expand Down
19 changes: 19 additions & 0 deletions src/themes/OLH/templates/press/a11y.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% 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/janeway.html" %}
{% include "common/elements/a11y/press.html" %}
</div>
</div>

</div>
</section>
{% endblock body %}
1 change: 1 addition & 0 deletions src/themes/OLH/templates/press/elements/press_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
{% endif %}
<li><a href="{% url 'website_sitemap' %}">{% trans "Sitemap" %}</a></li>
<li><a href="{% url 'contact' %}">{% trans "Contact" %}</a></li>
<li><a href="{% url 'accessibility' %}">{% trans "Accessibility" %}</a></li>
{% if not request.user.is_authenticated %}
<li>
<a href="{% url 'core_login' %}">
Expand Down
15 changes: 15 additions & 0 deletions src/themes/clean/templates/core/a11y.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% extends "core/base.html" %}

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

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

{% block body %}
<h1> {% trans "Accessibility" %} </h1>

{% include "common/elements/a11y/janeway.html" %}
{% include "common/elements/a11y/press.html" %}
{% include "common/elements/a11y/journal.html" %}

{% endblock body %}
1 change: 1 addition & 0 deletions src/themes/clean/templates/elements/journal_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
href="{% url 'cms_page' 'privacy' %}">{% trans "Privacy Policy" %}</a></li>
{% endif %}
<li class="list-inline-item"><a href="{% url 'contact' %}">{% trans "Contact" %}</a></li>
<li class="list-inline-item"><a href="{% url 'accessibility' %}">{% trans "Accessibility" %}</a></li>
{% if not request.user.is_authenticated %}
<li class="list-inline-item">
<a href="{% url 'core_login' %}">
Expand Down
1 change: 1 addition & 0 deletions src/themes/clean/templates/elements/press_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
{% endif %}
<li class="list-inline-item"><a href="{% url 'website_sitemap' %}">{% trans "Sitemap" %}</a></li>
<li class="list-inline-item"><a href="{% url 'contact' %}">{% trans "Contact" %}</a></li>
<li class="list-inline-item"><a href="{% url 'accessibility' %}">{% trans "Accessibility" %}</a></li>
{% if not request.user.is_authenticated %}
<li class="list-inline-item">
<a href="{% url 'core_login' %}">
Expand Down
14 changes: 14 additions & 0 deletions src/themes/clean/templates/press/a11y.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% extends "core/base.html" %}

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

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

{% block body %}
<h1> {% trans "Accessibility" %} </h1>

{% include "common/elements/a11y/janeway.html" %}
{% include "common/elements/a11y/press.html" %}

{% endblock body %}
16 changes: 16 additions & 0 deletions src/themes/material/templates/core/a11y.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% 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/janeway.html" %}
{% include "common/elements/a11y/press.html" %}
{% include "common/elements/a11y/journal.html" %}

{% endblock body %}
1 change: 1 addition & 0 deletions src/themes/material/templates/elements/journal_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
{% endif %}>
{% trans "Privacy Policy" %}
</a> </li>
<li><a href="{% url 'accessibility' %}">{% trans "Accessibility" %}</a></li>
</ul>
</div>
<div class="col m2">
Expand Down
15 changes: 15 additions & 0 deletions src/themes/material/templates/press/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/janeway.html" %}
{% include "common/elements/a11y/press.html" %}

{% endblock body %}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
<div class="col m2">
{% svg request.press_cover %}
</div>
<div class="col m10">
<div class="col m8">
<p><small>{{ press.footer_description|default:""|safe }}</small></p>
</div>
<div class="col m2">
<ul class="list-inline-bar">
<li><a href="{% url 'accessibility' %}">{% trans "Accessibility" %}</a></li>
</ul>
</div>
</div>
1 change: 1 addition & 0 deletions src/utils/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def update_settings(
"pretty_name": item["setting"].get("pretty_name"),
"description": item["setting"].get("description"),
"is_translatable": item["setting"].get("is_translatable"),
"depends_on_press_field": item["setting"].get("depends_on_press_field"),
}

setting, created = core_models.Setting.objects.get_or_create(
Expand Down
Loading
Loading