summaryrefslogtreecommitdiffstats
path: root/dashboard/src/templates/dashboard/genericselect.html
blob: 441d8dc2a615fa5f7e048bfe0ea35e4827e1e4b7 (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{% extends "workflow/viewport-element.html" %}
{% load staticfiles %}

{% load bootstrap4 %}

{% block content %}

<style>
    #page-wrapper {
        display: flex;
        flex-direction: column;
    }

    #{{select_type}}_form_div div {
    }

    #{{select_type}}_form_div > * {
        margin-left: 10px;
        margin-right: 10px;
        margin-bottom: 20px;
    }

    #{{select_type}}_form_div div * {
    }

    #{{select_type}}_form_div {
        flex: 1;
        margin: 30px;
        display: flex;
        flex-direction: column;
    }

    #select_section {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    #{{select_type}}_select_form {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .autocomplete {
        flex: 1;
    }

    #create_section {
    }

    #select_header_section {
    }

    h3 {
        margin-top: 0;
        margin-bottom: 0;
        vertical-align: middle;
    }

    .divider {
        border-top: 1px solid #ccc;
    }


</style>

<div id="{{select_type}}_form_div">
    <h3 id="create_section">Create a Resource
        <button class="btn btn-primary {% if disabled %} disabled {% endif %}"
            {% if not disabled %}onclick="parent.add_wf({{addable_type_num}})"
            {% endif %}>Here
        </button>
    </h3>
    <div class="divider"></div>
    <h3 id="select_header_section">Or select from the list below:</h3>
    <div id="select_section">
        <form id="{{select_type}}_select_form" method="post" action="" class="form" id="{{select_type}}selectorform">
        {% csrf_token %}
        {{ form|default:"<p>no form loaded</p>" }}
        {% buttons %}

        {% endbuttons %}
        </form>
    </div>
</div>

<script>
    {% if disabled %}
    disable();
    {% endif %}
</script>

{% endblock content %}
{% block onleave %}
var form = $("#{{select_type}}_select_form");
var formData = form.serialize();
var req = new XMLHttpRequest();
req.open("POST", "/wf/workflow/", false);
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
req.onerror = function() { alert("problem with form submission"); }
req.send(formData);
{% endblock %}