aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-03-05 13:20:39 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-03-06 17:24:12 +0000
commite9dfb010c6ad7fdde8dd897455f7cbffde0d9de6 (patch)
tree867a262f7fab5073a346f77545682bf40685a907
parentd1c09d6db343d3ff066d9881db507f963844d0e5 (diff)
[Zurich] Factor two admin category forms together.
-rw-r--r--templates/web/zurich/admin/body.html26
-rw-r--r--templates/web/zurich/admin/contact-form.html20
2 files changed, 18 insertions, 28 deletions
diff --git a/templates/web/zurich/admin/body.html b/templates/web/zurich/admin/body.html
index 468f7adff..a07e0f1c1 100644
--- a/templates/web/zurich/admin/body.html
+++ b/templates/web/zurich/admin/body.html
@@ -37,31 +37,7 @@
</div>
[% END %]
- <form method="post" action="[% c.uri_for('body', body_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8">
-
- <p>
- <strong>[% loc('Category:') %] </strong>
- <input type="text" class="form-control" name="category" size="30" value="[% contact.category | html %]">
- </p>
-
- <p>
- <strong>[% loc('Email:') %] </strong>
- <input type="text" class="form-control" name="email" size="30" value="[% contact.email | html %]">
- </p>
-
- <input type="hidden" name="confirmed" value="1" id="confirmed">
-
- <p>
- <strong>[% loc('Note:') %] </strong>
- <textarea class="form-control" name="note" rows="3" cols="40"></textarea>
- </p>
-
- <p>
- <input type="hidden" name="posted" value="new" >
- <input type="hidden" name="token" value="[% csrf_token %]" >
- <input type="submit" class="btn" name="Create category" value="[% errors ? loc('Save changes') : loc('Create category') %]">
- </p>
- </form>
+ [% INCLUDE 'admin/contact-form.html' %]
[% END %]
diff --git a/templates/web/zurich/admin/contact-form.html b/templates/web/zurich/admin/contact-form.html
index 236b169d0..48c4d5288 100644
--- a/templates/web/zurich/admin/contact-form.html
+++ b/templates/web/zurich/admin/contact-form.html
@@ -1,11 +1,19 @@
<form method="post" action="[% c.uri_for('body', body_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8" id="category_edit">
- <p><strong>[% loc('Category:') %] </strong>[% contact.category_display | html %]
+
+ [% IF contact.in_storage %]
+ <h1>[% contact.category_display | html %]</h1>
<input type="hidden" name="category" value="[% contact.category | html %]" >
- <input type="hidden" name="token" value="[% csrf_token %]" >
+ [% ELSE %]
+ <p>
+ <strong>[% loc('Category:') %] </strong>
+ <input type="text" class="form-control" name="category" size="30" value="[% contact.category | html %]" required>
+ </p>
+ [% END %]
<p><strong>[% loc('Email:') %] </strong>
<input type="text" class="form-control" name="email" value="[% contact.email | html %]" size="30">
+ [% IF contact.in_storage %]
<p>
<label for="state">[% loc('State') %]</label>
<select name="state" id="state">
@@ -15,9 +23,15 @@
<input type="checkbox" name="photo_required" value="1" id="photo_required"[% ' checked' IF contact.get_extra_metadata('photo_required') %]>
<label class="inline" for="photo_required">[% loc('Photo required') %]</label>
</p>
+ [% ELSE %]
+ <input type="hidden" name="confirmed" value="1" id="confirmed">
+ [% END %]
<p><strong>[% loc('Note:') %] </strong><textarea class="form-control" name="note" rows="3" cols="40"></textarea>
<input type="hidden" name="posted" value="new">
- <p><input type="submit" class="btn" name="Save changes" value="[% loc('Save changes') %]">
+ <input type="hidden" name="token" value="[% csrf_token %]" >
+ <p><input type="submit" class="btn" name="Create category" value="[% contact.in_storage ? loc('Save changes') : loc('Create category') %]">
+ </p>
+
</form>