Skip to content
Snippets Groups Projects
Commit e51d9da2 authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Add a basic page to test the workflow on

parent 1855b1d3
No related branches found
No related tags found
No related merge requests found
<head>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic">
<link rel="stylesheet" href="//cdn.rawgit.com/necolas/normalize.css/master/normalize.css">
<link rel="stylesheet" href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css">
</head>
<body>
<main class="wrapper">
<nav>
<section class="container">
<a class="button button-clear" href="{% url 'workflow_demo' 1 %}">Single Stage</a>
<a class="button button-clear" href="{% url 'workflow_demo' 2 %}">Double Stage</a>
</section>
</nav>
<section class="container">
<h1>Demo of interacting with the workflow</h1>
</section>
<section class="container">
<h2>{{ workflow}}</h2>
<h3>{{ phase }}</h3>
<form method="post">
{% csrf_token %}
<input id="current" type="hidden" name="current" value="{{ phase }}" />
{% for action in phase.action_names %}
<button id="action" name="action" value="{{ action }}">{{ action }}</button>
{% empty %}
<h4>There are no actions</h4>
{% endfor %}
</form>
</section>
<section class="container">
<a class="button" href="">Reset</a>
</section>
</main>
</body>
from django.conf.urls import url
from .views import demo_workflow
urlpatterns = [
url(r'^demo/(?P<wf_id>[1-2])/$', demo_workflow, name="workflow_demo")
]
# from django.shortcuts import render from django.shortcuts import render
from django.template.response import TemplateResponse
from .workflow import single_stage, two_stage
workflows = [single_stage, two_stage]
def demo_workflow(request, wf_id):
workflow = workflows[int(wf_id)-1]
current_phase = request.POST.get('current')
if request.POST:
phase = workflow.process(current_phase, request.POST['action'])
else:
phase = workflow.current(current_phase)
context = {
'workflow': workflow,
'phase': phase,
}
return TemplateResponse(request, 'apply/demo_workflow.html', context)
# Create your views here.
...@@ -10,6 +10,7 @@ from wagtail.wagtailadmin import urls as wagtailadmin_urls ...@@ -10,6 +10,7 @@ from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtailcore import urls as wagtail_urls from wagtail.wagtailcore import urls as wagtail_urls
from wagtail.wagtaildocs import urls as wagtaildocs_urls from wagtail.wagtaildocs import urls as wagtaildocs_urls
from opentech.apply import urls as apply_urls
from opentech.esi import views as esi_views from opentech.esi import views as esi_views
from opentech.search import views as search_views from opentech.search import views as search_views
...@@ -22,6 +23,8 @@ urlpatterns = [ ...@@ -22,6 +23,8 @@ urlpatterns = [
url(r'^search/$', search_views.search, name='search'), url(r'^search/$', search_views.search, name='search'),
url(r'^esi/(.*)/$', esi_views.esi, name='esi'), url(r'^esi/(.*)/$', esi_views.esi, name='esi'),
url('^sitemap\.xml$', sitemap), url('^sitemap\.xml$', sitemap),
url(r'^apply/', include(apply_urls)),
] ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment