aboutsummaryrefslogtreecommitdiffstats
path: root/templates/web/zurich/admin
diff options
context:
space:
mode:
Diffstat (limited to 'templates/web/zurich/admin')
-rw-r--r--templates/web/zurich/admin/header.html11
-rw-r--r--templates/web/zurich/admin/report_edit-sdm.html15
-rw-r--r--templates/web/zurich/admin/report_edit.html112
-rw-r--r--templates/web/zurich/admin/response_templates_select.html29
4 files changed, 8 insertions, 159 deletions
diff --git a/templates/web/zurich/admin/header.html b/templates/web/zurich/admin/header.html
index a423cf22f..40847f190 100644
--- a/templates/web/zurich/admin/header.html
+++ b/templates/web/zurich/admin/header.html
@@ -24,14 +24,3 @@
select { width: auto; }
.admin-report-edit select { max-width: 100%; }
</style>
-<script>
-$(function(){
- $('.row-link').hover(function(){
- $(this).toggleClass("active");
- }).click(function(){
- window.location = this.getElementsByTagName('a')[0];
- }).find('td:last').hide();
- $('th.edit').hide();
-});
-</script>
-
diff --git a/templates/web/zurich/admin/report_edit-sdm.html b/templates/web/zurich/admin/report_edit-sdm.html
index b8de2a5ef..509ddfd7c 100644
--- a/templates/web/zurich/admin/report_edit-sdm.html
+++ b/templates/web/zurich/admin/report_edit-sdm.html
@@ -101,12 +101,6 @@
<div class="admin-report-edit admin-report-edit--interact">
-<script type="text/javascript">
- $(function(){
- $('#map_box .noscript').clone().removeClass('noscript').addClass('map_clone print-only').prependTo('.admin-report-edit--interact');
- });
-</script>
-
<p align="right" class="screen-only"><input type="submit" name="send_back" value="[% loc('Not for my subdivision') %]"></p>
<p align="right" class="screen-only"><input type="submit" name="not_contactable" value="[% loc('Customer not contactable') %]"></p>
@@ -124,15 +118,6 @@
<p class="screen-only">
<label for="time_spent">[% loc('Time spent (in minutes):') %]</label>
<input type="text" name="time_spent" id="form_time_spent" style="width: 4em" value="0">
- <script>
- $(function () {
- $('#form_time_spent').spinner({
- spin: function (e, ui) {
- if (ui.value < 0) { return false }
- }
- });
- });
- </script>
</p>
<p class="clearfix screen-only">
diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html
index 215373eca..4ef55e75a 100644
--- a/templates/web/zurich/admin/report_edit.html
+++ b/templates/web/zurich/admin/report_edit.html
@@ -107,7 +107,7 @@
<dd>[% problem.get_time_spent %]</dd>
[% IF problem.photo %]
- <dd>
+ <dd data-confirm="[% loc('Rotating this photo will discard unsaved changes to the report.') | html %]">
[% FOR photo IN problem.photos %]
<div class="update-img">
<a href="[% c.cobrand.base_url %][% photo.url_temp_full %]" rel="fancy">
@@ -131,12 +131,6 @@
[% status_message %]
-<script type="text/javascript">
- $(function(){
- $('#map_box .noscript').clone().removeClass('noscript').addClass('map_clone print-only').prependTo('.admin-report-edit--interact');
- });
-</script>
-
<dl [% IF status_message %]class="with-message"[% END %]>
<dt class="screen-only">
@@ -157,7 +151,7 @@
<span class="mock-label">[% loc('State:') %]</span>
</dt>
<dd class="screen-only">
- <select name="state" id="state">
+ <select name="state" id="state" data-pstate="[% pstate %]">
<option value="">--</option>
[% FOREACH s IN states %]
<option [% 'selected ' IF s.state == pstate %] value="[% s.state %]">[% s.trans %]</option>
@@ -300,108 +294,6 @@
</div>
-<script type="text/javascript">
-$(function(){
- var form_fields_changed = false;
-
- $('#form_time_spent').spinner({
- spin: function (e, ui) {
- if (ui.value < 0) { return false }
- form_fields_changed = true;
- }
- });
-
- setTimeout(function(){
- $('.message-updated').fadeOut(250, function(){
- $(this).remove();
- });
- }, 5000);
-
- // When the user changes a select box, this bit of code
- // makes the labels for the other two select boxes grey.
- $('.assignation__select, .assignation select').change(function(){
- if (this.value == "") {
- $('.assignation').css('color', '#000');
- } else {
- var a = $(this).closest('li').css('color', '#000');
- $('.assignation select').not(this).val("");
- $('.assignation').not(a).css('color', '#999');
- }
- });
-
- $('#state').change(function(){
- // Show or hide the automatic reply field
- var state = $(this).val();
-
- // show or disable assignation, templates, public_response, publish if
- // same or different state to the one we started on
- if ((state === '[% pstate %]')) {
- $('input[name=publish_response]').show();
- $('.response_templates_select').show();
- $('#status_update_container').show();
-
- if (state === 'confirmed') {
- $('#assignation__category').show();
- $('#assignation__subdivision').show();
- }
- if ((state === 'closed') || (state === 'investigating')) {
- $('#assignation__external').show();
- } else {
- $('#assignation__external').hide();
- }
- }
- else {
- $('input[name=publish_response]').hide();
- $('.response_templates_select').hide();
- $('#status_update_container').hide();
-
- $('#assignation__category').hide();
- $('#assignation__subdivision').hide();
- $('#assignation__category select').val('');
- $('#assignation__subdivision select').val('');
-
- $('#assignation__external select').val('');
- $('#assignation__external').hide();
- $('#external_body').hide();
- $('#third_personal, label[for=third_personal]').hide();
- }
-
- }).change();
-
- $("form#report_edit input[type=submit]").click(function() {
- $("form#report_edit").data("clicked_button", $(this).attr("name"));
- });
-
- $("form#report_edit").submit(function() {
- // Make sure the external body field has a value if it's visible
- // and the form is submitted as a 'save' action (i.e. not a rotate
- // photo).
- var clicked = $(this).data("clicked_button");
- if (clicked == "publish_response" || clicked == "Submit changes") {
- var visible = $("select#body_external:visible").length > 0;
- var val = parseInt($("select#body_external").val());
- if (visible && isNaN(val)) {
- $("#assignation__external .error").removeClass("hidden");
- $("select#body_external").focus().get(0).scrollIntoView();
- return false;
- }
- }
- // If the user has clicked to rotate a photo and has edited other
- // fields, ask for confirmation before submitting the form
- if (/rotate_photo/.test(clicked) && form_fields_changed) {
- var message = "[% loc('Rotating this photo will discard unsaved changes to the report.') %]";
- if (!confirm(message)) {
- return false;
- }
- }
- });
-
- $("form#report_edit").find("input, select, textarea").change(function() {
- form_fields_changed = true;
- });
-});
-</script>
-
<div id="print_report_map" class="print-only">
[% INCLUDE 'maps/noscript_map.html' map=print_report_map nsm_prefix="large_" %]
</div>
diff --git a/templates/web/zurich/admin/response_templates_select.html b/templates/web/zurich/admin/response_templates_select.html
index c0f4104c8..853956a0d 100644
--- a/templates/web/zurich/admin/response_templates_select.html
+++ b/templates/web/zurich/admin/response_templates_select.html
@@ -1,25 +1,8 @@
-[% template_name="templates_for_${for}" %]
-
-[% response_templates = problem.response_templates %]
<div class="response_templates_select">
-<select id="[% template_name %]">
- <option value="">[% loc('Choose a template') %]</option>
-[% FOR t IN response_templates %]
- <option value="[% t.id %]"> [% t.title | html %] </option>
-[% END %]
-</select>
+ <select id="templates_for_[% for %]" class="js-template-name" data-for="[% for %]">
+ <option value="">[% loc('Choose a template') %]</option>
+ [% FOR t IN problem.response_templates %]
+ <option value="[% t.text | html %]"> [% t.title | html %] </option>
+ [% END %]
+ </select>
</div>
-<script>
- $(function () {
- var response_template_texts = {
- [% FOR t IN response_templates %]
- [% t.id %]: '[% t.text | escape_js %]' [% loop.last ? '' : ',' %]
- [% END %]
- };
- $('#[% template_name %]').change(function () {
- var val = $(this).val();
- var text = response_template_texts[val];
- $('#[% for %]').val( text );
- });
- });
-</script>