summaryrefslogtreecommitdiff
path: root/app/notes/templates/note_form.html
blob: 9c8ac3731556e15b47423c156f948b3702faf4e6 (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
{% extends 'base_notes.html' %}
{% block extrahead %}
<style>
form .selector label {
    position: inherit;
}
</style>
<script src="/media/js/nice-select2.js"></script>
<link rel="stylesheet" href="/media/nice-select2.css">
{% endblock %}
{% block primary %}
<main role="main" class="archive-wrapper">
    <div class="post-body">
            <form action="" method="post" class="comment-form">{% csrf_token %}
                {% for field in form %}
                <fieldset>
                    {%if field.name == "project" or field.name == "status" or field.name == 'note_type'%}<span class="selector">{{field.label_tag}}</span>{%else%}{{field.label_tag}}{%endif%}
                    {%if field.name == "body_markdown" or field.name == "description" %}<div class="textarea-rounded">{{ field }}</div>{%else%}{{field}}{%endif%}
                </fieldset>
            <small class="alert">{% if field.errors %}{{field.errors}}{% endif %}</small>
                {%endfor%}
                <input class="btn" type="submit" name="add_new" value="Save and add another" />
                <input type="submit" name="save" class="btn" value="Save" />
            </form>
    </div>
</main>
{% endblock %}
    {% block js %}
<script type="text/javascript">
var options = {searchable: true};
NiceSelect.bind(document.getElementById("id_project"), options);
    {% if is_update %}{%else%}
let params = new URL(document.location).searchParams;
document.getElementById('id_title').value = params.get("title");
document.getElementById('id_url').value = params.get("url");
document.getElementById('id_body_markdown').value = params.get("description");
{% endif %}
</script>
    {% endblock%}