From 60075da75ccd419026f8ac962bd2908871904818 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Sun, 21 Jan 2018 22:55:55 +0000 Subject: Fix possible offline form issue & message spacing. --- web/cobrands/fixmystreet/offline.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/web/cobrands/fixmystreet/offline.js b/web/cobrands/fixmystreet/offline.js index 18d724e8c..a611cfec0 100644 --- a/web/cobrands/fixmystreet/offline.js +++ b/web/cobrands/fixmystreet/offline.js @@ -11,9 +11,9 @@ fixmystreet.offlineBanner = (function() { function formText() { var num = fixmystreet.offlineData.getForms().length; if ( num === 1 ) { - return num + translation_strings.offline.update_single; + return num + ' ' + translation_strings.offline.update_single; } else { - return num + translation_strings.offline.update_plural; + return num + ' ' + translation_strings.offline.update_plural; } } @@ -338,12 +338,16 @@ fixmystreet.offline = (function() { }); } - $('#report_inspect_form').submit(function() { + // If we catch the form submit, e.g. Chrome still seems to + // try and submit and we get the Chrome offline error page + var btn = $('#report_inspect_form input[type=submit]'); + btn.click(function() { var data = $(this).serialize() + '&save=1&saved_at=' + Math.floor(+new Date() / 1000); fixmystreet.offlineData.addForm(this.action, data); location.href = '/my/planned?saved=1'; return false; }); + btn[0].type = 'button'; return true; } -- cgit v1.2.3