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

Overhaul actions #58

Open
radiac opened this issue Jun 24, 2024 · 0 comments
Open

Overhaul actions #58

radiac opened this issue Jun 24, 2024 · 0 comments

Comments

@radiac
Copy link
Owner

radiac commented Jun 24, 2024

The current mechanism for defining actions (urls and links) is messy.

They're currently built by the vg based on which views are defined. This is inflexible; views should support multiple actions, different types of actions etc, and we're missing a way to add djagno admin-style lists actions.

Plan:

  • Remove from there and put on the views themselves as .actions
  • View.get_actions() should check for .actions otherwise build its own from .viewgroup
  • They're used to define which actions appear on the page.
  • List of Action classes, eg [IndexAction, CreateAction]
  • Action class can specify styling/icons and a URL (index, create). Appears at top.
  • ActionObject as Action, URL points at an object (update, delete). In item "sidebar"
  • ActionQuerySet class as Action, but URL takes multiple objects (delete). At top as dropdown.
  • ActionField as ActionObject but also takes a field
    • target for this feature: an inline approve toggler, eg a boolean. Would need some templates/text strings to give context, and some JS/htmx
  • Also accept a list of view names, eg ["index", "create"] which are turned into an Action
  • View.action - default action class for when used as a string.
  • Actions should have a way to declare a JS/API version; render()? examples:
    • approve/unapprove go ticking down a list etc
    • update inline
    • delete without leaving page
  • subclass ActionQuerySet to manage the dropdown action
  • and ActionField to hook into javascript for an Approve button
  • But does this complicate things unnecessarily?
    • View.as_action() could check .action and fall back to wrap Action/ActionObject by default, then View.get_actions() can have a list like ["change", "delete", ApproveAction] etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

1 participant