/
stages.html
54 lines (49 loc) · 2.02 KB
/
stages.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{#
Inserts a stepped progress indicator for the new package form. Each stage can
have one of three states, "uncomplete", "complete" and "active".
stages - A list of states for each of the three stages. Missing stages default
to "uncomplete".
Example:
{% snippet 'package/snippets/stages.html', stages=['active'] %}
{% snippet 'package/snippets/stages.html', stages=['complete', 'active'] %}
{% snippet 'package/snippets/stages.html', stages=['active', 'complete', 'complete'] %}
#}
{% set s1 = stages[0] or 'active' %}
{% set s2 = stages[1] or 'uncomplete' %}
{% set s3 = stages[2] or 'uncomplete' %}
{% if s1 != 'uncomplete' %}{% set class = 'stage-1' %}{% endif %}
{% if s2 != 'uncomplete' %}{% set class = 'stage-2' %}{% endif %}
{% if s3 != 'uncomplete' %}{% set class = 'stage-3' %}{% endif %}
<ol class="stages {{ class }}">
<li class="first {{ s1 }}">
{% if s1 != 'complete' %}
<span class="highlight">{{ _('Create dataset') }}</span>
{% else %}
<button class="" name="save" value="go-dataset" type="submit">{{ _('Create dataset') }}</button>
{% endif %}
</li>
<li class="middle {{ s2 }}">
{% if s2 != 'complete' %}
<span class="highlight">{{ _('Add data') }}</span>
{% else %}
{% if s1 == 'active' or s3 == 'active'%}
{# stage 1 #}
<button class="" name="save" value="go-resources" type="submit">{{ _('Add data') }}</button>
{% else %}
{% link_for _('Add data'), controller='package', action='new', class_="highlight" %}
{% endif %}
{% endif %}
</li>
<li class="last {{ s3 }}">
{% if s3 != 'complete' %}
<span class="highlight">{{ s3 }}{{ _('Additional data') }}</span>
{% else %}
{% if s1 == 'active' or s2 == 'active' %}
{# stage 1 #}
<button class="" name="save" value="go-metadata" type="submit">{{ _('Additional data') }}</button>
{% else %}
{% link_for _('Additional data'), controller='package', action='new', class_="highlight" %}{{ s2 }}
{% endif %}
{% endif %}
</li>
</ol>