Reference docs: opal.core.pathway

Pathway

Pathway is the base class for most complex forms in Opal applications.

Attributes

Pathway.display_name

The human readable display name for this pathway. Will be used in the base template for full page pathways.

Pathway.slug

The slug to use in the URL for accessing an individual pathway, and the string that can be passed to Pathway.get() that will return it.

Pathway.steps

The steps that make up this pathway. A tuple of either opal.models.Subrecord or pathway.Step subclasses.

Pathway.pathway_service

The Service that is used to instantiate the pathway. This should inherit from the Pathway js service.

Pathway.pathway_insert

The name of the class that you're replaceing with the pathway template. You probably shouldn't have to change this.

Pathway.template

The name of the pathway template, it must include a div/span with the class .to_append which will be replaced by the wrapped step templates.

Pathway.modal_template

If set, this template will be used if your pathway is opened in a modal. If its not set the template attribute will be used.

Class Methods

Pathway.as_menuitem(href=None, activepattern=None, icon=None, display=None, index=None)

Return an instance of opal.core.menus.MenuItem that will direct the user to this pathway.

Pathway.get_slug()

Returns a string which should be used as the slug for this Pathway.

MyPathwy.get_slug()
"mypathway"

Pathway.get_absolute_url()

Returns a string which is the absolute URL of this Pathway.

MyPathway.get_absolute_url()
"/pathway/#/mypathway/"

Pathway.get_icon()

Returns a string which is the icon for this pathway. Defaults to None.

MyPathway.get_icon()
"fa-wave"

Pathway.get_display_name()

Returns a string which is the display name for this pathway. Defaults to None

MyPathway.get_display_name()
"The Form"

Methods

Pathway.redirect_url(self, patient, episde)

Returns a string that we should redirect to on success. Defaults to an episode detail screen

Pathway.save(user=None, episode=None, patient=None)

Saves a pathway, it removes items that haven't changed and then saves with the Patient.bulk_update method

WizardPathway

Inherits from opal.core.pathway.Pathway, this displays one step per page, with next and back buttons to navigate through the form.

PagePathway

Inherits from opal.core.pathway.Pathway, this displays all steps as one long form.

Step

Steps are a single section within a form, and can be instances of either opal.models.Subrecord or pathway.Step subclasses. You can use both types of Step in a given Pathway.

More detail on Steps is given in the Guides section on Pathways

HelpTextStep

A Step subclass with help text to the side of the form.

As arguments these takes either help_text or help_text_template.

help_text will be displayed in a side bar next to the step.

help_text_template will completely replace the normal side bar template with the template that you pass in.

RedirectsToPatientMixin

After saving, redirect the browser to the patient detail page for the relevant patient.