From e03d6c359b0cca1c35ce8fd3b21ec26ad7bc80f4 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Mon, 11 May 2015 12:35:39 +0200 Subject: [PATCH] show a banner at the bottom when a new version is available --- public/css/style.css | 21 +++++++++++++++++++++ views/appcache.php | 2 +- views/layout.php | 6 ++++++ views/new-post.php | 12 +++++++++++- 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index a3ec2a9..a50d774 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -45,6 +45,27 @@ body { } +#new_version_available { + display: none; + position: fixed; + z-index: 1000; + bottom: 0; + left: 0; + right: 0; + background: rgba(255,255,255,0.9); +} +#new_version_available .inner { + padding: 10px; + width: 300px; + margin: 0 auto; + text-align: center; + font-weight: bold; + color: #cf224f; +} + + + + /** * Bootstrap callouts */ diff --git a/views/appcache.php b/views/appcache.php index 50e2d83..8b883d6 100644 --- a/views/appcache.php +++ b/views/appcache.php @@ -12,4 +12,4 @@ CACHE MANIFEST NETWORK: * -# v11 +# v25 diff --git a/views/layout.php b/views/layout.php index 8a207dc..ea1480a 100644 --- a/views/layout.php +++ b/views/layout.php @@ -65,5 +65,11 @@ +
+
+ There is a new version available! Refresh to load the new version. +
+
+ \ No newline at end of file diff --git a/views/new-post.php b/views/new-post.php index 760f27f..fbd3716 100644 --- a/views/new-post.php +++ b/views/new-post.php @@ -209,6 +209,16 @@ $(function(){ } }); + function onUpdateReady() { + // Show the notice that says there is a new version of the app + $("#new_version_available").show(); + } + + window.applicationCache.addEventListener('updateready', onUpdateReady); + if(window.applicationCache.status === window.applicationCache.UPDATEREADY) { + onUpdateReady(); + } + }); @@ -220,4 +230,4 @@ $(function(){ .scroll-container .break { word-break: break-all; } - \ No newline at end of file +