aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2014-03-20 17:27:00 +0000
committerStruan Donald <struan@exo.org.uk>2014-04-08 13:21:12 +0100
commitb20cb6576485017970f025e6f294ac8c09f39e69 (patch)
treebe1bb792076b19cd097754070c0c3c9e89f7aa8d /templates
parent39f714f27fd78ab3223d14510199bb09053d16f6 (diff)
Add a searchable dropdown of clinic names to postcode form
uses select2 for the dropdown and a cobrand call to fetch the list of report titles as the clinic names. Relies on a redirect in httpd.conf to make the non JS version work. Still leaves the postcode search in place as select2 won't accept custom terms if you base it on a select box, which we want to do so it works if JavaScript is disabled Fixes #723
Diffstat (limited to 'templates')
-rw-r--r--templates/web/zerotb/around/postcode_form.html36
-rw-r--r--templates/web/zerotb/header_extra.html18
2 files changed, 54 insertions, 0 deletions
diff --git a/templates/web/zerotb/around/postcode_form.html b/templates/web/zerotb/around/postcode_form.html
new file mode 100644
index 000000000..484f41c5c
--- /dev/null
+++ b/templates/web/zerotb/around/postcode_form.html
@@ -0,0 +1,36 @@
+<div id="front-main">
+ <div id="front-main-container">
+ [% INCLUDE 'around/intro.html' %]
+
+ [%
+ question = c.cobrand.enter_postcode_text || loc('Enter a nearby street name and area');
+ %]
+
+ <div id="postcodeForm">
+ <form action="[% c.uri_for('/around') %]" method="get" name="postcodeForm">
+ <label for="pc">[% question %]:</label>
+ <div>
+ <input type="text" name="pc" value="[% pc | html %]" id="pc" size="10" maxlength="200" placeholder="[% tprintf(loc('e.g. ā€˜%s’ or ā€˜%s’'), c.cobrand.example_places) %]">
+ <input type="submit" value="[% loc('Go') %]" id="sub">
+ </div>
+
+ [% IF partial_token %]
+ <input type="hidden" name="partial" value="[% partial_token.token %]">
+ [% END %]
+
+ </form>
+ <form action="[% c.uri_for( '/report' ) %]/" method="get" name="clinicForm">
+ <label for="clinic">[% loc('... or select a clinic by name' ) %]</label>
+ <div>
+ <select id="clinic" name="clinic">
+ [% FOR clinic IN c.cobrand.get_clinic_list %]
+ <option value="[% clinic.id %]">[% clinic.title %]</option>
+ [% END %]
+ </select>
+ <input class="green-btn" type="submit" value="[% loc('Go') %]" id="show_report">
+ </div>
+ </form>
+ </div>
+
+ </div>
+</div>
diff --git a/templates/web/zerotb/header_extra.html b/templates/web/zerotb/header_extra.html
new file mode 100644
index 000000000..23f061799
--- /dev/null
+++ b/templates/web/zerotb/header_extra.html
@@ -0,0 +1,18 @@
+<link rel="stylesheet" href="[% start %][% version('/js/select2/select2.css') %]" />
+<script type="text/javascript" src="[% start %][% version('/js/select2/select2.min.js') %]"></script>
+
+<script>
+$(document).ready(function() {
+ $("#clinic").select2({
+ placeholder: '[% loc('Enter a clinic name') %]',
+ allowClear: true,
+ });
+ $('#show_report').click(
+ function() {
+ var report = $('#clinic').select2('val');
+ document.location = '[% c.uri_for( '/report' ) %]/' + report;
+ return false;
+ }
+ );
+});
+</script>