Get editing working
[txt.house] / txt_house / templates / edit.html
1 {% extends "base.html" %}
2
3 {% block body %}
4
5 <nav>
6   <a href='{% url "index" %}' title='Home'>Home</a>
7   <a href='{{ text_file.get_view_url }}' title='View'>View</a>
8 </nav>
9
10 <style>
11   .copy-area {
12     display: flex;
13     flex-direction: row;
14     align-items: center;
15
16     margin-top: 1.5rem;
17   }
18
19   .copy-area label {
20     font-weight: bold;
21     margin-right: 1rem;
22   }
23
24   small {
25     margin-top: 0.5rem;
26   }
27
28   .error {
29     color: #bb0000;
30     text-align: center;
31     font-weight: bold;
32   }
33 </style>
34
35 {% if edit_key %}
36   <span class='copy-area'>
37     <label for='edit-key-display'>Edit key:</label>
38     <span id='edit-key-display'>{{ edit_key }}</span>
39   </span>
40   <small>Save this key in order to edit this file in the future.</small>
41 {% endif %}
42
43 <form class='editor' action='{{ text_file.get_edit_url }}' method='post'>
44   {% csrf_token %}
45   {% if edit_key %}
46     <input id='edit_key' name='edit_key' type='hidden' value='{{ edit_key }}'></input>
47   {% else %}
48     <span>
49       <label for='edit_key'>Edit key:</label>
50       <input id='edit_key' name='edit_key' type='text'></input>
51     </span>
52
53     {% if incorrect_key %}
54     <span class='error'>You must enter the correct edit key to save your changes.</span>
55     {% endif %}
56   {% endif %}
57   <textarea name='text'>{{ text }}</textarea>
58   <input type='submit'></input>
59 </form>
60
61 {% endblock %}