Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2504 New Settings #2525

Merged
merged 3 commits into from
Oct 21, 2021
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
3 changes: 3 additions & 0 deletions src/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class PasswordResetAdmin(admin.ModelAdmin):
class SettingValueAdmin(admin.ModelAdmin):
list_display = ('setting_journal', 'setting_pretty_name')
list_filter = ('setting', 'journal')
raw_id_fields = (
'setting', 'journal',
)

@staticmethod
def apply_select_related(self, qs):
Expand Down
1 change: 1 addition & 0 deletions src/core/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ def get_settings_to_edit(group, journal):
'publisher_url', 'privacy_policy_url', 'auto_signature',
'slack_logging', 'slack_webhook', 'twitter_handle',
'switch_language', 'enable_language_text', 'google_analytics_code',
'display_login_page_notice', 'login_page_notice',
]

settings = process_setting_list(journal_settings, 'general', journal)
Expand Down
10 changes: 8 additions & 2 deletions src/identifiers/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ def register_crossref_component(article, xml, supp_file):


def create_crossref_context(identifier):
timestamp_suffix = identifier.article.journal.get_setting(
'crossref',
'crossref_date_suffix',
)

from utils import setting_handler
template_context = {
'batch_id': uuid4(),
Expand All @@ -114,8 +119,8 @@ def create_crossref_context(identifier):
'registrant': setting_handler.get_setting('Identifiers', 'crossref_registrant',
identifier.article.journal).processed_value,
'journal_title': (
identifier.article.publication_title
or identifier.article.journal.name
identifier.article.publication_title
or identifier.article.journal.name
),
'abstract': strip_tags(identifier.article.abstract or ''),
'journal_issn': identifier.article.journal.issn,
Expand All @@ -132,6 +137,7 @@ def create_crossref_context(identifier):
'doi': identifier.identifier,
'article_url': identifier.article.url,
'now': timezone.now(),
'timestamp_suffix': timestamp_suffix,
}

# append citations for i4oc compatibility
Expand Down
1 change: 0 additions & 1 deletion src/journal/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
url(r'^issues/$', views.issues, name='journal_issues'),
url(r'^issue/current/$', views.current_issue, name='current_issue'),
url(r'^issue/(?P<issue_id>\d+)/info/$', views.issue, name='journal_issue'),
url(r'^issue/(?P<issue_id>\d+)/download/$', views.download_issue, name='journal_issue_download'),
url(r'^issue/(?P<issue_id>\d+)/download/(?P<galley_id>\d+)$',
views.download_issue_galley,
name='journal_issue_download_galley'),
Expand Down
4 changes: 4 additions & 0 deletions src/templates/admin/elements/forms/group_journal.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ <h2>Other</h2>

<p>You can use this setting to stop this journal being list on the Press' journals page.</p>
{% include "admin/elements/forms/field.html" with field=attr_form.hide_from_press %}

<p>If you want to display a special message on the login page you can add it here.</p>
{% include "admin/elements/forms/field.html" with field=edit_form.display_login_page_notice %}
{% include "admin/elements/forms/field.html" with field=edit_form.login_page_notice %}
</div>


