*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit 8f5fb669 authored by Moser, Maximilian's avatar Moser, Maximilian
Browse files

Provide fallback templates for rendering emails and curation settings

* they come in handy for the tests, to avoid a dependency on
  Invenio-Theme-TUW
parent 3af89587
No related branches found
No related tags found
1 merge request!77Refactor layout and add tests
......@@ -206,13 +206,19 @@ def send_publication_notification_email(recid: str, user_id: Optional[str] = Non
user = owner.resolve()
html_message = render_template(
"invenio_theme_tuw/mails/record_published.html",
[
"invenio_theme_tuw/mails/record_published.html",
"mails/record_published.html",
],
uploader=user,
record=record,
app=current_app,
)
message = render_template(
"invenio_theme_tuw/mails/record_published.txt",
[
"invenio_theme_tuw/mails/record_published.txt",
"mails/record_published.txt",
],
uploader=user,
record=record,
app=current_app,
......
{#-
Copyright (C) 2025 TU Wien.
Invenio Config TUW is free software; you can redistribute it and/or modify
it under the terms of the MIT License; see LICENSE file for more details.
#}
{%- extends config.USERPROFILES_SETTINGS_TEMPLATE %}
{%- from "invenio_userprofiles/settings/_macros.html" import render_field, form_errors %}
{%- block settings_content scoped %}
<section aria-label="{{ _('Curation') }}" class="ui segments">
<div class="ui segment secondary">
<i class="file icon" aria-hidden="true"></i>
<strong class="header item">{{ _("Curation") }}</strong>
</div>
<div class="ui segment">
<form method="POST" name="preferences_curation_form" class="ui form">
{%- set form = preferences_curation_form %}
{%- for field in form %}
{%- if field.widget.input_type == 'hidden' %}
{{ field() }}
{%- endif %}
{%- endfor %}
{%- set consent_field = form.consent %}
{%- set consent_given = current_user.preferences.get("curation_consent", False) %}
<div class="field">
<label for="{{ consent_field.id }}">{{ consent_field.label }}</label>
<p><small>{{ consent_field.description }}</small></p>
<div class="ui toggle on-off checkbox">
<input type="checkbox" name="{{ consent_field.id }}" id="{{ consent_field.id }}" {{ "checked" if consent_given else "" }} />
<label for="{{ consent_field.id }}">Curate my records</label>
</div>
</div>
<div class="form-actions">
<a href="." class="ui labeled icon button mt-5">
<i class="close icon" aria-hidden="true"></i>
{{ _('Cancel') }}
</a>
<button type="submit" name="submit" value="{{ form._prefix }}" class="ui primary labeled icon button mt-5">
<i class="check icon" aria-hidden="true"></i>
{{ _('Update curation preferences') }}
</button>
</div>
</form>
</div>
</section>
{% endblock %}
{#-
Copyright (C) 2025 TU Wien.
Invenio Config TUW is free software; you can redistribute it and/or modify
it under the terms of the MIT License; see LICENSE file for more details.
-#}
{%- if record.pids and record.pids.doi %}
{%- set doi = record.pids.doi.identifier %}
{%- set doi_base_url = "https://doi.org/" if not app.config["DATACITE_TEST_MODE"] else "https://handle.test.datacite.org/" %}
{%- set doi_ref = "DOI" if not app.config["DATACITE_TEST_MODE"] else "DOI-like handle" %}
{%- set avail_message = 'It is now available under the following ' + doi_ref + ': <a href="' + doi_base_url + doi + '">' + doi_base_url + doi + '</a>' %}
{%- else %}
{%- set avail_message = 'It is now available under the following URL: <a href="' + record.links.self_html + '">' + record.links.self_html + '</a>' %}
{%- endif %}
<p>
Dear {{ uploader.user_profile.full_name }},
</p>
<p>
Your record "{{ record.metadata.title }}" just got published!
<br />
{{ avail_message|safe }}
</p>
<p>
Metadata edits for this record will <em>not</em> require another review.
</p>
<p>
Cheers,
<br />
The team at the Center for Research Data Management
</p>
{#-
Copyright (C) 2025 TU Wien.
Invenio Config TUW is free software; you can redistribute it and/or modify
it under the terms of the MIT License; see LICENSE file for more details.
-#}
{%- if record.pids and record.pids.doi %}
{%- set doi = record.pids.doi.identifier %}
{%- set doi_base_url = "https://doi.org/" if not app.config["DATACITE_TEST_MODE"] else "https://handle.test.datacite.org/" %}
{%- set doi_ref = "DOI" if not app.config["DATACITE_TEST_MODE"] else "DOI-like handle" %}
{%- set avail_message = "It is now available under the following " + doi_ref + ": " + doi_base_url + doi %}
{%- else %}
{%- set avail_message = "It is now available under the following URL: " + record.links.self_html %}
{%- endif %}
Dear {{ uploader.user_profile.full_name }},
Your record "{{ record.metadata.title }}" just got published!
{{ avail_message|safe }}
Metadata edits for this record will *not* require another review.
Cheers,
The team at the Center for Research Data Management
......@@ -17,6 +17,7 @@ blueprint = Blueprint(
"invenio_config_tuw_settings",
__name__,
url_prefix="/account/settings/curation",
template_folder="templates",
)
......@@ -40,6 +41,6 @@ def curation_settings_view():
flash(("Curation settings were updated."), category="success")
return render_template(
"invenio_theme_tuw/settings/curation.html",
["invenio_theme_tuw/settings/curation.html", "curation_settings.html"],
preferences_curation_form=preferences_curation_form,
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment