Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ots
hypha
Commits
6694371d
Commit
6694371d
authored
7 years ago
by
Todd Dembrey
Browse files
Options
Downloads
Patches
Plain Diff
Add the ability to submit to the demo
parent
756376a6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
opentech/apply/templates/apply/demo_workflow.html
+19
-0
19 additions, 0 deletions
opentech/apply/templates/apply/demo_workflow.html
opentech/apply/views.py
+36
-8
36 additions, 8 deletions
opentech/apply/views.py
with
55 additions
and
8 deletions
opentech/apply/templates/apply/demo_workflow.html
+
19
−
0
View file @
6694371d
...
@@ -17,6 +17,14 @@
...
@@ -17,6 +17,14 @@
<section
class=
"container"
>
<section
class=
"container"
>
<h2>
{{ workflow}}
</h2>
<h2>
{{ workflow}}
</h2>
<h3>
{{ phase.stage }}
</h3>
<h3>
{{ phase.stage }}
</h3>
{% if form %}
<form
method=
"post"
>
{% csrf_token %}
{{ form }}
<input
id=
"current"
type=
"hidden"
name=
"current"
value=
"{{ phase }}"
/>
<button
id=
"submit"
name=
"submit"
>
Submit
</button>
</form>
{% else %}
<h4>
OTF: {{ phase.name }}
</h4>
<h4>
OTF: {{ phase.name }}
</h4>
<h4>
Public: {{ phase.public_name }}
</h4>
<h4>
Public: {{ phase.public_name }}
</h4>
<form
method=
"post"
>
<form
method=
"post"
>
...
@@ -28,12 +36,23 @@
...
@@ -28,12 +36,23 @@
<h4>
There are no actions
</h4>
<h4>
There are no actions
</h4>
{% endfor %}
{% endfor %}
</form>
</form>
</section>
<section
class=
"container"
>
<h3>
Logs
</h3>
<ul>
<ul>
{% for log in logs %}
{% for log in logs %}
<li>
{{ log }}
</li>
<li>
{{ log }}
</li>
{% endfor %}
{% endfor %}
</ul>
</ul>
</section>
</section>
<section
class=
"container"
>
<h3>
Submission
</h3>
{% for key, value in data.items %}
<h4>
{{ key }}
</h4>
{{ value }}
{% endfor %}
</section>
{% endif %}
<section
class=
"container"
>
<section
class=
"container"
>
<a
class=
"button"
href=
""
>
Reset
</a>
<a
class=
"button"
href=
""
>
Reset
</a>
</section>
</section>
...
...
This diff is collapsed.
Click to expand it.
opentech/apply/views.py
+
36
−
8
View file @
6694371d
from
django
.forms
import
F
orm
from
django
import
f
orm
s
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.template.response
import
TemplateResponse
from
django.template.response
import
TemplateResponse
...
@@ -9,26 +9,54 @@ workflows = [SingleStage, DoubleStage]
...
@@ -9,26 +9,54 @@ workflows = [SingleStage, DoubleStage]
logs
=
[]
logs
=
[]
submission
=
{}
class
BasicSubmissionForm
(
forms
.
Form
):
who_are_you
=
forms
.
CharField
()
def
demo_workflow
(
request
,
wf_id
):
def
demo_workflow
(
request
,
wf_id
):
wf
=
int
(
wf_id
)
wf
=
int
(
wf_id
)
workflow_class
=
workflows
[
wf
-
1
]
workflow_class
=
workflows
[
wf
-
1
]
workflow
=
workflow_class
([
Form
()
]
*
wf
)
workflow
=
workflow_class
([
BasicSubmission
Form
]
*
wf
)
current_phase
=
request
.
POST
.
get
(
'
current
'
)
current_phase
=
request
.
POST
.
get
(
'
current
'
)
current
=
workflow
.
current
(
current_phase
)
if
request
.
POST
:
if
request
.
POST
:
current
=
workflow
.
current
(
current_phase
)
if
current
.
stage
.
name
not
in
submission
:
phase
=
workflow
.
process
(
current_phase
,
request
.
POST
[
'
action
'
])
submitted_form
=
current
.
stage
.
form
(
request
.
POST
)
logs
.
append
(
if
submitted_form
.
is_valid
():
f
'
{
current
.
stage
}
:
{
current
.
name
}
was updated to
{
phase
.
stage
}
:
{
phase
.
name
}
'
submission
[
current
.
stage
.
name
]
=
submitted_form
)
phase
=
current
logs
.
append
(
f
'
{
phase
.
stage
}
: Form was submitted
'
)
form
=
None
else
:
form
=
submitted_form
else
:
phase
=
workflow
.
process
(
current_phase
,
request
.
POST
[
'
action
'
])
logs
.
append
(
f
'
{
current
.
stage
}
:
{
current
.
name
}
was updated to
{
phase
.
stage
}
:
{
phase
.
name
}
'
)
else
:
else
:
phase
=
workflow
.
current
(
current_phase
)
phase
=
current
logs
.
clear
()
logs
.
clear
()
submission
.
clear
()
if
phase
.
stage
.
name
not
in
submission
:
form
=
phase
.
stage
.
form
else
:
form
=
None
context
=
{
context
=
{
'
workflow
'
:
workflow
,
'
workflow
'
:
workflow
,
'
phase
'
:
phase
,
'
phase
'
:
phase
,
'
logs
'
:
logs
,
'
logs
'
:
logs
,
'
data
'
:
submission
,
'
form
'
:
form
,
}
}
return
TemplateResponse
(
request
,
'
apply/demo_workflow.html
'
,
context
)
return
TemplateResponse
(
request
,
'
apply/demo_workflow.html
'
,
context
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment