-
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 #76 from oarepo/krist/be-488-add-button-labels-for…
…-approve-decline-into-request-type-form Krist/be 488 add button labels for approve decline into request type form
- Loading branch information
Showing
11 changed files
with
63 additions
and
7 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
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 |
---|---|---|
@@ -1,13 +1,20 @@ | ||
from oarepo_runtime.datastreams.utils import get_record_service_for_record | ||
from oarepo_runtime.i18n import lazy_gettext as _ | ||
|
||
from .cascade_events import cancel_requests_on_topic_delete | ||
from .generic import OARepoAcceptAction | ||
from .generic import OARepoAcceptAction, OARepoDeclineAction | ||
|
||
|
||
class DeletePublishedRecordAcceptAction(OARepoAcceptAction): | ||
name = _("Permanently delete") | ||
|
||
def apply(self, identity, request_type, topic, uow, *args, **kwargs): | ||
topic_service = get_record_service_for_record(topic) | ||
if not topic_service: | ||
raise KeyError(f"topic {topic} service not found") | ||
topic_service.delete(identity, topic["id"], uow=uow, *args, **kwargs) | ||
cancel_requests_on_topic_delete(self.request, topic, uow) | ||
|
||
|
||
class DeletePublishedRecordDeclineAction(OARepoDeclineAction): | ||
name = _("Keep the record") |
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
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,15 @@ | ||
from oarepo_ui.resources.components import UIResourceComponent | ||
|
||
|
||
class ActionLabelsComponent(UIResourceComponent): | ||
def form_config(self, *, identity, view_args, form_config, **kwargs): | ||
type_ = view_args.get("request_type") | ||
action_labels = {} | ||
for action_type, action in type_.available_actions.items(): | ||
if hasattr(action, "stateful_name"): | ||
name = action.stateful_name(identity, **kwargs) | ||
else: | ||
name = action_type.capitalize() | ||
action_labels[action_type] = name | ||
|
||
form_config["action_labels"] = action_labels |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[metadata] | ||
name = oarepo-requests | ||
version = 2.2.3 | ||
version = 2.2.4 | ||
description = | ||
authors = Ronald Krist <[email protected]> | ||
readme = README.md | ||
|
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