From 1598b04ed6d4330ce896b016e9e5d69fa99e9cb9 Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Mon, 21 Dec 2020 15:00:42 +0100 Subject: [PATCH 1/4] feature(ui): override the default search react app from invenio-app-rdm The look of the result entries should now be the same as on the frontpage. The main difference from the default layout is that the access badge is not more a badge. It is now in the footer on the right side. The main reason is that the green color of the badge could lead to the wrong conclusion that if this record has the access right "Open Acess" it would be a "Green Open Access" record. NOTES: It was necessary to import also some React classes into the components.js file which were not really overriden. This was because it was not possible to import it from invenio-app-rdm/search/components.js directly. This should be repaired in some ways. --- .../invenio_theme_tugraz/search/components.js | 321 ++++++++++++++++++ .../js/invenio_theme_tugraz/search/index.js | 30 ++ .../less/invenio_theme_tugraz/search.less | 28 ++ .../less/invenio_theme_tugraz/theme.less | 1 + invenio_theme_tugraz/config.py | 3 + .../invenio_theme_tugraz/search.html | 82 +++++ invenio_theme_tugraz/webpack.py | 1 + 7 files changed, 466 insertions(+) create mode 100644 invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/search/components.js create mode 100644 invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/search/index.js create mode 100644 invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/search.less create mode 100644 invenio_theme_tugraz/templates/invenio_theme_tugraz/search.html diff --git a/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/search/components.js b/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/search/components.js new file mode 100644 index 0000000..0f1fee7 --- /dev/null +++ b/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/search/components.js @@ -0,0 +1,321 @@ +/* + * Copyright (C) 2020 CERN. + * Copyright (C) 2020 Northwestern University. + * Copyright (C) 2020 Graz University of Technology + * + * invenio-theme-tugraz is free software; you can redistribute it + * and/or modify it under the terms of the MIT License; see LICENSE + * file for more details. + * + * origin: invenio_app_rdm/search/components.js + */ + +import React, { useState } from "react"; +import { Card, Item, Input, Label, Button, Grid, Checkbox, List, } from "semantic-ui-react"; +import { BucketAggregation, Toggle } from "react-searchkit"; +import _ from "lodash"; +import _truncate from "lodash/truncate"; +import Overridable from "react-overridable"; +import { SearchBar } from "@js/invenio_search_ui/components"; + +export const RDMRecordResultsListItem = ({ result, index }) => { + const description = _.get(result, "metadata.description", "No description"); + const version = _.get(result, "metadata.version", ""); + const creators = _.get(result, "metadata.creators", []); + const title = _.get(result, "metadata.title", "No title"); + const subjects = _.get(result, "metadata.subjects", null); + + const publicationDate = _.get(result, "ui.publication_date_l10n_long", "No publication date found"); + const createdDate = _.get(result, "ui.created_date_l10n_long", "No creation date found."); + const resourceType = _.get(result, "ui.resource_type", "No resource type"); + const access = _.get(result, "ui.access_right.title", "No access rights"); + const accessRightCategory = _.get(result, "ui.access_right.category", "closed"); + const accessRightIcon = _.get(result, "ui.access_right.icon", "closed"); + const accessRight = {type: access, category: accessRightCategory, icon: accessRightIcon}; + + const href = `/records/${result.id}`; + + return ( + + +
+ + +
+ {title} + + + {_truncate(description.replace(/(<([^>]+)>)/ig, ''), { length: 350 })} + +