-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from oarepo/corovcam/fe-116-display-requests-on…
…-record-page [FE-116] Display requests on record page
- Loading branch information
Showing
48 changed files
with
1,975 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,3 +92,6 @@ dist/ | |
|
||
tests/thesis | ||
thesis | ||
|
||
**/ui/theme/**/todo.md | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of Invenio. | ||
# Copyright (C) 2015-2018 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. | ||
|
||
# Extraction from Python source files | ||
|
||
[extractors] | ||
jinja2 = jinja2.ext:babel_extract | ||
|
||
[python: **.py] | ||
encoding = utf-8 | ||
|
||
# Extraction from Jinja2 templates | ||
|
||
[jinja2: **/templates/**.html] | ||
encoding = utf-8 | ||
|
||
[jinja2: **/templates/**.jinja] | ||
encoding = utf-8 | ||
extensions = jinjax.jinjax.JinjaX | ||
|
||
# Special case for jinjax translation strings | ||
[jinja2: **/jinjax_messages.jinja] | ||
encoding = utf-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
i18n: | ||
babel_output_translations: oarepo_requests/translations | ||
babel_source_paths: | ||
- oarepo_requests/ | ||
i18next_output_translations: oarepo_requests/ui/theme/assets/semantic-ui/translations/oarepo_requests_ui | ||
i18next_source_paths: | ||
- oarepo_requests/ui/theme/assets/semantic-ui/js | ||
languages: | ||
- cs | ||
- en |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from invenio_records_resources.services.records.params import FilterParam | ||
from invenio_requests.resources.requests.config import RequestSearchRequestArgsSchema, RequestsResourceConfig | ||
from invenio_requests.services.requests.config import RequestSearchOptions, RequestsServiceConfig | ||
from marshmallow import fields | ||
from opensearch_dsl.query import Bool, Term | ||
|
||
|
||
class RequestOwnerFilterParam(FilterParam): | ||
def apply(self, identity, search, params): | ||
value = params.pop(self.param_name, None) | ||
if value is not None: | ||
search = search.filter("term", **{self.field_name: identity.id}) | ||
return search | ||
|
||
|
||
class RequestReceiverFilterParam(FilterParam): | ||
def apply(self, identity, search, params): | ||
value = params.pop(self.param_name, None) | ||
my_groups = [ | ||
n.value for n in identity.provides if n.method == 'role' | ||
] | ||
if value is not None: | ||
search = search.filter(Bool(should=[ | ||
# explicitly myself | ||
Term(**{f"{self.field_name}.user": identity.id}), | ||
# my roles | ||
*[ | ||
Term(**{f"{self.field_name}.group": group_id}) for group_id in my_groups | ||
], | ||
# TODO: add my communities where I have a role to accept requests | ||
], minimum_should_match=1)) | ||
return search | ||
|
||
|
||
class EnhancedRequestSearchOptions(RequestSearchOptions): | ||
params_interpreters_cls = RequestSearchOptions.params_interpreters_cls + [ | ||
RequestOwnerFilterParam.factory("mine", "created_by.user"), | ||
RequestReceiverFilterParam.factory("assigned", "receiver") | ||
] | ||
|
||
|
||
class ExtendedRequestSearchRequestArgsSchema(RequestSearchRequestArgsSchema): | ||
mine = fields.Boolean() | ||
assigned = fields.Boolean() | ||
|
||
|
||
def override_invenio_request_search_options(*args, **kwargs): | ||
# this monkey patch should be done better | ||
RequestsServiceConfig.search = EnhancedRequestSearchOptions | ||
RequestsResourceConfig.request_search_args = ExtendedRequestSearchRequestArgsSchema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from oarepo_runtime.i18n import lazy_gettext as _ | ||
|
||
_("Create Request") | ||
_("Open dialog for request") | ||
_("My Requests") | ||
_("Requests to Approve") | ||
_("Are you sure?") | ||
_("Cancel") | ||
_("OK") | ||
_("Create request") | ||
_("Submit request") | ||
_("Delete request") | ||
_("Delete") | ||
_("Accept request") | ||
_("Accept") | ||
_("Decline request") | ||
_("Decline") | ||
_("Create and submit request") | ||
_("Create and submit") | ||
_("Error sending request") | ||
_("Submit") | ||
_("Save drafted request") | ||
_("Save") | ||
_("Create") | ||
_("Creator") | ||
_("Receiver") | ||
_("Request type") | ||
_("Created") | ||
_("Timeline") | ||
_("Submit event") | ||
_("No requests to show") | ||
_("api.requests") |
161 changes: 161 additions & 0 deletions
161
oarepo_requests/translations/cs/LC_MESSAGES/messages.po
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: PROJECT VERSION\n" | ||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | ||
"POT-Creation-Date: 2024-03-27 11:31+0100\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: cs <[email protected]>\n" | ||
"Language: cs\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=utf-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=3; plural=((n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2);\n" | ||
"Generated-By: Babel 2.14.0\n" | ||
|
||
#: oarepo_requests/services/ui_schema.py:71 | ||
#, fuzzy | ||
msgid "status" | ||
msgstr "Stav" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:3 | ||
msgid "Create Request" | ||
msgstr "Vytvořit žádost" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:4 | ||
msgid "Open dialog for request" | ||
msgstr "Otevřít dialogové okno pro žádost" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:5 | ||
msgid "My Requests" | ||
msgstr "Moje žádosti" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:6 | ||
msgid "Requests to Approve" | ||
msgstr "Žádosti ke schválení" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:7 | ||
msgid "Are you sure?" | ||
msgstr "Jste si jistí?" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:8 | ||
msgid "Cancel" | ||
msgstr "Zrušit" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:9 | ||
msgid "OK" | ||
msgstr "OK" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:10 | ||
msgid "Create request" | ||
msgstr "Vytvořit žádost" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:11 | ||
msgid "Submit request" | ||
msgstr "Odeslat žádost" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:12 | ||
msgid "Delete request" | ||
msgstr "Smazat žádost" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:13 | ||
msgid "Delete" | ||
msgstr "Smazat" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:14 | ||
msgid "Accept request" | ||
msgstr "Přijmout žádost" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:15 | ||
msgid "Accept" | ||
msgstr "Přijmout" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:16 | ||
msgid "Decline request" | ||
msgstr "Zamítnout žádost" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:17 | ||
msgid "Decline" | ||
msgstr "Zamítnout" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:18 | ||
msgid "Create and submit request" | ||
msgstr "Vytvořit a odeslat žádost" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:19 | ||
msgid "Create and submit" | ||
msgstr "Vytvořit a odeslat" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:20 | ||
msgid "Error sending request" | ||
msgstr "Chyba při odesílání žádosti" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:21 | ||
msgid "Submit" | ||
msgstr "Odeslat" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:22 | ||
msgid "Save drafted request" | ||
msgstr "Uložit koncept žádosti" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:23 | ||
msgid "Save" | ||
msgstr "Uložit" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:24 | ||
msgid "Create" | ||
msgstr "Vytvořit" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:25 | ||
msgid "Creator" | ||
msgstr "Tvůrce" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:26 | ||
msgid "Receiver" | ||
msgstr "Příjemce" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:27 | ||
msgid "Request type" | ||
msgstr "Typ žádosti" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:28 | ||
msgid "Created" | ||
msgstr "Vytvořeno" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:29 | ||
msgid "Timeline" | ||
msgstr "Časová osa" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:30 | ||
msgid "Submit event" | ||
msgstr "Odeslat událost" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:31 | ||
msgid "No requests to show" | ||
msgstr "Žádné žádosti k zobrazení" | ||
|
||
#: oarepo_requests/translations/_only_for_translations.py:32 | ||
msgid "api.requests" | ||
msgstr "API pro žádosti záznamu" | ||
|
||
#: oarepo_requests/types/delete_record.py:14 | ||
msgid "Request deletion of published record" | ||
msgstr "Žádost o smazání zveřejněného záznamu" | ||
|
||
#: oarepo_requests/types/edit_record.py:14 | ||
msgid "Request re-opening of published record" | ||
msgstr "Žádost o znovuotevření zveřejněného záznamu" | ||
|
||
#: oarepo_requests/types/publish_draft.py:14 | ||
msgid "Request publishing of a draft" | ||
msgstr "Žádost o kontrolu a zveřejnění konceptu" | ||
|
||
msgid "No status" | ||
msgstr "Beze stavu" | ||
|
||
msgid "Cannot send request. Please try again later." | ||
msgstr "Nemohu poslat žádost. Prosím, zkuste později." | ||
|
||
msgid "Cancel request" | ||
msgstr "" |
Oops, something went wrong.