From f266ab755fa93f6422d7e7da0b5fec7282a28a2e Mon Sep 17 00:00:00 2001 From: ducica Date: Wed, 4 Dec 2024 13:20:01 +0100 Subject: [PATCH 1/9] not displaying custom fields on about page --- .../details/about/index.html | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/details/about/index.html diff --git a/oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/details/about/index.html b/oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/details/about/index.html new file mode 100644 index 0000000..e1e1288 --- /dev/null +++ b/oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/details/about/index.html @@ -0,0 +1,54 @@ +{# -*- coding: utf-8 -*- + + This file is part of Invenio. + Copyright (C) 2023 CERN. + + Invenio 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 "invenio_communities/details/base.html" %} +{% from "invenio_communities/details/macros/custom_fields.html" import list_vocabulary_values, list_string_values, show_custom_field %} +{% set active_community_header_menu_item= 'about' %} + +{%- block page_body %} + {{ super() }} +
+ {{ community.metadata.page | safe }} + {% if community.ui.funding|length %} +

{{ _("Awards") }}

+
+ + {% for funding in community.ui.funding %} +
+ {% if funding.award %} +
+ {{ funding.award.title_l10n }} + + + {% if funding.award.identifiers|length and funding.award.identifiers[0].scheme == "url" %} + + + + {% endif %} +
+ {% endif %} + + {% if funding.funder %} +
+ {{ funding.funder.name }} +
+ {% endif %} +
+ {% endfor %} + +
+ {% endif %} +{%- endblock page_body -%} From 4993815dd87abf2f32d9c311579df88c960e6148 Mon Sep 17 00:00:00 2001 From: ducica Date: Wed, 4 Dec 2024 13:25:43 +0100 Subject: [PATCH 2/9] fixed code smell --- .../oarepo/invenio_communities/details/about/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/details/about/index.html b/oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/details/about/index.html index e1e1288..ab9c434 100644 --- a/oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/details/about/index.html +++ b/oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/details/about/index.html @@ -24,9 +24,9 @@

{{ _("Awards") }}

{% if funding.award %}
{{ funding.award.title_l10n }} - + {% if funding.award.identifiers|length and funding.award.identifiers[0].scheme == "url" %} Date: Tue, 10 Dec 2024 11:25:07 +0100 Subject: [PATCH 3/9] not requiring login for communities tab --- oarepo_communities/ui/oarepo_communities/__init__.py | 5 ----- setup.cfg | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/oarepo_communities/ui/oarepo_communities/__init__.py b/oarepo_communities/ui/oarepo_communities/__init__.py index 7d9f19f..7638f3f 100644 --- a/oarepo_communities/ui/oarepo_communities/__init__.py +++ b/oarepo_communities/ui/oarepo_communities/__init__.py @@ -1,6 +1,5 @@ import marshmallow as ma from flask import g, redirect, url_for -from flask_login import login_required from flask_menu import current_menu from flask_resources import from_conf, request_parser, resource_requestctx from invenio_communities.communities.resources.serializer import ( @@ -93,10 +92,6 @@ def search_endpoint_url(self, identity, api_config, overrides={}, **kwargs): class CommunityRecordsUIResource(GlobalSearchUIResource): - decorators = [ - login_required, - ] - @request_view_args @request_community_view_args def community_records(self): diff --git a/setup.cfg b/setup.cfg index 6179a86..c7137b0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = oarepo-communities -version = 5.1.1 +version = 5.1.2 description = authors = Ronald Krist readme = README.md From e6379881ed32fe0c56acaf324a69dfd954daa75a Mon Sep 17 00:00:00 2001 From: Miroslav Bauer Date: Thu, 19 Dec 2024 12:44:28 +0100 Subject: [PATCH 4/9] feat(invitations): show actual error in modal --- .../CommunityInvitationsModal.jsx | 30 ++++++++++++------- .../invenio_communities/details/header.html | 2 +- setup.cfg | 2 +- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/oarepo_communities/ui/communities_components/semantic-ui/js/communities_components/components/CommunityInvitationsModal/CommunityInvitationsModal.jsx b/oarepo_communities/ui/communities_components/semantic-ui/js/communities_components/components/CommunityInvitationsModal/CommunityInvitationsModal.jsx index e17591c..cedabab 100644 --- a/oarepo_communities/ui/communities_components/semantic-ui/js/communities_components/components/CommunityInvitationsModal/CommunityInvitationsModal.jsx +++ b/oarepo_communities/ui/communities_components/semantic-ui/js/communities_components/components/CommunityInvitationsModal/CommunityInvitationsModal.jsx @@ -26,6 +26,12 @@ export const CommunityInvitationsModal = ({ rolesCanInvite, community }) => { const [successMessage, setSuccessMessage] = useState(""); const [httpError, setHttpError] = useState(""); + const handleClose = () => { + setSuccessMessage(""); + setHttpError(""); + close(); + } + const onSubmit = async (values, { setSubmitting, resetForm }) => { const serializer = new OARepoDepositSerializer( ["membersEmails", "emails"], @@ -43,24 +49,28 @@ export const CommunityInvitationsModal = ({ rolesCanInvite, community }) => { if (response.status === 204) { resetForm(); setSuccessMessage(i18next.t("Invitations sent successfully.")); + setTimeout(() => { + if (isOpen) { + handleClose() + } + }, 2500); } } catch (error) { if (error.response.status >= 400) { - setHttpError( - i18next.t( + console.error(error.response) + setHttpError(` + ${i18next.t( "The invitations could not be sent. Please try again later." - ) + )} + ${error.response.data.message}` // TODO: These needs to get translated in invenio_communities.members.config + ); + setTimeout(() => { + setHttpError("") + }, 5000); } } finally { setSubmitting(false); - setTimeout(() => { - if (isOpen) { - close(); - setSuccessMessage(""); - setHttpError(""); - } - }, 2500); } }; diff --git a/oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/details/header.html b/oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/details/header.html index b5fbda3..d9f9700 100644 --- a/oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/details/header.html +++ b/oarepo_communities/ui/communities_components/templates/oarepo/invenio_communities/details/header.html @@ -3,7 +3,7 @@ {%- block subheader_buttons %}
- {%- if not community_use_jinja_header %} + {%- if not community_use_jinja_header and can_view_deposit_page %} diff --git a/setup.cfg b/setup.cfg index 6179a86..c7137b0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = oarepo-communities -version = 5.1.1 +version = 5.1.2 description = authors = Ronald Krist readme = README.md From 97cfcf3eb7666b122d25c1a43b5962a67892d9be Mon Sep 17 00:00:00 2001 From: Miroslav Bauer Date: Thu, 19 Dec 2024 12:46:31 +0100 Subject: [PATCH 5/9] feat(invitations): custom close handler --- .../CommunityInvitationsModal/CommunityInvitationsModal.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oarepo_communities/ui/communities_components/semantic-ui/js/communities_components/components/CommunityInvitationsModal/CommunityInvitationsModal.jsx b/oarepo_communities/ui/communities_components/semantic-ui/js/communities_components/components/CommunityInvitationsModal/CommunityInvitationsModal.jsx index cedabab..90edb7d 100644 --- a/oarepo_communities/ui/communities_components/semantic-ui/js/communities_components/components/CommunityInvitationsModal/CommunityInvitationsModal.jsx +++ b/oarepo_communities/ui/communities_components/semantic-ui/js/communities_components/components/CommunityInvitationsModal/CommunityInvitationsModal.jsx @@ -108,7 +108,7 @@ export const CommunityInvitationsModal = ({ rolesCanInvite, community }) => { className="form-modal community-invitations" closeIcon open={isOpen} - onClose={close} + onClose={handleClose} onOpen={open} trigger={