Skip to content

Commit

Permalink
Upgrade to a new oarepo-runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
mesemus committed Mar 27, 2024
1 parent ae6e063 commit c13ec76
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 39 deletions.
6 changes: 3 additions & 3 deletions oarepo_requests/services/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from invenio_requests.services.schemas import GenericRequestSchema
from marshmallow import fields

from oarepo_requests.utils import get_matching_service_for_record, is_record

from oarepo_requests.utils import get_matching_service_for_record
from oarepo_runtime.records import is_published_record

def get_links_schema():
# TODO possibly specify more
Expand All @@ -31,7 +31,7 @@ def create_link(self, data, **kwargs):
record = self.context["record"]
service = get_matching_service_for_record(record)
link = ConditionalLink(
cond=is_record,
cond=is_published_record,
if_=Link(f"{{+api}}{service.config.url_prefix}{{id}}/requests/{type_id}"),
else_=Link(
f"{{+api}}{service.config.url_prefix}{{id}}/draft/requests/{type_id}"
Expand Down
1 change: 1 addition & 0 deletions oarepo_requests/translations/_only_for_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@
_("Timeline")
_("Submit event")
_("No requests to show")
_("api.requests")
59 changes: 46 additions & 13 deletions oarepo_requests/translations/cs/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-03-26 21:45+0100\n"
"POT-Creation-Date: 2024-03-27 09:01+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: cs\n"
Expand All @@ -19,102 +19,135 @@ msgstr ""
msgid "status"
msgstr "Stav"

#: oarepo_requests/types/delete_record.py:14
msgid "Request deletion of published record"
msgstr "Požádat o smazání zveřejněného záznamu"

#: oarepo_requests/types/edit_record.py:14
msgid "Request re-opening of published record"
msgstr "Požádat o znovuotevření zveřejněného záznamu"

#: oarepo_requests/types/publish_draft.py:14
msgid "Request publishing of a draft"
msgstr "Požádat o kontrolu a zveřejnění konceptu"

#: 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 "Požádat o smazání zveřejněného záznamu"

#: oarepo_requests/types/edit_record.py:14
msgid "Request re-opening of published record"
msgstr "Požádat o znovuotevření zveřejněného záznamu"

#: oarepo_requests/types/publish_draft.py:14
msgid "Request publishing of a draft"
msgstr "Požádat o kontrolu a zveřejnění konceptu"

65 changes: 49 additions & 16 deletions oarepo_requests/translations/en/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-03-26 21:45+0100\n"
"POT-Creation-Date: 2024-03-27 09:01+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
Expand All @@ -18,105 +18,138 @@ msgstr ""
msgid "status"
msgstr ""

#: oarepo_requests/types/delete_record.py:14
msgid "Request deletion of published record"
msgstr ""

#: oarepo_requests/types/edit_record.py:14
msgid "Request re-opening of published record"
msgstr ""

#: oarepo_requests/types/publish_draft.py:14
msgid "Request publishing of a draft"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:3
msgid "Create Request"
msgstr ""

msgid "No status"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:4
msgid "Open dialog for request"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:5
msgid "My Requests"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:6
msgid "Requests to Approve"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:7
msgid "Are you sure?"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:8
msgid "Cancel"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:9
msgid "OK"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:10
msgid "Create request"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:11
msgid "Submit request"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:12
msgid "Delete request"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:13
msgid "Delete"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:14
msgid "Accept request"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:15
msgid "Accept"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:16
msgid "Decline request"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:17
msgid "Decline"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:18
msgid "Create and submit request"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:19
msgid "Create and submit"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:20
msgid "Error sending request"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:21
msgid "Submit"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:22
msgid "Save drafted request"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:23
msgid "Save"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:24
msgid "Create"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:25
msgid "Creator"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:26
msgid "Receiver"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:27
msgid "Request type"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:28
msgid "Created"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:29
msgid "Timeline"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:30
msgid "Submit event"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:31
msgid "No requests to show"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:32
msgid "api.requests"
msgstr "Requests API"

#: oarepo_requests/types/delete_record.py:14
msgid "Request deletion of published record"
msgstr ""

#: oarepo_requests/types/edit_record.py:14
msgid "Request re-opening of published record"
msgstr ""

#: oarepo_requests/types/publish_draft.py:14
msgid "Request publishing of a draft"
msgstr ""

#~ msgid "No status"
#~ msgstr ""

6 changes: 5 additions & 1 deletion oarepo_requests/translations/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-03-26 21:45+0100\n"
"POT-Creation-Date: 2024-03-27 09:01+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -137,6 +137,10 @@ msgstr ""
msgid "No requests to show"
msgstr ""

#: oarepo_requests/translations/_only_for_translations.py:32
msgid "api.requests"
msgstr ""

#: oarepo_requests/types/delete_record.py:14
msgid "Request deletion of published record"
msgstr ""
Expand Down
6 changes: 0 additions & 6 deletions oarepo_requests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,3 @@ def stringify_first_val(dct):
dct[k] = str(v)
return dct


def is_record(record, ctx):
"""Shortcut for links to determine if record is a record."""
if not hasattr(record, "is_draft"):
return True
return not record.is_draft
Empty file modified translate.sh
100644 → 100755
Empty file.

0 comments on commit c13ec76

Please sign in to comment.