Skip to content

Commit

Permalink
Merge branch 'v0.2' into v0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fredkingham committed Oct 30, 2016
2 parents 7484e91 + f7c1d69 commit 1b7acc8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
31 changes: 21 additions & 10 deletions pathway/pathways.py
Expand Up @@ -7,6 +7,7 @@

from opal.core import discoverable, exceptions
from opal.models import Patient, Episode, EpisodeSubrecord, PatientSubrecord
from opal.utils import AbstractBase


def extract_pathway_field(some_fun):
Expand Down Expand Up @@ -133,12 +134,16 @@ class Pathway(discoverable.DiscoverableFeature):
# the class that we append the compiled form onto
append_to = ".appendTo"

template_url = "/templates/pathway/form_base.html"

def __init__(self, patient_id=None, episode_id=None):
self.episode_id = episode_id
self.patient_id = patient_id

@property
def template_url(self):
raise NotImplementedError(
"we expect a template url to be implemented"
)

@property
def episode(self):
if self.episode_id is None:
Expand Down Expand Up @@ -233,17 +238,23 @@ def to_dict(self):
)


class ModalPathway(Pathway):
# so the theory is that we have a service that goes and gets a pathway based
# on the url, this returns a serialised version of the pathway and opens the modal
# doing all the work
template_url = "/templates/pathway/modal_form_base.html"
append_to = ".modal-content"
class WizardPathway(Pathway, AbstractBase):
template_url = "/templates/pathway/wizard_pathway.html"


class UnrolledPathway(Pathway):
class PagePathway(Pathway, AbstractBase):
"""
An unrolled pathway will display all of it's forms
at once, rather than as a set of steps.
"""
template_url = "/templates/pathway/unrolled_form_base.html"
template_url = "/templates/pathway/page_pathway.html"


class ModalWizardPathway(Pathway, AbstractBase):
template_url = "/templates/pathway/modal_wizard_pathway.html"
append_to = ".modal-content"


class ModalPagePathway(Pathway, AbstractBase):
template_url = "/templates/pathway/modal_page_pathway.html"
append_to = ".modal-content"
@@ -1,4 +1,4 @@
{% extends "pathway/modal_form_base.html" %}
{% extends "pathway/modal_wizard_pathway.html" %}
{% block to_append %}
<div class="to_append"></div>
{% endblock %}
@@ -1,4 +1,4 @@
{% extends "pathway/form_base.html" %}
{% extends "pathway/wizard_pathway.html" %}

{% block main_panel_body %}
<div class="to_append"></div>
Expand Down
File renamed without changes.

0 comments on commit 1b7acc8

Please sign in to comment.