Now clicking cancel button returns user to previous page. Fixes issue 569.
[Melange.git] / app / soc / templates / soc / models / edit.html
blobe48b8f452aa49d341e5f93782b3b83bdc58d22d4
1 {% extends "soc/base.html" %}
2 {% comment %}
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
7 http://www.apache.org/licenses/LICENSE-2.0
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 {% endcomment %}
15 {% load forms_helpers %}
17 {% block header_title %}
18 {{ page_name }}
19 {% if entity %}
20 <a href="/{{ entity_type_url|lower }}/show/{{ entity.key.id_or_name }}"
21 >{% if entity.name %}{{ entity.name }} {% endif %}(public view)</a>
22 {% endif %}
23 {% endblock %}
25 {% block body %}
26 <p>
27 <p>
28 {% block instructions %}
29 Please use this form to edit the {{ entity_type }}.
30 {% endblock %}
31 </p>
33 {% if error_message %}
34 <div class="error">{{ error_message|safe }}</div>
35 {% endif %}
37 <form method="POST">
38 <table>
39 {% block form_table %}
40 {% as_table form %}
41 {% endblock %}
42 </table>
43 <table>
44 <tr>
45 <td colspan="4">&nbsp;</td>
46 </tr>
47 <tr>
48 {% block submit_buttons %}
49 {% block save_button %}
50 {% if entity %}
51 <td>
52 <input style="font-weight: bold" type="submit" value="Save Changes"/></span>
53 </td>
54 {% else %}
55 <td>
56 <input style="font-weight: bold" type="submit" value="Submit"/></span>
57 </td>
58 {% endif %}
59 {% endblock %}
60 <td>
61 {% if cancel_redirect %}
62 <input type="button"
63 {% if entity %}
64 onclick="location.href='{{ cancel_redirect }}'"
65 {% else %}
66 onClick="javascript: history.go(-1)">
67 {% endif %}
68 value="Cancel"/>
69 {% else %}
70 <input type="button" value="Back to Previous Page" onClick="javascript:history.go(-1)">
71 {% endif %}
72 </td>
73 {% if entity %}
74 {% block delete_button %}
75 <td>
77 <input type="button" class="button" value="Delete"
78 onclick="if(confirm('Are you sure you want to delete this {{ entity_type }}?')) {
79 location.href='/{{ entity_type_url|lower }}/delete/{{ entity_suffix }}';
80 }"/>
82 </td>
83 {% endblock %}
84 {% if export_link %}
85 <td>
86 <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/export/{{ entity_suffix }}'" value="Export"/>
87 </td>
88 {% endif %}
89 {% endif %}
90 {% endblock %}
91 </tr>
92 </table>
93 </form>
94 </p>
95 {% endblock %}