Metadata-Version: 2.4
Name: Invenio-Community-Themes-TUW
Version: 2026.0.0
Summary: Invenio extension for community themes
Project-URL: Repository, https://gitlab.tuwien.ac.at/crdm/invenio-community-themes-tuw
Author-email: "Team of the Center for Research Data Management (TU Wien)" <tudata@tuwien.ac.at>
License-Expression: MIT
License-File: AUTHORS.rst
License-File: LICENSE
Keywords: communities,community themes,invenio,tu wien
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.12
Requires-Dist: invenio-app-rdm>=13.0.0
Provides-Extra: tests
Requires-Dist: invenio-search>=2.0.0; extra == 'tests'
Requires-Dist: opensearch-dsl>=2.1.0; extra == 'tests'
Requires-Dist: opensearch-py~=2.0; extra == 'tests'
Requires-Dist: pytest-black>=0.3.0; extra == 'tests'
Requires-Dist: pytest-invenio>=3; extra == 'tests'
Requires-Dist: pytest-ruff>=0.4.1; extra == 'tests'
Requires-Dist: setuptools<82; extra == 'tests'
Description-Content-Type: text/x-rst

..
    SPDX-License-Identifier: MIT
    SPDX-FileCopyrightText: 2026 TU Wien


=============================
 Invenio-Community-Themes-TUW
=============================

Definitions and assets for themed communities at TU Wien.



The themed communities feature in InvenioRDM
============================================

Since version 13, InvenioRDM allows `communities to be themed <https://inveniordm-dev.docs.cern.ch/operate/customize/look-and-feel/themed_communities/>`__.

Under the hood, it works by registering the `CommunityThemeJinjaLoader <https://github.com/inveniosoftware/invenio-communities/blob/maint-20.x/invenio_communities/views/template_loader.py>`__ for community view functions.
This is a custom Jinja template loader that renders alternative templates from a directory based on the community's theme ``brand``.
If either of the templates involved in the rendering chain doesn't have such an override, the "normal" template will be rendered instead.
Thus, it is possible to selectively override any Jinja template involved in the rendering of a community by simply placing the desired templates in the correct path (with a ``themes/${BRAND}/`` prefix).

For instance, the standard header template for communities is located under ``templates/semantic-ui/invenio_communities/details/header.html``.
If one wants to provide a custom template for a community with the ``meretneith`` brand, it would be placed under: ``templates/themes/meretneith/invenio_communities/details/header.html`` (the ``semantic-ui`` part can be omitted).

The theme for a community (including the ``brand`` and a limited set of custom ``style``) can be set via the ``invenio shell`` REPL, with code snippets described in the `InvenioRDM documentation <https://inveniordm-dev.docs.cern.ch/operate/customize/look-and-feel/themed_communities/>`__, or below.

If Jinja template overrides and the limited styling is enough, then adding the templates to the InvenioRDM project definition will be sufficient.
However, if extra CSS styling or custom JS is required, then it will become necessary to use mechanisms only available to extensions like this one here, or the project's local ``site/`` package.



Provided community themes
=========================

The following community themes are provided by this package:


Meret Neith
-----------

The Meret Neith community holds datasets from excavations of the tomb of the Egyptian queen from whom the community gets its name.
Thus, the community's theme is inspired by Egypt and desert.

We have instantiated the community theme's style into the custom CSS that gets loaded by the base template.
As such, the ``style`` key can be omitted when setting the community's theme:

.. code-block:: python

    from invenio_communities.proxies import current_communities
    from invenio_access.permissions import system_identity

    service = current_communities.service
    meretneith = service.read(system_identity, "meretneith")
    meretneith_theme = {
      "theme": {
         "brand": "meretneith",
         "enabled": True,
      }
    }

    service.update(system_identity, "meretneith", {**meretneith.data, **meretneith_theme})
