diff --git a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/overrides.less b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/overrides.less index 1ceb574..fc11edb 100644 --- a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/overrides.less +++ b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/overrides.less @@ -150,7 +150,6 @@ pre { &.metadata-only { background-color: @accessRightMetadata; } - } @font-face { @@ -166,3 +165,15 @@ pre { font-weight: 400; font-style: italic; } + +/** + * mainly for the overview. maybe this should be written more specific to apply + * only for the overview use case. + */ +.ui.segment:first-child { + margin-top: 1em; +} + +.ui.equal.height .ui.segment { + height: 100%; +} diff --git a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/theme.less b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/theme.less index 7a144b3..006af3b 100644 --- a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/theme.less +++ b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/theme.less @@ -37,3 +37,7 @@ .nowrap-link { white-space: nowrap; } + +.ui.label.schema { + border: 1px solid #bfb5b5; +} diff --git a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/variables.less b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/variables.less index 02d8ab9..37824d1 100644 --- a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/variables.less +++ b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/variables.less @@ -23,6 +23,8 @@ @accessRightClosed : @accessRightEmbargoed; @accessRightMetadata : #2185D0; +@schema: #17b3f3; + // primary colors TU Graz @tugrazBlack: #231f20; @tugrazRed : #e4154b; diff --git a/invenio_theme_tugraz/search.py b/invenio_theme_tugraz/search.py index a12d6ed..fbdbfb8 100644 --- a/invenio_theme_tugraz/search.py +++ b/invenio_theme_tugraz/search.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2020-2021 Graz University of Technology. +# Copyright (C) 2020-2023 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 @@ -9,7 +9,6 @@ """Frontpage records.""" from invenio_search.api import RecordsSearch -from invenio_search.engine import dsl class FrontpageRecordsSearch(RecordsSearch): @@ -18,8 +17,4 @@ class FrontpageRecordsSearch(RecordsSearch): class Meta: """Default index and filter for frontpage search.""" - index = "rdmrecords-records" - default_filter = dsl.Q( - "query_string", - query=("access.record:public " "AND versions.is_latest:true"), - ) + index = "dublin-core" diff --git a/invenio_theme_tugraz/static/images/cyan_400x400.png b/invenio_theme_tugraz/static/images/cyan_400x400.png new file mode 100644 index 0000000..bee4fad Binary files /dev/null and b/invenio_theme_tugraz/static/images/cyan_400x400.png differ diff --git a/invenio_theme_tugraz/static/images/dark_blue_400x400.png b/invenio_theme_tugraz/static/images/dark_blue_400x400.png new file mode 100644 index 0000000..e6be001 Binary files /dev/null and b/invenio_theme_tugraz/static/images/dark_blue_400x400.png differ diff --git a/invenio_theme_tugraz/static/images/light_green_400x400.png b/invenio_theme_tugraz/static/images/light_green_400x400.png new file mode 100644 index 0000000..791f4fa Binary files /dev/null and b/invenio_theme_tugraz/static/images/light_green_400x400.png differ diff --git a/invenio_theme_tugraz/static/images/red_400x400.png b/invenio_theme_tugraz/static/images/red_400x400.png new file mode 100644 index 0000000..9eb3e68 Binary files /dev/null and b/invenio_theme_tugraz/static/images/red_400x400.png differ diff --git a/invenio_theme_tugraz/static/images/rosa_400x400.png b/invenio_theme_tugraz/static/images/rosa_400x400.png new file mode 100644 index 0000000..de4784e Binary files /dev/null and b/invenio_theme_tugraz/static/images/rosa_400x400.png differ diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/frontpage_overview.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/frontpage_overview.html new file mode 100644 index 0000000..acad57f --- /dev/null +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/frontpage_overview.html @@ -0,0 +1,104 @@ +{# + Copyright (C) 2020-2023 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. +#} + +
+
+
+
+

{{ _("Research Result") }}

+ +
+ this is a short description for what research results could be found in this repository. there are three links. + one link will lead you to a browse functionality which shows what is inside of the repository. one link will + lead you to the search page which gives the possibility to search explicitly in the research results. the last + link leads to the upload page to upload new research results to the repository +
+ + + +
+
+
+
+

{{ _("Communities") }}

+
+ this short description shows what communities represents in the repository. there are three links. one will + lead to the browsing feature, one to the search functionality and the last to the creation side. +
+ + + +
+
+
+
+

{{ _("Publications") }}

+ +
+ this short description describes what publication means within this repository. there are two links. one lead + to a browse function and one to the search. publications are not meant to be open for everyone, but for + librarians only. +
+ + + +
+
+
+
+

{{ _("OER") }}

+ +
+ this short description describes what OER's are. there are three links. as the others already introduced there + is a link to the browse functionality, one to the search and one to the upload. about the upload you get more + information what is necessary to be allowed to upload if you click on the upload button. +
+ + + +
+
+
+
diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/header.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/header.html index 51bb619..3f37126 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/header.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/header.html @@ -1,5 +1,5 @@ {# - Copyright (C) 2020-2021 Graz University of Technology. + Copyright (C) 2020-2023 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 @@ -37,24 +37,17 @@ transform="translate(-279.72 -403.28)"> - {{_ ("Home")}} + {{ _("Home") }} - - - {%- for item in current_menu.submenu('main').children|sort(attribute='order') if item.visible recursive %} -
- {{ item.text|safe }} -
- {% endfor %} - - {% for item in current_menu.submenu('actions').children|sort(attribute='order') if item.visible recursive %} -
- {{ item.text|safe }} -
- {% endfor %} +
+ {{ _("Communities") }} +
+
+ {{ _("My dashboard") }} +
diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html index 9ffb2d0..3960fdf 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html @@ -12,8 +12,6 @@ {{ webpack['invenio-theme-tugraz-js.js'] }} {%- endblock javascript %} -{%- from "invenio_theme_tugraz/macros/authors.html" import creators -%} - {%- block page_body %}
@@ -21,91 +19,13 @@
- -
-

{{ _('Recent uploads') }}

- - {% if not records %} -
-

{{ _('There are no public records to show.') }}

-
- {% endif %} - - {%- for r in records %} - {%- set creation_date = r.created|from_isodatetime -%} - {%- set record_url = url_for('invenio_app_rdm_records.record_detail', pid_value=r.id) %} - -
- -
- - - {{ r.metadata.publication_date }} {{ '(' ~ r.metadata.version ~ ')' if r.metadata.version }} - - - - - {{ r.ui.resource_type.title_l10n }} - - - - {% if r.ui.access_status.icon %}{% endif %} - {{ r.ui.access_status.title_l10n }} - - - - - -
- -

- - {{ r.metadata.title }} - -

- -

- {{ creators(r.metadata.creators) }} -

- - - -
-
-
- {%- for s in r.metadata.subjects %} -
{{ s.subject }}
- {%- endfor %} -
- - {% trans user=userprofile, date=creation_date | dateformat('long')%} - Uploaded on {{date}} - {% endtrans %} - -
-
- -
-
-
- - {%- endfor %} - {% if records %} - - {%- endif %} -
+ {% include "invenio_theme_tugraz/frontpage_overview.html" %} + {% include "invenio_theme_tugraz/recent_uploads.html" %}
+ {#

{{ _("You can upload different types of records:") }}

@@ -134,6 +54,7 @@
+ #}
diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html index ffb782d..9eac9d6 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html @@ -1,5 +1,5 @@ {# - Copyright (C) 2020-2022 Graz University of Technology. + Copyright (C) 2020-2023 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 @@ -9,12 +9,12 @@ {% set options = [ { "key": "records", - "text": _("All") + " " + config.THEME_SITENAME, + "text": _("All"), "value": url_for("invenio_search_ui.search"), "title": "repo", },{ "key": "rdm", - "text": _("Research Data"), + "text": _("Research Results"), "value": "/records/search", "title": "Research Data", },{ diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/overview.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/overview.html new file mode 100644 index 0000000..e692087 --- /dev/null +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/overview.html @@ -0,0 +1,76 @@ +{# + Copyright (C) 2020-2023 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. +#} + +{%- extends config.INVENIO_THEME_TUGRAZ_BASE_TEMPLATE %} + +{%- set active_dashboard_menu_item = 'overview' %} +{%- set title = _("Overview") %} + +{%- block page_body %} + {%- block user_dashboard_header %} + {% include "invenio_app_rdm/users/header.html" %} + {%- endblock user_dashboard_header %} + +
+

Overview

+ + +
+
+
+

{{ _("Research Result") }}

+
+ Research Result +
+
+ describe research results +
+
+
+
+
+

{{ _("Communities") }}

+ Communities +
+ describe the communities +
+
+
+
+
+

{{ _("Requests") }}

+ Requests + +
+ describe requests +
+
+
+
+
+

{{ _("Publications") }}

+ Publications +
+ describe publications +
+
+
+
+
+

{{ _("OER") }}

+ Open Educational Resources + +
+ describe open educational resources +
+
+
+
+
+ +{%- endblock %} diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/recent_uploads.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/recent_uploads.html new file mode 100644 index 0000000..03b6c8b --- /dev/null +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/recent_uploads.html @@ -0,0 +1,101 @@ +{# + Copyright (C) 2020-2023 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. +#} + + +
+

{{ _("Recent uploads") }}

+ + {% if not records %} +
+

{{ _("There are no public records to show.") }}

+
+ {% endif %} + + {%- for r in records %} + {%- set creation_date = r.created | from_isodatetime -%} + {%- set record_url = r.original.view %} + +
+
+ + + {{ r.metadata.dates[0] }} + + + + + {%- for type in r.metadata.types %} + {{ type }} + {%- endfor %} + + + + + + {{ r.access_status.title_l10n }} + + + + {%- if r.original.schema == "lom" %} + {{ _("OER") }} + {%- elif r.original.schema == "rdm" %} + {{ _("Research Result") }} + {%- elif r.original.schema == "marc21" %} + {{ _("Publication") }} + {%- endif %} + +
+ +

+ + {{ r.metadata.titles[0] }} + +

+ +

+ {%- for creator in r.metadata.creators %} + {{ creator }} + {%- endfor %} +

+ + + +
+
+
+ {%- for subject in r.metadata.subjects %} +
{{ subject }}
+ {%- endfor %} +
+ + {# + {% trans user=userprofile, date=creation_date | dateformat("long")%} + Uploaded on {{date}} + {% endtrans %} + #} + +
+
+ +
+
+
+ + {%- endfor %} + + {% if records %} + + {%- endif %} +
diff --git a/invenio_theme_tugraz/views.py b/invenio_theme_tugraz/views.py index d7d88d4..628836f 100644 --- a/invenio_theme_tugraz/views.py +++ b/invenio_theme_tugraz/views.py @@ -10,8 +10,14 @@ from typing import Dict -from flask import Blueprint, render_template -from invenio_rdm_records.resources.serializers import UIJSONSerializer +from flask import Blueprint, g, render_template +from flask_login import current_user, login_required +from flask_menu import current_menu +from invenio_i18n import lazy_gettext as _ + +# from invenio_rdm_records.resources.serializers import UIJSONSerializer +from invenio_records_dublin_core.resources.serializers import DublinCoreJSONSerializer +from invenio_users_resources.proxies import current_user_resources from opensearch_dsl.utils import AttrDict from .search import FrontpageRecordsSearch @@ -24,6 +30,19 @@ blueprint = Blueprint( ) +@blueprint.route("/me/overview") +@login_required +def overview(): + """Overview.""" + url = current_user_resources.users_service.links_item_tpl.expand( + g.identity, current_user + )["avatar"] + return render_template( + "invenio_theme_tugraz/overview.html", + user_avatar=url, + ) + + @blueprint.app_template_filter("make_dict_like") def make_dict_like(value: str, key: str) -> Dict[str, str]: """Convert the value to a dict like structure. @@ -39,6 +58,32 @@ def cast_to_dict(attr_dict): return AttrDict.to_dict(attr_dict) +@blueprint.before_app_first_request +def modify_user_dashboard(): + """Modify user dashboard.""" + user_dashboard_menu = current_menu.submenu("dashboard") + + # order matters, this has to be here, otherwise it want override the orginal + # entry + user_dashboard_menu.submenu("uploads").register( + "invenio_app_rdm_users.uploads", + text=_("Research Results"), + order=1, + ) + + user_dashboard_menu.submenu("overview").register( + "invenio_theme_tugraz.overview", + text=_("Overview"), + order=0, + ) + + current_menu.submenu("actions.deposit").register( + "invenio_theme_tugraz.overview", + _("My dashboard"), + order=1, + ) + + def ui_blueprint(app): """Blueprint for the routes and resources provided by Invenio-theme-tugraz.""" routes = app.config.get("TUG_ROUTES") @@ -51,10 +96,8 @@ def ui_blueprint(app): def records_serializer(records=None): """Serialize list of records.""" - record_list = [] - for record in records: - record_list.append(UIJSONSerializer().dump_obj(record.to_dict())) - return record_list + serializer = DublinCoreJSONSerializer() + return [serializer.dump_obj(r.to_dict()) for r in records] def index():