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

add organisation name on the title tag #2571

Merged
merged 1 commit into from
Dec 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
5 changes: 5 additions & 0 deletions rero_ils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 171,10 @@ def _(x):
#: Admin base template
# ADMIN_BASE_TEMPLATE = BASE_TEMPLATE

# Google
# =======================
# THEME_GOOGLE_SITE_VERIFICATION = []

# Miscellaneous variable around templates
# =======================
#: Template for security pages.
Expand Down Expand Up @@ -1727,6 1731,7 @@ def _(x):
# Default view code for all organisations view
# TODO: Should be taken into angular
RERO_ILS_SEARCH_GLOBAL_VIEW_CODE = 'global'
RERO_ILS_SEARCH_GLOBAL_NAME = _('Global catalog')

# Default number of results in facet
RERO_ILS_DEFAULT_AGGREGATION_SIZE = 30
Expand Down
3 changes: 2 additions & 1 deletion rero_ils/theme/templates/rero_ils/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 48,8 @@
{%- endblock head_meta %}
{%- block head_title %}
{%- set title = title or _(config.THEME_SITENAME) or _('Invenio') %}
<title>{{title}}</title>
{%- set org_name = _(viewcode | viewOrganisationName) -%}
<title>{{ title }}: {{ org_name }}</title>
{%- endblock head_title %}
{%- block head_links %}
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" />
Expand Down
13 changes: 11 additions & 2 deletions rero_ils/theme/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 28,8 @@
from invenio_jsonschemas import current_jsonschemas
from invenio_jsonschemas.errors import JSONSchemaNotFound

from rero_ils.modules.organisations.api import Organisation

from .menus import init_menu_lang, init_menu_profile, init_menu_tools
from ..modules.organisations.api import Organisation
from ..permissions import can_access_professional_view

blueprint = Blueprint(
Expand Down Expand Up @@ -151,6 150,16 @@ def url_active(string, target):
return string


@blueprint.app_template_filter('viewOrganisationName')
def view_organisation_name(viewcode):
"""Get view name."""
if viewcode != current_app.config.get('RERO_ILS_SEARCH_GLOBAL_VIEW_CODE'):
org = Organisation.get_record_by_viewcode(viewcode)
if org:
return org['name']
return current_app.config.get('RERO_ILS_SEARCH_GLOBAL_NAME', '')


def prepare_jsonschema(schema):
"""Json schema prep."""
schema = copy.deepcopy(schema)
Expand Down