aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/cobrands/fixmystreet/offline.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/web/cobrands/fixmystreet/offline.js b/web/cobrands/fixmystreet/offline.js
index c875c9b84..c1a93f738 100644
--- a/web/cobrands/fixmystreet/offline.js
+++ b/web/cobrands/fixmystreet/offline.js
@@ -127,6 +127,11 @@ fixmystreet.offlineData = (function() {
saveData();
fixmystreet.offlineBanner.update();
},
+ clearForms: function(idx) {
+ getData().forms = [];
+ saveData();
+ fixmystreet.offlineBanner.update();
+ },
getCachedUrls: function() {
return Object.keys(getData().cachedReports);
},
@@ -370,6 +375,13 @@ if ($('#offline_list').length) {
$(this).find('h3').prepend('<em>Form data saved</em> ');
}
});
+ $('#offline_clear').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');
+ });
}
}
fixmystreet.offlineBanner.make(true);