-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
We observed the CPA's tendency to lump everything into a single class: html, js, css, data retrieval, launcher, modal definition.
We should offer the preferred pattern:
- Launcher (whether action button or application) is only responsible for the configuration of the modal (button placement, modal size and location, and content url)
- Content from that URL is retrieved via a SimpleAPI handler, which is responsible for data access enforcement, most often decided by session user
- The SimpleAPI handler retrieves whatever data is needed to form the context provided to the template
- The SimpleAPI handler uses
render_to_stringto insert that context into an HTML template - The HTML template may include JS or CSS in-line if there is not much to be included
- JS and CSS may be provided as separate endpoints in the SimpleAPI handler
- Templates and static content are provided in the plugin as separate files and not as python strings inline with the handler.
An example plugin showcasing this pattern can be found here: https://github.com/canvas-medical/canvas-plugins/tree/main/example-plugins/example_provider_page/example_provider_page
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels