Skip to content

Commit

Permalink
organisations: implement multilingual footer for dedicated
Browse files Browse the repository at this point in the history
* Changes Powered by RERO+ by Powered by SONAR in the footer.
* Closes #682.

Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
  • Loading branch information
Garfield-fr authored and jma committed Nov 4, 2021
1 parent e5376aa commit ed213c8
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 5 deletions.
36 changes: 36 additions & 0 deletions data/organisations/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,24 @@
"value": "Description in Italian in **markdown** format"
}
],
"footer": [
{
"language": "ger",
"value": "Footer GER **markdown** format"
},
{
"language": "eng",
"value": "Footer ENG **markdown** format"
},
{
"language": "fre",
"value": "Footer FRE **markdown** format"
},
{
"language": "ita",
"value": "Footer ITA **markdown** format"
}
],
"isShared": true,
"isDedicated": true,
"platformName": "FREDI",
Expand Down Expand Up @@ -75,6 +93,24 @@
"value": "FOLIA è l'archivio istituzionale dell'Università di Friburgo (Svizzera). Fornisce un accesso gratuito alle pubblicazioni dei ricercatrici e ricercatori dell'Università. FOLIA è gestito dalla Bibliothèque cantonale et universitaire de Fribourg."
}
],
"footer": [
{
"language": "ger",
"value": "Footer GER **markdown** format"
},
{
"language": "eng",
"value": "Footer ENG **markdown** format"
},
{
"language": "fre",
"value": "Footer FRE **markdown** format"
},
{
"language": "ita",
"value": "Footer ITA **markdown** format"
}
],
"isShared": true,
"isDedicated": true,
"platformName": "# FOLIA\n#### Fribourg Open Library and Archive",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,55 @@
}
}
},
"footer": {
"title": "Footers",
"type": "array",
"minItems": 1,
"items": {
"title": "Footer",
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"title": "Value",
"type": "string",
"minLength": 1,
"form": {
"type": "markdown",
"templateOptions": {
"rows": 5
}
}
},
"language": {
"$ref": "interface_language-v1.0.0.json"
}
},
"propertiesOrder": [
"language",
"value"
],
"required": [
"value",
"language"
]
},
"form": {
"hideExpression": "!field.parent.model.isDedicated",
"validation": {
"validators": {
"uniqueValueKeysInObject": {
"keys": [
"language"
]
}
},
"messages": {
"uniqueValueKeysInObjectMessage": "Only one value per language is allowed"
}
}
}
},
"isShared": {
"title": "Is shared",
"description": "Organisation records can be accessed by a specific URL.",
Expand Down Expand Up @@ -328,6 +377,7 @@
"code",
"name",
"description",
"footer",
"isShared",
"isDedicated",
"allowedIps",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@
}
}
},
"footer": {
"type": "object",
"properties": {
"language": {
"type": "keyword"
},
"value": {
"type": "text"
}
}
},
"name": {
"type": "text",
"fields": {
Expand Down
1 change: 1 addition & 0 deletions sonar/modules/organisations/marshmallow/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class OrganisationMetadataSchemaV1(StrictKeysMixin):
code = SanitizedUnicode(required=True)
name = SanitizedUnicode(required=True)
description = fields.List(fields.Dict())
footer = fields.List(fields.Dict())
isShared = fields.Boolean()
isDedicated = fields.Boolean()
allowedIps = SanitizedUnicode()
Expand Down
1 change: 1 addition & 0 deletions sonar/modules/organisations/serializers/schemas/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class ExportSchemaV1(Schema):
code = fields.String(dump_only=True)
name = fields.String(dump_only=True)
description = fields.List(fields.Dict(dump_only=True))
footer = fields.List(fields.Dict(dump_only=True))
isShared = fields.Boolean(dump_only=True)
isDedicated = fields.Boolean(dump_only=True)
files = fields.Method('get_files', dump_only=True)
Expand Down
27 changes: 22 additions & 5 deletions sonar/theme/templates/sonar/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,19 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#}

<footer id="footer" class="bg-light mt-5">
<footer id="footer" class="mt-5">
<div class="container">
<div class="row justify-content-center align-items-center">
<div class="col-lg-8 py-4 py-lg-5 text-center text-lg-left">
{% if g.get('organisation', {}).get('isDedicated') and g.organisation.get('footer') %}
<div class="row justify-content-center align-items-center bg-light">
<div class="col py-4 py-lg-5 text-center text-lg-left">
<div class="d-lg-flex flex-row">
{{ g.organisation.footer | language_value | markdown_filter | safe }}
</div>
</div>
</div>
{% else %}
<div class="row justify-content-center align-items-center bg-light">
<div class="col py-4 py-lg-5 text-center text-lg-left">
<div class="d-lg-flex flex-row">
<div>
<a href="{{ url_for('wiki.index') }}">{{ _('Help & Documentation') }}</a>
Expand All @@ -37,8 +46,16 @@
</div>
</div>
</div>
<div class="col-lg-4 py-2 py-lg-5 text-center text-lg-right">
{% trans link="https://www.rero.ch" %}Powered by <a href="{{ link }}" target="_blank" rel="noopener">RERO</a>{% endtrans %}
</div>
{% endif %}
<div class="row justify-content-center align-items-center mt-2">
<div class="col text-center p-0">
<div class="d-lg-flex flex-row">
<div class="col-lg text-center text-lg-right">
{% set link = 'https://www.rero.ch/de/products/sonar' if current_i18n.locale.language == 'de' else 'https://www.rero.ch/produits/sonar' %}
{% trans %}Powered by <a href="{{ link }}" target="_blank" rel="noopener">SONAR</a>{% endtrans %}
</div>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit ed213c8

Please sign in to comment.