From 69cf03362a638c21d5b355700c321eabeea03c9b Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Sun, 8 Oct 2023 23:01:51 +0200 Subject: [PATCH 1/9] global: make it compatible with v12 --- invenio_theme_tugraz/config.py | 4 ++-- setup.cfg | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/invenio_theme_tugraz/config.py b/invenio_theme_tugraz/config.py index 52e141f6..1c760bc6 100644 --- a/invenio_theme_tugraz/config.py +++ b/invenio_theme_tugraz/config.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 @@ -8,7 +8,7 @@ """invenio module for TUGRAZ theme.""" -from flask_babelex import gettext as _ +from invenio_i18n import gettext as _ INVENIO_THEME_TUGRAZ_DEFAULT_VALUE = _("TU Graz Repository") """Default value for the application.""" diff --git a/setup.cfg b/setup.cfg index 08b853ac..7f3cf1b4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -33,17 +33,16 @@ classifiers = [options] include_package_data = True packages = find: -python_requires = >=3.8 +python_requires = >=3.9 zip_safe = False install_requires = - flask-babel>=2,<3 - invenio-assets>=2.0.0,<3.0.0 - invenio-i18n>=1.3.1,<1.4.0 - invenio_config_tugraz>=0.11.0,<0.12.0 + invenio-assets>=2.0.0 + invenio-i18n>=1.3.1 + invenio_config_tugraz>=0.11.0 [options.extras_require] tests = - pytest-black>=0.3.0 + pytest-black-ng>=0.4.0 Sphinx>=4.5.0 pytest-invenio>=2.1.0,<3.0.0 invenio-app>=1.3.4,<1.4.0 From ffcc577e4f344fe56681e6ecd7006ce2bad30cc4 Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Sun, 8 Oct 2023 23:03:07 +0200 Subject: [PATCH 2/9] theme: add separate search entry for rdm --- .../templates/invenio_theme_tugraz/navbar.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html index 62c66c56..ffb782dc 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html @@ -12,6 +12,11 @@ "text": _("All") + " " + config.THEME_SITENAME, "value": url_for("invenio_search_ui.search"), "title": "repo", + },{ + "key": "rdm", + "text": _("Research Data"), + "value": "/records/search", + "title": "Research Data", },{ "key": "marc21", "text": _("Publications"), From 8a76cb83a96fd59ddbb62676881272eddd2f6f78 Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Tue, 17 Oct 2023 23:19:45 +0200 Subject: [PATCH 3/9] layout: improve * add frontpage overview * change recent uploads to global search * add overview to dashboard * change default link of the dashboard menu entry from uploads to overview * change text of 'my uploads' buggy --- .../less/invenio_theme_tugraz/overrides.less | 13 ++- .../less/invenio_theme_tugraz/theme.less | 4 + .../less/invenio_theme_tugraz/variables.less | 2 + invenio_theme_tugraz/search.py | 9 +- .../static/images/cyan_400x400.png | Bin 0 -> 1534 bytes .../static/images/dark_blue_400x400.png | Bin 0 -> 1535 bytes .../static/images/light_green_400x400.png | Bin 0 -> 1534 bytes .../static/images/red_400x400.png | Bin 0 -> 1532 bytes .../static/images/rosa_400x400.png | Bin 0 -> 1534 bytes .../frontpage_overview.html | 104 ++++++++++++++++++ .../invenio_theme_tugraz/header.html | 29 ++--- .../templates/invenio_theme_tugraz/index.html | 87 +-------------- .../invenio_theme_tugraz/navbar.html | 6 +- .../invenio_theme_tugraz/overview.html | 76 +++++++++++++ .../invenio_theme_tugraz/recent_uploads.html | 101 +++++++++++++++++ invenio_theme_tugraz/views.py | 55 ++++++++- 16 files changed, 365 insertions(+), 121 deletions(-) create mode 100644 invenio_theme_tugraz/static/images/cyan_400x400.png create mode 100644 invenio_theme_tugraz/static/images/dark_blue_400x400.png create mode 100644 invenio_theme_tugraz/static/images/light_green_400x400.png create mode 100644 invenio_theme_tugraz/static/images/red_400x400.png create mode 100644 invenio_theme_tugraz/static/images/rosa_400x400.png create mode 100644 invenio_theme_tugraz/templates/invenio_theme_tugraz/frontpage_overview.html create mode 100644 invenio_theme_tugraz/templates/invenio_theme_tugraz/overview.html create mode 100644 invenio_theme_tugraz/templates/invenio_theme_tugraz/recent_uploads.html 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 1ceb574f..fc11edb0 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 7a144b38..006af3b4 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 02d8ab91..37824d1c 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 a12d6ed8..fbdbfb8c 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 0000000000000000000000000000000000000000..bee4fad1f26848b818f051112d16013244174116 GIT binary patch literal 1534 zcmeAS@N?(olHy`uVBq!ia0y~yV4MKL985qF{<{lj134|3&dvdz&dv%2Mfqu&IjIZ` z8WU?L+Ik!g5NY*~UK*sORJP&KgoRc&U0r3eMY{qNuW+rknz82#|11*~O})OR?1KmA zA6?bly?Gtqx+aAm%#U6@TJl0k_1<)ms3Sife6l-N{k-6QZNvV^)KxbpGlZNqGFrK0 z!s+!~2g6$oJVaeXl9t)2cV$+rTVMU-N1gcd$a~-a#r*X;n9|^{;Ae1mLx*`sx|#0W z&vu0^Q&n4k%&9oEfUQ%0r{3;A$96v1FhAX`Cns&5g_F*dT@mk+!puS*Wj>m*C~M05 z^E=lR+h*~`7Od4No|`42sguO1#ByTA;wCMfBbnDd3@0x9yrjMU$j9y{ zlTL;*Dj#Rc3Q)AH`(XdWHhQy#=}WcN$qw(kbL)E;55_LIy5a5n-`a=-)ES z`5mUEP2I=H$Jh8#D0O}Hp55!K^ZwtAuK|hSbg~yu-oYW}v5~=AEd$JoYrX*ZucyGqC VWM+cKS75=w;OXk;vd$@?2>>&v`xF2G literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..e6be001d555fa5569f146564e3989c04e590195e GIT binary patch literal 1535 zcmeAS@N?(olHy`uVBq!ia0y~yV4MKL985qF{<{lj134|3&dvdz&dv%2Mfqu&IjIZ` z8WU?L+Ik!g5NY*~UK*sORJP&KgoRc&U0r3eMY{qNuW+rknz82#|11*~O})OR?1KmA zA6?bly?Gtqx+aAm%#U6@TJl0k_1<)ms3Sife6l-N{k-6QZNvV^)KxbpGlZNqGFrK0 z!s+!~2g6$oJVaeXl9t)2cV$+rTVMU-N1gcd$a~-a#r*X;n9|^{;Ae1mLx*`sx|#0W z&vu0^Q&n4k%&9oEfUQ%0r{3;A$96v1FhAX`Cns&5g_F*dT@mk+!puS*Wj>m*C~M05 z^E=lR+h*~`7Od4No|`42sguO1#ByTA;wCMfBbnDd3@0x9yrjMU$j9y{ zlTL;*Dj#Rc3Q)AH`(XdWHhQy#=}WcN$qw(kbL)E;55_LIy5a5n-`a=-)ES z`5mUEP2I=H$Jh8#D0O}Hp55!K^Zwt{p>aini_Yz9O9Rc{L7&CLx`b`H6fxQ zkx@bnNPyTt0We!a49q4*l4yl^tr#^0d(aP~aFLkC0#0fadWqEZi9Oj37gG)_V_da} WrTE!`o1Vaufx*+&&t;ucLK6U00o{lI literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..791f4fa6fd0cf8877868f3d64a08c8e50ae53deb GIT binary patch literal 1534 zcmeAS@N?(olHy`uVBq!ia0y~yV4MKL985qF{<{lj134|3&dvdz&dv%2Mfqu&IjIZ` z8WU?L+Ik!g5NY*~UK*sORJP&KgoRc&U0r3eMY{qNuW+rknz82#|11*~O})OR?1KmA zA6?bly?Gtqx+aAm%#U6@TJl0k_1<)ms3Sife6l-N{k-6QZNvV^)KxbpGlZNqGFrK0 z!s+!~2g6$oJVaeXl9t)2cV$+rTVMU-N1gcd$a~-a#r*X;n9|^{;Ae1mLx*`sx|#0W z&vu0^Q&n4k%&9oEfUQ%0r{3;A$96v1FhAX`Cns&5g_F*dT@mk+!puS*Wj>m*C~M05 z^E=lR+h*~`7Od4No|`42sguO1#ByTA;wCMfBbnDd3@0x9yrjMU$j9y{ zlTL;*Dj#Rc3Q)AH`(XdWHhQy#=}WcN$qw(kbL)E;55_LIy5a5n-`a=-)ES z`5mUEP2I=H$Jh8#D0O}Hp55!K^Zwto)m0G~T1F=dE+xuVDFo@T1G8|?y&^fSy zfrlGNfY?9+%;w<+vx$);S|MI5MoqyU^us7zc)XdwNsU4;k(xfSC%fTdO2TCZcLA39 UF&=8nz=DCn)78&qol`;+0MX+1X#fBK literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..9eb3e68794cdc7a091f992680cee80d1244ff363 GIT binary patch literal 1532 zcmeAS@N?(olHy`uVBq!ia0y~yV4MKL985qF{<{lj134|3&dvdz&dv%2Mfqu&IjIZ` z8WU?L+Ik!g5NY*~UK*sORJP&KgoRc&U0r3eMY{qNuW+rknz82#|11*~O})OR?1KmA zA6?bly?Gtqx+aAm%#U6@TJl0k_1<)ms3Sife6l-N{k-6QZNvV^)KxbpGlZNqGFrK0 z!s+!~2g6$oJVaeXl9t)2cV$+rTVMU-N1gcd$a~-a#r*X;n9|^{;Ae1mLx*`sx|#0W z&vu0^Q&n4k%&9oEfUQ%0r{3;A$96v1FhAX`Cns&5g_F*dT@mk+!puS*Wj>m*C~M05 z^E=lR+h*~`7Od4No|`42sguO1#ByTA;wCMfBbnDd3@0x9yrjMU$j9y{ zlTL;*Dj#Rc3Q)AH`(XdWHhQy#=}WcN$qw(kbL)E;55_LIy5a5n-`a=-)ES z`5mUEP2I=H$Jh8#D0O}Hp55!K^Zwt>)5S5Q;?~>nE%CoTHMsUWa@@w%e#yp96cE%#2OMA+gKAK z7}{9DYzZ+iJ0SunPMjps3h`PoY6>v8u>}1v3YUZkAz%_9A!T7tFjxW!yFy^l;ZE7Z c#+2z|`;Ay^y#oY+Wjh0dr>mdKI;Vst0AP#VrT_o{ literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..de4784e8e41717b01c00b3794df67035db4f6298 GIT binary patch literal 1534 zcmeAS@N?(olHy`uVBq!ia0y~yV4MKL985qF{<{lj134|3&dvdz&dv%2Mfqu&IjIZ` z8WU?L+Ik!g5NY*~UK*sORJP&KgoRc&U0r3eMY{qNuW+rknz82#|11*~O})OR?1KmA zA6?bly?Gtqx+aAm%#U6@TJl0k_1<)ms3Sife6l-N{k-6QZNvV^)KxbpGlZNqGFrK0 z!s+!~2g6$oJVaeXl9t)2cV$+rTVMU-N1gcd$a~-a#r*X;n9|^{;Ae1mLx*`sx|#0W z&vu0^Q&n4k%&9oEfUQ%0r{3;A$96v1FhAX`Cns&5g_F*dT@mk+!puS*Wj>m*C~M05 z^E=lR+h*~`7Od4No|`42sguO1#ByTA;wCMfBbnDd3@0x9yrjMU$j9y{ zlTL;*Dj#Rc3Q)AH`(XdWHhQy#=}WcN$qw(kbL)E;55_LIy5a5n-`a=-)ES z`5mUEP2I=H$Jh8#D0O}Hp55!K^ZwtR V_HO!%3Shy&;OXk;vd$@?2>>i!`@jGI literal 0 HcmV?d00001 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 00000000..acad57f7 --- /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 51bb6199..3f37126b 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 @@

{{_ ("Test Instance") }}

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 9ffb2d05..3960fdf0 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 @@

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

+ #}
diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html index ffb782dc..9eac9d6e 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 00000000..e6920873 --- /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 00000000..03b6c8be --- /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 d7d88d41..628836f1 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.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(): From 877a760c6cda9196777193ddbad723982ea35081 Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Fri, 20 Oct 2023 00:35:05 +0200 Subject: [PATCH 4/9] refactor: apply semantic-ui, indentation, copyright --- .../less/invenio_theme_tugraz/footer.less | 14 +- .../less/invenio_theme_tugraz/search.less | 13 +- .../less/invenio_theme_tugraz/theme.less | 7 + .../templates/invenio_theme_tugraz/base.html | 147 +++++------ .../invenio_theme_tugraz/benefits.html | 23 +- .../invenio_theme_tugraz/comingsoon.html | 14 +- .../invenio_theme_tugraz/footer.html | 233 +++++++++--------- .../frontpage_overview.html | 33 +-- .../invenio_theme_tugraz/header.html | 78 +++--- .../templates/invenio_theme_tugraz/index.html | 33 +-- .../invenio_theme_tugraz/navbar.html | 68 ++--- .../invenio_theme_tugraz/overview.html | 12 +- .../invenio_theme_tugraz/recent_uploads.html | 137 +++++----- .../invenio_theme_tugraz/tu_graz_logo.svg | 32 +++ 14 files changed, 395 insertions(+), 449 deletions(-) create mode 100644 invenio_theme_tugraz/templates/invenio_theme_tugraz/tu_graz_logo.svg diff --git a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/footer.less b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/footer.less index 1ff81593..0e260f2a 100644 --- a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/footer.less +++ b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/footer.less @@ -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 details. @@ -7,18 +7,8 @@ #footer { color: @footerGrey; - - /*background-image: url("/static/images/footer.jpg");*/ - -webkit-background-size: 100% 100%; - -moz-background-size: 100% 100%; - -o-background-size: 100% 100%; - background-size: 100% 100%; min-height: 100%; - /* the following 2 lines are a hack for IE6 */ - height: auto !important; - height: 100%; width: 100%; - background-attachment: fixed; &.footer-bottom { background-color: @footerBottomBackground; @@ -39,7 +29,7 @@ color: @tugrazRed; } } - + // remove blue focus outline if clicked with mouse &:focus:not(:focus-visible) { outline-style: none; diff --git a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/search.less b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/search.less index ca4b8478..cd894e20 100644 --- a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/search.less +++ b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/search.less @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 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 details. @@ -26,14 +26,3 @@ .identifiers { display: inline; } - -// // align badges to the right -// .ui.items > .item .extra.labels-actions { -// float: right; -// width: auto; - -// // remove action buttons from search results -// .ui.small.compact.right.floated.button { -// display: none; -// } -// } 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 006af3b4..1378ec41 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 @@ -41,3 +41,10 @@ .ui.label.schema { border: 1px solid #bfb5b5; } + +.random-records-frontpage {} + +.random-records-frontpage .grid .column { + width: 380px !important; + padding: 14px !important; +} diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/base.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/base.html index 3c9222c5..6103b49c 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/base.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/base.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 @@ -7,79 +7,88 @@ #} - + {%- block head %} - {%- block head_meta %} - - - - {%- if description %}{% endif %} - {%- if keywords %}{% endif %} - {%- if config.get('THEME_GOOGLE_SITE_VERIFICATION', None) %} - {%- for google_id in config.THEME_GOOGLE_SITE_VERIFICATION %} - - {%- endfor %} - {%- endif %} - {%- endblock head_meta %} - {%- block head_title %} - {%- set title = title or _(config.THEME_SITENAME) or _('Invenio') %} - {{title}} - {%- endblock head_title %} - {%- block head_links %} - - {%- if keywords %}{% endif %} - {%- block head_links_langs %} - {%- if alternate_urls %} - {%- for alt_ln, alternate_url in alternate_urls.items() %} - - {%- endfor %} - {%- endif %} - {%- endblock %} - {%- block head_apple_icons %} - {%- for size in [144, 114, 72, 57] %} - {%- set icon_name = 'apple-touch-icon-%d-precomposed.png' | format(size) %} - - {%- endfor %} - {%- endblock head_apple_icons %} - {%- endblock head_links %} - {%- block header %}{% endblock header %} - {%- block css %} - {{ webpack['theme.css'] }} - {{ webpack['invenio-theme-tugraz-theme.css'] }} - - - {%- endblock css %} + {%- block head_meta %} + + + + + {%- if description %} + + {% endif %} + + {%- if keywords %} + + {% endif %} + + {%- if config.get("THEME_GOOGLE_SITE_VERIFICATION", None) %} + {%- for google_id in config.THEME_GOOGLE_SITE_VERIFICATION %} + + {%- endfor %} + {%- endif %} + {%- endblock head_meta %} + + {%- block head_title %} + {%- set title = title or _(config.THEME_SITENAME) or _("Invenio") %} + {{title}} + {%- endblock head_title %} + + {%- block head_links %} + + + {%- if keywords %} + + {% endif %} + + {%- block head_links_langs %} + {%- if alternate_urls %} + {%- for alt_ln, alternate_url in alternate_urls.items() %} + + {%- endfor %} + {%- endif %} + {%- endblock %} + {%- endblock head_links %} + + {%- block header %}{% endblock header %} + + {%- block css %} + {{ webpack["theme.css"] }} + {{ webpack["invenio-theme-tugraz-theme.css"] }} + {%- endblock css %} {%- endblock head %} - + + {%- block body %} - {%- block browserupgrade %} - - {%- endblock browserupgrade %} - {%- block body_inner %} - {%- block page_header %} -{% include config.THEME_HEADER_TEMPLATE %} - {%- endblock page_header %} - {%- block page_body %} -{% include "invenio_theme/body.html" %} - {%- endblock page_body %} - - {%- block page_footer %} -{% include config.THEME_FOOTER_TEMPLATE %} - {%- endblock page_footer %} - - {%- endblock body_inner %} - {%- block javascript %} -{% include config.THEME_JAVASCRIPT_TEMPLATE %} - {%- endblock javascript %} - {%- block trackingcode %}{% include config.THEME_TRACKINGCODE_TEMPLATE %} - {%- endblock %} + {%- block browserupgrade %} + + {%- endblock browserupgrade %} + + {%- block body_inner %} + {%- block page_header %} + {% include config.THEME_HEADER_TEMPLATE %} + {%- endblock page_header %} + + {%- block page_body %} + {% include "invenio_theme/body.html" %} + {%- endblock page_body %} + + {%- block page_footer %} + {% include config.THEME_FOOTER_TEMPLATE %} + {%- endblock page_footer %} + {%- endblock body_inner %} + + {%- block javascript %} + {% include config.THEME_JAVASCRIPT_TEMPLATE %} + {%- endblock javascript %} + + {%- block trackingcode %} + {% include config.THEME_TRACKINGCODE_TEMPLATE %} + {%- endblock %} {%- endblock body %} diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html index 1449baf3..3271a7bc 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html @@ -1,10 +1,17 @@ +{# + 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. +#}
    -
  • {{_('Safe')}} — {{_('your research is stored safely for the future in TU Graz library for as long as TU Graz library exists.')}}
  • -
  • {{_('Trusted')}} — {{_('built and operated by CERN and OpenAIRE to ensure that everyone can join in Open Science.')}}
  • -
  • {{_('Citeable')}} — {{_('every upload is assigned a Digital Object Identifier (DOI), to make them citable and trackable.')}}
  • -
  • {{_('No waiting time')}} — {{_('Uploads are made available online as soon as you hit publish, and your DOI is registered within seconds.')}}
  • -
  • {{_('Open or closed')}} — {{_('Share e.g. anonymized clinical trial data with only medical professionals via our restricted access mode.')}}
  • -
  • {{_('Versioning')}} — {{_("Easily update your dataset with our versioning feature.")}}
  • -
  • {{_('Usage statisics')}} — {{_("All uploads display standards compliant usage statistics")}}
  • -
\ No newline at end of file +
  • {{_("Safe") }} — {{_("your research is stored safely for the future in TU Graz library for as long as TU Graz library exists.") }}
  • +
  • {{_("Trusted") }} — {{_("built and operated by CERN and OpenAIRE to ensure that everyone can join in Open Science.") }}
  • +
  • {{_("Citeable") }} — {{_("every upload is assigned a Digital Object Identifier (DOI), to make them citable and trackable.") }}
  • +
  • {{_("No waiting time") }} — {{_("Uploads are made available online as soon as you hit publish, and your DOI is registered within seconds.") }}
  • +
  • {{_("Open or closed") }} — {{_("Share e.g. anonymized clinical trial data with only medical professionals via our restricted access mode.") }}
  • +
  • {{_("Versioning") }} — {{_("Easily update your dataset with our versioning feature.") }}
  • +
  • {{_("Usage statisics") }} — {{ _("All uploads display standards compliant usage statistics") }}
  • + diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/comingsoon.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/comingsoon.html index c2e70203..115b1abb 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/comingsoon.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/comingsoon.html @@ -1,7 +1,15 @@ +{# + 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 %} {%- block page_body %} -
    -

    comingsoon

    -
    +
    +

    comingsoon

    +
    {%- endblock %} diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html index 85792380..f6ae2b93 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html @@ -1,168 +1,169 @@ {# -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 -details. + 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. #} {%- block css %} - -{{ webpack['invenio-theme-tugraz-theme.css'] }} + {{ webpack['invenio-theme-tugraz-theme.css'] }} {%- endblock %} {%- block javascript %} -{{ webpack['invenio-theme-tugraz-js.js'] }} + {{ webpack['invenio-theme-tugraz-js.js'] }} {%- endblock javascript %}
    +
    diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/frontpage_overview.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/frontpage_overview.html index acad57f7..3cc2e3cd 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/frontpage_overview.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/frontpage_overview.html @@ -7,8 +7,8 @@ #}
    -
    -
    +
    +

    {{ _("Research Result") }}

    @@ -30,32 +30,9 @@

    {{ _("Research Result") }}

    Upload -
    -
    -
    -

    {{ _("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") }}

    @@ -73,10 +50,9 @@

    {{ _("Publications") }}

    Search -
    -
    +

    {{ _("OER") }}

    @@ -97,7 +73,6 @@

    {{ _("OER") }}

    Upload -
    diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/header.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/header.html index 3f37126b..95733592 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/header.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/header.html @@ -7,58 +7,58 @@ #} {% if not config.THEME_TUGRAZ_PRODUCTION %} -
    -

    {{_ ("Test Instance") }}

    -

    {{_ ("This is the test instance of the TU Graz Repository.") }}

    -
    +
    +

    {{ _("Test Instance") }}

    +

    {{ _("This is the test instance of the TU Graz Repository.") }}

    +
    {% endif %}
    {%- block navbar %} - {%- endblock navbar %} {%- block flashmessages %} diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html index 3960fdf0..541bb805 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html @@ -25,37 +25,6 @@
    - {# -
    -

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

    - -
    -
    - - {{ _("Visibility of uploaded content is maximized through synchronization with data hubs (DataCite).") }} - -
    - -
    - - {{ _("Open Educational Resources (OER) will be visible on various discovery tools like the OERhub.") }} - -
    - -
    -
    - #} -

    {{ _("Need help?") }}

    @@ -82,7 +51,7 @@

    {{ _("Need help?") }}

    -

    {{ _("Why use") }} {{ config.THEME_SITENAME }}?

    +

    {{ _("Why use") }} {{ config.THEME_SITENAME }}

    {% include "invenio_theme_tugraz/benefits.html" %}
    diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html index 9eac9d6e..03f8e753 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html @@ -44,88 +44,56 @@
    {%- for l in current_i18n.get_locales() %} - {%- if current_i18n.language != l.language %} - {{ l.get_display_name().upper() [0:2]}} - {%- endif %} + {%- if current_i18n.language != l.language %} + + {{ l.get_display_name().upper()[0:2] }} + + {%- endif %} {%- endfor %}
    -
    {%- block navbar_right %} - {%- include config.THEME_HEADER_LOGIN_TEMPLATE %} + {%- include config.THEME_HEADER_LOGIN_TEMPLATE %} {%- endblock navbar_right %}
    - -