diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-01-12 14:38:55 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-01-12 14:38:58 +0000 |
commit | 601392baa673a99ac351071f0686a05b6b9cf43c (patch) | |
tree | 4f8d47efe5c08b44902f5fdb69e5c466471e7c2d /web | |
parent | d19497f5ff6150c3512b9103f418dc9965431a20 (diff) |
Require confirmation for clearing offline data.
Diffstat (limited to 'web')
-rw-r--r-- | web/cobrands/fixmystreet/offline.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/web/cobrands/fixmystreet/offline.js b/web/cobrands/fixmystreet/offline.js index c98d76210..7b9be4c6c 100644 --- a/web/cobrands/fixmystreet/offline.js +++ b/web/cobrands/fixmystreet/offline.js @@ -383,12 +383,14 @@ if ($('#offline_list').length) { $(this).find('h3').prepend('<em>Offline update data saved</em> '); } }); - $('#offline_clear').html('<button id="js-clear-localStorage">Clear offline data</button>'); + $('#offline_clear').css('margin-top', '5em').html('<button id="js-clear-localStorage">Clear offline data</button>'); $('#js-clear-localStorage').click(function() { - fixmystreet.offline.removeReports(fixmystreet.offlineData.getCachedUrls()); - fixmystreet.offlineData.clearForms(); - localStorage.removeItem('/my/planned'); - alert('Offline data cleared'); + if (window.confirm("Are you sure?")) { + fixmystreet.offline.removeReports(fixmystreet.offlineData.getCachedUrls()); + fixmystreet.offlineData.clearForms(); + localStorage.removeItem('/my/planned'); + alert('Offline data cleared'); + } }); } } |