From 34ecce4842702f7ef412ea3682eb4fbde28809d8 Mon Sep 17 00:00:00 2001 From: rekt-hard <72449192+rekt-hard@users.noreply.github.com> Date: Thu, 6 May 2021 09:46:25 +0200 Subject: [PATCH] ui: display access badge index: UIJSONSerializer is used in order to serialize the elasticsearch results --- .../templates/invenio_theme_tugraz/index.html | 5 +++++ invenio_theme_tugraz/views.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html index 30d1d20..0a5e249 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html @@ -66,6 +66,11 @@ {{r.metadata.resource_type | cast_to_dict | vocabulary_title('resource_type') }} + + + {% if r.ui.access_status.icon %}{% endif %} + {{ r.ui.access_status.title_l10n }} + diff --git a/invenio_theme_tugraz/views.py b/invenio_theme_tugraz/views.py index 38aa4f8..a9e86c6 100644 --- a/invenio_theme_tugraz/views.py +++ b/invenio_theme_tugraz/views.py @@ -63,9 +63,13 @@ def ui_blueprint(app): def index(): """Frontpage.""" + records = FrontpageRecordsSearch()[:5].sort("-created").execute() + for r in records: + r = UIJSONSerializer().serialize_object_to_dict(r.to_dict()) + return render_template( "invenio_theme_tugraz/index.html", - records=FrontpageRecordsSearch()[:5].sort("-created").execute(), + records=records )