aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--templates/web/base/offline/appcache.html2
-rw-r--r--web/cobrands/fixmystreet/offline.js12
2 files changed, 14 insertions, 0 deletions
diff --git a/templates/web/base/offline/appcache.html b/templates/web/base/offline/appcache.html
index 6f701321a..5a8ba1463 100644
--- a/templates/web/base/offline/appcache.html
+++ b/templates/web/base/offline/appcache.html
@@ -7,4 +7,6 @@ page wasn’t found or there was a server error. Please try again later.</p>
<ul class="item-list item-list--reports" id="offline_list"></ul>
+<div id="offline_clear"></div>
+
[% INCLUDE 'footer.html' %]
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);