Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hookable action providers #131

Closed
wants to merge 8 commits into from
Closed

Conversation

ramonski
Copy link
Contributor

@ramonski ramonski commented Feb 3, 2023

Description of the issue/feature this PR addresses

This PR allows to hook in actions into the SENAITE IMPRESS preview like e.g. the PDF download button.

Possible Use-Cases:

  • Direct email sending of the generated report w/o storing it first, e.g. for sample receipt confirmation
  • Direct PDF download (already built-in by this PR)
  • PDF signing
  • Custom PDF storing inside SENAITE
  • ...

New actions are registered via an adapter that implements the senaite.impress.interfaces.ICustomActionProvider interface.

The adapter has to provide the following attributes:

  • available: Boolean True/False if the action should be rendered or not
  • title: Title of the button
  • name: Name of the (input-)button (must be unique)
  • url: URL of a view that renders a modal (similar to senaite.core.browser.modals) and/or the form action handler where the data can be POSTed directly
  • modal: Boolean True/False if a modal should be rendered first or the data should be directly posted to

☝️ NOTE: The form data will always contain a pdf key with the generated report PDF before either the modal is rendered or directly posted to the given URL.

Current behavior before PR

Only static actions were supported

Desired behavior after PR is merged

Custom actions are allowed

--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.

@ramonski ramonski requested a review from xispa February 3, 2023 16:11
@xispa
Copy link
Member

xispa commented Feb 7, 2023

Superseded by #132

@xispa xispa closed this Feb 7, 2023
@ramonski ramonski deleted the hookable-custom-action-providers branch February 11, 2023 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants