From fb906bda72cdc0a12f977e413f39f34dc91f2b69 Mon Sep 17 00:00:00 2001 From: mb-wali Date: Mon, 31 May 2021 16:46:14 +0200 Subject: [PATCH] global: refactor upon release changes resource_type: change in index and values of resource type. func: that will serialize list of records. --- .../templates/invenio_theme_tugraz/index.html | 4 ++-- invenio_theme_tugraz/views.py | 12 +++++++++--- invenio_theme_tugraz/webpack.py | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html index 424ca0f..ffc6bba 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html @@ -64,9 +64,9 @@ - {{r.metadata.resource_type | cast_to_dict | vocabulary_title('resource_type') }} + {{ r.ui.resource_type.title_l10n }} - + {% 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 b8fa9cd..4ac0c95 100644 --- a/invenio_theme_tugraz/views.py +++ b/invenio_theme_tugraz/views.py @@ -61,15 +61,21 @@ def ui_blueprint(app): return blueprint +def records_serializer(records=None): + """Serialize list of records.""" + record_list = [] + for record in records: + record_list.append(UIJSONSerializer().serialize_object_to_dict(record.to_dict())) + return record_list + + 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=records + records=records_serializer(records) ) diff --git a/invenio_theme_tugraz/webpack.py b/invenio_theme_tugraz/webpack.py index 4fb8f5c..070f241 100644 --- a/invenio_theme_tugraz/webpack.py +++ b/invenio_theme_tugraz/webpack.py @@ -30,7 +30,7 @@ theme = WebpackThemeBundle( 'prop-types': '^15.7.2', 'react-dnd': '^11.1.3', 'react-dnd-html5-backend': '^11.1.3', - 'react-invenio-deposit': '^0.13.5', + 'react-invenio-deposit': '^0.14.0', 'react-invenio-forms': '^0.7.0', 'react-dropzone': "^11.0.3", 'yup': '^0.27.0',