From 90bd39a01075aef0ee2f3068812dedaa482d581b Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Mon, 11 Jan 2021 15:52:56 +0100 Subject: [PATCH 1/2] modification(ui): use invenio-app-rdm/landing_page to update landing_page --- .../less/invenio_theme_tugraz/record.less | 15 ++++ invenio_theme_tugraz/config.py | 7 +- .../record_landing_page.html | 90 +++++++++---------- 3 files changed, 61 insertions(+), 51 deletions(-) diff --git a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/record.less b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/record.less index 45a8764..c3d53ba 100644 --- a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/record.less +++ b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/record.less @@ -9,3 +9,18 @@ color: #e9711c; float: right; } + +.title .dropdown { + display: none; +} + +.top-bottom-padded { + margin: unset; +} + +.label.label-keyword { + font-size: 0.71428571rem; + font-weight: 400; + background-color: #E8E8E8; + border: unset; +} diff --git a/invenio_theme_tugraz/config.py b/invenio_theme_tugraz/config.py index 320ee00..ca52490 100644 --- a/invenio_theme_tugraz/config.py +++ b/invenio_theme_tugraz/config.py @@ -9,6 +9,7 @@ """invenio module for TUGRAZ theme.""" from flask_babelex import gettext as _ +from invenio_app_rdm.config import RECORDS_UI_ENDPOINTS INVENIO_THEME_TUGRAZ_DEFAULT_VALUE = _("TU Graz Repository") """Default value for the application.""" @@ -90,7 +91,7 @@ DEPOSITS_HEADER_TEMPLATE = "invenio_theme_tugraz/header.html" # See https://invenio-rdm-records.readthedocs.io/en/latest/configuration.html # Uncomment below to override records landingpage. # from invenio_rdm_records.config import RECORDS_UI_ENDPOINTS -# RECORDS_UI_ENDPOINTS["recid"].update( -# template="invenio_theme_tugraz/record_landing_page.html" -# ) +RECORDS_UI_ENDPOINTS["recid"].update( + template="invenio_theme_tugraz/record_landing_page.html" +) """override the default record landing page""" diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/record_landing_page.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/record_landing_page.html index 084f4a5..612d47b 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/record_landing_page.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/record_landing_page.html @@ -13,89 +13,82 @@ {%- block css %} {{ super() }} -{{ webpack['invenio-rdm-records-theme.css'] }} {%- endblock css %} -{%- from "invenio_rdm_records/macros/files.html" import file_list_box, preview_file_box %} +{%- from "invenio_app_rdm/landing_page/macros/files.html" import file_list_box, preview_file_box %} +{%- from "invenio_app_rdm/landing_page/macros/detail.html" import show_detail %} + +{%- set record = record|dereference_record|serialize_ui %} +{%- set metadata = record.metadata %} {%- block page_body %} +
{%- block record_body %} -
- - {{ record.publication_date|to_date|format_date(format='long') }} +
+ + {{ record.metadata.publication_date }} {{ '(' ~ record.metadata.version ~ ')' if record.metadata.version }} - - Version {{ record.version }} - - - - {{ record.resource_type | vocabulary_title('resource_type') }} + + + {{record.ui.resource_type }}
-

{{ record.titles[0].title }}

-

- {%- include "invenio_rdm_records/details/creators.html" %} -

+

{{ record.metadata.title }}

+

{%- include "invenio_app_rdm/landing_page/details/creators.html" %}

+

{%- include "invenio_app_rdm/landing_page/details/contributors.html" %}

- {%- if record.contributors %} -

- {%- include "invenio_rdm_records/details/contributors.html" %} -

- {%- endif %} - -
+
- {%- include "invenio_theme_tugraz/details/doi.html" %} + {%- for s in record.metadata.subjects %} +
{{s.subject}}
+ {%- endfor %} +
+ Created: {{ record.ui.created_date_l10n_long }} | Modified: {{ record.ui.updated_date_l10n_long }} +
- {# - {%- include "invenio_rdm_records/details/contact.html" %} - #} - - {{ record | vocabulary_title('access_right') | lower_case }} + + {{ record.access.access_right | make_dict_like('access_right') | vocabulary_title('access_right') }} + {%- for right in record.metadata.rights %} + {{ '(' ~ right.identifier ~ ')' }} + {%- endfor %} +
- {%- include "invenio_rdm_records/details/citation.html" %} - {%- include "invenio_rdm_records/details/keywords.html" %} - {%- include "invenio_rdm_records/details/description.html" %} - {%- include "invenio_rdm_records/details/licenses.html" %} + {%- include "invenio_app_rdm/landing_page/details/description.html" %} + {# files #} {%- if record.files and record | can_list_files %} - {%- set files = record.files %} - {{ preview_file_box(files | select_preview_file, pid) }} - {{ file_list_box(files.dumps(), pid) }} - {%- else %} -
- -

- No associated files. -

+ {%- set files = record.files | make_files_preview_compatible %} + {%- set default_preview_file = files | select_preview_file(default_preview=record.files.default_preview) %} + {{ preview_file_box(default_preview_file, pid) }} + {{ file_list_box(files, pid) }} {% endif %} - {# More details #} - {%- endblock record_body %}
- {% block sidebar %} -
- {%- include "invenio_rdm_records/details/side_bar.html" %} +
+ {% block sidebar %} + {%- include "invenio_app_rdm/landing_page/details/side_bar.html" %} {% endblock sidebar %}
@@ -106,8 +99,9 @@ {%- block javascript %} {{ super() }} -{{ webpack['invenio-rdm-records-js.js'] }} +{{ webpack['invenio-app-rdm-records.js'] }} {# Communities management #} {{ webpack['invenio-communities-records.js'] }} -{{webpack['previewer_theme.js']}} +{{ webpack['previewer_theme.js'] }} +{{ webpack['invenio-app-rdm-record-management.js'] }} {%- endblock javascript %} From c6c4a0aa52397bb85500c1e087c3545fc77bcac8 Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Thu, 14 Jan 2021 11:14:30 +0100 Subject: [PATCH 2/2] bugfix(ci): add invenio-app-rdm and sqlalchemy-continuum to install_requires those install_requires where missing to use the RECORDS_UI_ENPOINTS from invenio-app-rdm.config --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 91e09ab..5530fb7 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ history = open("CHANGES.rst").read() tests_require = [ "pytest-invenio>=1.4.0", - 'invenio-app>=1.3.0,<2.0.0', + "invenio-app>=1.3.0,<2.0.0", "psycopg2-binary>=2.8.6", ] @@ -53,6 +53,8 @@ install_requires = [ "invenio-i18n>=1.2.0", "elasticsearch_dsl>=7.2.1", "invenio_search>=1.3.1", + "invenio_app_rdm>=0.18.8", + "sqlalchemy-continuum>=1.3.11", ] packages = find_packages()