2 changes: 1 addition & 1 deletion src/templates/common/identifiers/crossref_article.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
>
<head>
<doi_batch_id>{{ batch_id }}</doi_batch_id>
<timestamp>{% now "YmdHis" %}</timestamp>
<timestamp>{% now "YmdHis" %}{% if timestamp_suffix %}{{ timestamp_suffix }}{% endif %}</timestamp>
<depositor>
<depositor_name>{{ depositor_name }}</depositor_name>
<email_address>{{ depositor_email }}</email_address>
Expand Down
3 changes: 3 additions & 0 deletions src/themes/OLH/templates/core/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
<h4 class="text-center">{% trans "Log in with your account" %}</h4>
<a href="{{ settings.ORCID_URL }}?client_id={{ settings.ORCID_CLIENT_ID }}&response_type=code&scope=/authenticate&redirect_uri={% orcid_redirect_uri %}" class="success button expanded">{% trans "Log in with ORCiD" %}</a>
{% endif %}
{% if journal_settings.general.display_login_page_notice %}
{{ journal_settings.general.login_page_notice|safe }}
{% endif %}
<label>{% trans form.fields.user_name.label %}</label>
{{ form.user_name }}
<label>{% trans form.user_pass.label %}</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<div class="section">
<h3>{% trans 'Downloads' %}</h3>
{% if issue.galley %}<p><a href="{% url 'journal_issue_download_galley' issue.pk issue.galley.pk %}"><i class="fa fa-download">&nbsp</i>{% trans "Download Issue" %} (PDF)</a></p>{% endif %}
<p><a href="{% url 'journal_issue_download' issue.pk %}"><i class="fa fa-download">&nbsp</i>{% trans "Download Issue" %} (ZIP)</a></p>
<h3>
{% if issue.issue_type.code == 'issue' %}{% trans "Issue Archive" %}
{% else %} {% trans issue.issue_type.plural_name %}
Expand Down
3 changes: 3 additions & 0 deletions src/themes/clean/templates/core/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ <h2 class="text-center">{% trans "Log in with your account" %}</h2>
<form method="POST">
{% include "common/elements/static-error-messages.html" with form=form %}
{% csrf_token %}
{% if journal_settings.general.display_login_page_notice %}
{{ journal_settings.general.login_page_notice|safe }}
{% endif %}
<div class="form-group">
<label for="user_name">{% trans form.fields.user_name.label %}</label>
<input name="user_name" type="text" placeholder="[email protected]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<div class="section">
<h3>{% trans 'Downloads' %}</h3>
{% if issue.galley %}<p><a href="{% url 'journal_issue_download_galley' issue.pk issue.galley.pk %}"><span class="fa fa-download">&nbsp</span>Download Issue (PDF)</a></p>{% endif %}
<p><a href="{% url 'journal_issue_download' issue.pk %}"><span class="fa fa-download">&nbsp</span>Download Issue (ZIP)</a></p>
<h3>
{% if issue.issue_type.code == 'issue' %}{% trans "Issue Archive" %}
{% else %} {% trans issue.issue_type.plural_name %}
Expand Down
3 changes: 3 additions & 0 deletions src/themes/material/templates/core/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
{% csrf_token %}
<div class="card-content">
<span class="card-title">{% trans "Login" %}</span>
{% if journal_settings.general.display_login_page_notice %}
{{ journal_settings.general.login_page_notice|safe }}
{% endif %}
<div class="input-field col s12">
{{ form.user_name }}
<label for="email">{% trans form.user_name.label %}</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ <h3>{% trans 'Downloads' %}</h3>
<a href="{% url 'journal_issue_download_galley' issue.pk issue.galley.pk %}"><i class="fa fa-download">&nbsp</i> {% trans "Download" %} {% if not collection %}{% trans "Issue" %}{% else %}{% with col=journal_settings.general.collection_name %}{% if col %}{{ col }}{% else %}{% with col=journal_settings.general.collection_name %}{% if col %}{{ col }}{% else %}{% trans "Collection" %}{% endif %}{% endwith %}{% endif %}{% endwith %}{% endif %} (PDF)</a>
<li>
{% endif %}
</li>
<a href="{% url 'journal_issue_download' issue.pk %}"><i class="fa fa-download">&nbsp</i> {% trans "Download" %} {% if not collection %}{% trans "Issue" %}{% else %}{% with col=journal_settings.general.collection_name %}{% if col %}{{ col }}{% else %}{% with col=journal_settings.general.collection_name %}{% if col %}{{ col }}{% else %}{% trans "Collection" %}{% endif %}{% endwith %}{% endif %}{% endwith %}{% endif %} (ZIP)</a>
</li>
</ul>

<h3>
Expand Down
45 changes: 45 additions & 0 deletions src/utils/install/journal_defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -3073,5 +3073,50 @@
"value": {
"default": ""
}
},
{
"group": {
"name": "general"
},
"setting": {
"description": "If set to true the Login Page Notice will display.",
"is_translatable": true,
"name": "display_login_page_notice",
"pretty_name": "Display Login Page Notice",
"type": "boolean"
},
"value": {
"default": false
}
},
{
"group": {
"name": "general"
},
"setting": {
"description": "Message to display if you enable Display Login Notice.",
"is_translatable": true,
"name": "login_page_notice",
"pretty_name": "Login Page Notice",
"type": "rich-text"
},
"value": {
"default": ""
}
},
{
"group": {
"name": "crossref"
},
"setting": {
"description": "For migrated content where we need to tweak the crossref date.",
"is_translatable": true,
"name": "crossref_date_suffix",
"pretty_name": "Crossref Date Suffix",
"type": "text"
},
"value": {
"default": ""
}
}
]