summaryrefslogtreecommitdiffstats
path: root/src/templates/dashboard/genericselect.html
blob: a03f759f060b77cb833b6add82809dd26b0e678a (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
105
106
107
108
109
110
111
{% extends "workflow/viewport-element.html" %}
{% load staticfiles %}

{% load bootstrap3 %}

{% block content %}

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

    #{{select_type}}_form_div div {
    }

    #{{select_type}}_form_div > *:not(.divider) {
        margin-left: 10px;
        margin-right: 10px;
    }

    #{{select_type}}_form_div div * {
    }

    #{{select_type}}_form_div {
        flex: 1;
        margin: 30px;
        display: grid;
        grid-template-rows: auto 1px auto 1fr;
        grid-template-columns: repeat(24, 1fr);
        grid-row-gap: 15px;
    }

    #select_section {
        display: flex;
        flex-direction: column;
        grid-column-start: 3;
        grid-column-end: 21;
    }

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

    .autocomplete {
        flex: 1;
    }

    #create_section {
        grid-column-start: 1;
        grid-column-end: 24;
    }

    #select_header_section {
        grid-column: 1 / 24;
    }

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

    .divider {
        border-top: 1px solid #ccc;
        grid-column-start: 1;
        grid-column-end: 24;
    }


</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 %}