summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2016-01-20 23:51:37 +0100
committerJules Laplace <jules@okfoc.us>2016-01-20 23:51:37 +0100
commita1fbe0b115fd9f9b654dae79f266581c32ba00d2 (patch)
tree5d3fd9e4401bbfeff572ba4530630a731e252ad8
parent0a6a76b07644f38b2599a6bb0c462e82cdecbf8a (diff)
backup db, handle being offline better
-rwxr-xr-xStoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstatebin41992 -> 41993 bytes
-rwxr-xr-xStoneIsland/platforms/ios/www/index.html1
-rwxr-xr-xStoneIsland/platforms/ios/www/js/index.js40
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/_router.js7
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/account/OrdersView.js5
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/account/PaymentView.js5
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/account/ProfileView.js5
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/account/SettingsView.js5
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/account/ShippingView.js5
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js3
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/blogs/HubView.js5
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js3
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/cart/CartView.js5
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/etc/backup_db.js (renamed from StoneIsland/platforms/ios/www/db.json)2
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/etc/geo.js2
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/products/ClosedStoreView.js12
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/products/CollectionView.js5
-rwxr-xr-xStoneIsland/www/index.html1
-rwxr-xr-xStoneIsland/www/js/index.js40
-rwxr-xr-xStoneIsland/www/js/lib/_router.js7
-rwxr-xr-xStoneIsland/www/js/lib/account/OrdersView.js5
-rwxr-xr-xStoneIsland/www/js/lib/account/PaymentView.js5
-rwxr-xr-xStoneIsland/www/js/lib/account/ProfileView.js5
-rwxr-xr-xStoneIsland/www/js/lib/account/SettingsView.js5
-rwxr-xr-xStoneIsland/www/js/lib/account/ShippingView.js5
-rwxr-xr-xStoneIsland/www/js/lib/blogs/ArchiveView.js3
-rwxr-xr-xStoneIsland/www/js/lib/blogs/HubView.js5
-rwxr-xr-xStoneIsland/www/js/lib/blogs/StoryView.js3
-rwxr-xr-xStoneIsland/www/js/lib/cart/CartView.js5
-rwxr-xr-xStoneIsland/www/js/lib/etc/backup_db.js (renamed from StoneIsland/www/db.json)2
-rwxr-xr-xStoneIsland/www/js/lib/products/ClosedStoreView.js12
-rwxr-xr-xStoneIsland/www/js/lib/products/CollectionView.js5
32 files changed, 187 insertions, 31 deletions
diff --git a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate b/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate
index c19c9120..909b622c 100755
--- a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate
+++ b/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate
Binary files differ
diff --git a/StoneIsland/platforms/ios/www/index.html b/StoneIsland/platforms/ios/www/index.html
index d24b2836..c1f497bf 100755
--- a/StoneIsland/platforms/ios/www/index.html
+++ b/StoneIsland/platforms/ios/www/index.html
@@ -1099,6 +1099,7 @@
<script src="js/lib/etc/push.js"></script>
<script src="js/lib/etc/deeplink.js"></script>
<script src="js/lib/etc/geo.js"></script>
+<script src="js/lib/etc/backup_db.js"></script>
<script src="js/lib/view/View.js"></script>
<script src="js/lib/view/Router.js"></script>
diff --git a/StoneIsland/platforms/ios/www/js/index.js b/StoneIsland/platforms/ios/www/js/index.js
index 4f1747ab..b112721d 100755
--- a/StoneIsland/platforms/ios/www/js/index.js
+++ b/StoneIsland/platforms/ios/www/js/index.js
@@ -1,7 +1,8 @@
var app = (function(){
var app = {}
- app.init = function(){
+ app.init = function(){
+ console.log("init")
sdk.init({ env: "production" })
@@ -63,6 +64,7 @@ var app = (function(){
}
app.ready = function(){
+ console.log(">> READY")
if (window.cordova) {
document.addEventListener('pause', app.paused, false)
document.addEventListener('resume', app.resumed, false)
@@ -74,13 +76,33 @@ var app = (function(){
app.view = null
app.router = new SiteRouter ()
-// if (sdk.env == "test") {
-// app.router.launch()
-// }
-// else {
+
+// if (sdk.env == "test") {
+// app.router.launch()
+// }
+// else {
+// }
+
+ if (navigator.onLine) {
+ app.account.connect( app.router.launch.bind(app.router) )
+ }
+ else {
+ console.log(">> LAUNCHED WHILE OFFLINE")
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO BROWSE THE STONE ISLAND STORE", "")
+ app.state.launched_while_offline = true
+ app.finished_launching()
+ }
+
push.init()
- app.account.connect( app.router.launch.bind(app.router) )
-// }
+ }
+
+ app.finished_launching = function(){
+ console.log(">> FINISHED LAUNCHING")
+ if (window.cordova) {
+ navigator.splashscreen.hide()
+ }
+ $("body").removeClass("loading")
}
var refresh_time = +Date.now()
@@ -96,6 +118,10 @@ var app = (function(){
app.online = function(){
console.log(">> ONLINE")
+ if (app.state.launched_while_offline) {
+ app.state.launched_while_offline = false
+ app.router.go("intro")
+ }
}
app.offline = function(){
console.log(">> OFFLINE")
diff --git a/StoneIsland/platforms/ios/www/js/lib/_router.js b/StoneIsland/platforms/ios/www/js/lib/_router.js
index 6ec14825..9927712a 100755
--- a/StoneIsland/platforms/ios/www/js/lib/_router.js
+++ b/StoneIsland/platforms/ios/www/js/lib/_router.js
@@ -58,11 +58,8 @@ var SiteRouter = Router.extend({
this.route()
}
this.initial_route = null
-
- if (window.cordova) {
- navigator.splashscreen.hide()
- }
- $("body").removeClass("loading")
+
+ app.finished_launching()
},
go: function(url){
diff --git a/StoneIsland/platforms/ios/www/js/lib/account/OrdersView.js b/StoneIsland/platforms/ios/www/js/lib/account/OrdersView.js
index a1b83767..b3ff3e7a 100755
--- a/StoneIsland/platforms/ios/www/js/lib/account/OrdersView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/account/OrdersView.js
@@ -31,6 +31,11 @@ var OrdersView = ScrollableView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO VIEW<br>YOUR ORDERS.", "")
+ return
+ }
app.header.set_back(false)
app.footer.hide()
document.body.className = "orders"
diff --git a/StoneIsland/platforms/ios/www/js/lib/account/PaymentView.js b/StoneIsland/platforms/ios/www/js/lib/account/PaymentView.js
index 8b49ed1d..0e300f9b 100755
--- a/StoneIsland/platforms/ios/www/js/lib/account/PaymentView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/account/PaymentView.js
@@ -34,6 +34,11 @@ var PaymentView = FormView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO CHANGE<br>YOUR PAYMENT INFO.", "")
+ return
+ }
app.footer.show("SAVE")
document.body.className = "payment"
this.deferScrollToTop()
diff --git a/StoneIsland/platforms/ios/www/js/lib/account/ProfileView.js b/StoneIsland/platforms/ios/www/js/lib/account/ProfileView.js
index d36f7f38..df6bc865 100755
--- a/StoneIsland/platforms/ios/www/js/lib/account/ProfileView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/account/ProfileView.js
@@ -15,6 +15,11 @@ var ProfileView = FormView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO<br>EDIT YOUR PROFILE.", "")
+ return
+ }
app.footer.show("SAVE")
document.body.className = "profile"
if (auth.user.BirthDay.match(/T/)) {
diff --git a/StoneIsland/platforms/ios/www/js/lib/account/SettingsView.js b/StoneIsland/platforms/ios/www/js/lib/account/SettingsView.js
index 0d6fa807..f6eae13c 100755
--- a/StoneIsland/platforms/ios/www/js/lib/account/SettingsView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/account/SettingsView.js
@@ -17,6 +17,11 @@ var SettingsView = FormView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO CHANGE<br>YOUR NOTIFICATION SETTINGS.", "")
+ return
+ }
document.body.className = "settings"
this.deferScrollToTop()
diff --git a/StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js b/StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js
index 0bf88025..3b7b555a 100755
--- a/StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js
@@ -32,6 +32,11 @@ var ShippingView = FormView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO<br>EDIT YOUR SHIPPING INFO.", "")
+ return
+ }
// this.preload( this.data || this.test_data )
app.footer.show("SAVE")
document.body.className = "shipping"
diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js
index e7211036..5a024ac9 100755
--- a/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js
@@ -44,6 +44,9 @@ var ArchiveView = ScrollableView.extend({
app.footer.hide()
this.back()
document.body.className = "archive"
+ if (! this.populated) {
+ this.populate( BACKUP_DB.archive )
+ }
},
populate: function(data){
diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js
index 687a3b95..9433b686 100755
--- a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js
@@ -21,11 +21,16 @@ var HubView = ScrollableView.extend({
this.deferScrollToTop()
app.footer.hide()
document.body.className = "hub"
+ if (! this.populated) {
+ this.populate( BACKUP_DB.hub )
+ }
},
galleries: {},
+ populated: false,
populate: function(data){
// sort posts by date, reversed
+ this.populated = true
this.data = data.map(function(s){
return [ +moment(s.date), s ]
}).sort(function(a,b){
diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js
index 73b7b83b..808a28b5 100755
--- a/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js
@@ -23,6 +23,9 @@ var StoryView = ScrollableView.extend({
this.deferScrollToTop()
app.footer.hide()
document.body.className = "story"
+ if (! this.populated) {
+ this.populate( BACKUP_DB.story )
+ }
},
populate: function(data){
diff --git a/StoneIsland/platforms/ios/www/js/lib/cart/CartView.js b/StoneIsland/platforms/ios/www/js/lib/cart/CartView.js
index 9fd7bc8d..a10efb46 100755
--- a/StoneIsland/platforms/ios/www/js/lib/cart/CartView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/cart/CartView.js
@@ -36,6 +36,11 @@ var CartView = View.extend({
},
show: function(){
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO<br>VIEW YOUR CART.", "")
+ return
+ }
document.body.className = "cart"
this.show_summary()
},
diff --git a/StoneIsland/platforms/ios/www/db.json b/StoneIsland/platforms/ios/www/js/lib/etc/backup_db.js
index e45cf316..eec5c415 100755
--- a/StoneIsland/platforms/ios/www/db.json
+++ b/StoneIsland/platforms/ios/www/js/lib/etc/backup_db.js
@@ -1,4 +1,4 @@
-{
+var BACKUP_DB = {
"story": [
{
"id": "philosophy",
diff --git a/StoneIsland/platforms/ios/www/js/lib/etc/geo.js b/StoneIsland/platforms/ios/www/js/lib/etc/geo.js
index 5af9ecfd..885a1c6c 100755
--- a/StoneIsland/platforms/ios/www/js/lib/etc/geo.js
+++ b/StoneIsland/platforms/ios/www/js/lib/etc/geo.js
@@ -10,7 +10,7 @@ var geo = (function(){
geo.success = function(position){
var lat_str = as_degrees( position.coords.latitude || 40.99167, "N", "S" )
- var lng_str = as_degrees( position.coords.longitude || -74.07944, "W", "E" )
+ var lng_str = as_degrees( position.coords.longitude || -74.07944, "E", "W" )
$(".latlng").html( lat_str + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + lng_str )
geo.done()
}
diff --git a/StoneIsland/platforms/ios/www/js/lib/products/ClosedStoreView.js b/StoneIsland/platforms/ios/www/js/lib/products/ClosedStoreView.js
index 2f242ba4..97b46006 100755
--- a/StoneIsland/platforms/ios/www/js/lib/products/ClosedStoreView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/products/ClosedStoreView.js
@@ -19,12 +19,20 @@ var ClosedStoreView = View.extend({
},
show: function(){
+ this.setMessage(app.closed.storeClosedMessageOne, app.closed.storeClosedMessageTwo)
+ this.showElement()
+ },
+
+ showElement: function(){
document.body.className = "closed"
this.animate()
app.footer.hide()
- $(".closed_store_msg h3").html(app.closed.storeClosedMessageOne || "THIS STORE IS CURRENTLY CLOSED")
+ },
+
+ setMessage: function(msg_one, msg_two){
+ $(".closed_store_msg h3").html(msg_one || "THIS STORE IS CURRENTLY CLOSED")
if (app.closed.storeClosedMessageTwo) {
- $(".closed_store_msg h4").show().html(app.closed.storeClosedMessageTwo)
+ $(".closed_store_msg h4").show().html(msg_two)
}
else {
$(".closed_store_msg h4").hide()
diff --git a/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js b/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js
index 5480c016..3745f563 100755
--- a/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js
+++ b/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js
@@ -25,6 +25,11 @@ var CollectionView = ScrollableView.extend({
},
show: function(){
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO BROWSE<br>THE STONE ISLAND STORE.", "")
+ return
+ }
if (sdk.env !== "test" && app.closed.storeIsClosed) {
return app.closed.show()
}
diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html
index d24b2836..c1f497bf 100755
--- a/StoneIsland/www/index.html
+++ b/StoneIsland/www/index.html
@@ -1099,6 +1099,7 @@
<script src="js/lib/etc/push.js"></script>
<script src="js/lib/etc/deeplink.js"></script>
<script src="js/lib/etc/geo.js"></script>
+<script src="js/lib/etc/backup_db.js"></script>
<script src="js/lib/view/View.js"></script>
<script src="js/lib/view/Router.js"></script>
diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js
index 4f1747ab..b112721d 100755
--- a/StoneIsland/www/js/index.js
+++ b/StoneIsland/www/js/index.js
@@ -1,7 +1,8 @@
var app = (function(){
var app = {}
- app.init = function(){
+ app.init = function(){
+ console.log("init")
sdk.init({ env: "production" })
@@ -63,6 +64,7 @@ var app = (function(){
}
app.ready = function(){
+ console.log(">> READY")
if (window.cordova) {
document.addEventListener('pause', app.paused, false)
document.addEventListener('resume', app.resumed, false)
@@ -74,13 +76,33 @@ var app = (function(){
app.view = null
app.router = new SiteRouter ()
-// if (sdk.env == "test") {
-// app.router.launch()
-// }
-// else {
+
+// if (sdk.env == "test") {
+// app.router.launch()
+// }
+// else {
+// }
+
+ if (navigator.onLine) {
+ app.account.connect( app.router.launch.bind(app.router) )
+ }
+ else {
+ console.log(">> LAUNCHED WHILE OFFLINE")
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO BROWSE THE STONE ISLAND STORE", "")
+ app.state.launched_while_offline = true
+ app.finished_launching()
+ }
+
push.init()
- app.account.connect( app.router.launch.bind(app.router) )
-// }
+ }
+
+ app.finished_launching = function(){
+ console.log(">> FINISHED LAUNCHING")
+ if (window.cordova) {
+ navigator.splashscreen.hide()
+ }
+ $("body").removeClass("loading")
}
var refresh_time = +Date.now()
@@ -96,6 +118,10 @@ var app = (function(){
app.online = function(){
console.log(">> ONLINE")
+ if (app.state.launched_while_offline) {
+ app.state.launched_while_offline = false
+ app.router.go("intro")
+ }
}
app.offline = function(){
console.log(">> OFFLINE")
diff --git a/StoneIsland/www/js/lib/_router.js b/StoneIsland/www/js/lib/_router.js
index 6ec14825..9927712a 100755
--- a/StoneIsland/www/js/lib/_router.js
+++ b/StoneIsland/www/js/lib/_router.js
@@ -58,11 +58,8 @@ var SiteRouter = Router.extend({
this.route()
}
this.initial_route = null
-
- if (window.cordova) {
- navigator.splashscreen.hide()
- }
- $("body").removeClass("loading")
+
+ app.finished_launching()
},
go: function(url){
diff --git a/StoneIsland/www/js/lib/account/OrdersView.js b/StoneIsland/www/js/lib/account/OrdersView.js
index a1b83767..b3ff3e7a 100755
--- a/StoneIsland/www/js/lib/account/OrdersView.js
+++ b/StoneIsland/www/js/lib/account/OrdersView.js
@@ -31,6 +31,11 @@ var OrdersView = ScrollableView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO VIEW<br>YOUR ORDERS.", "")
+ return
+ }
app.header.set_back(false)
app.footer.hide()
document.body.className = "orders"
diff --git a/StoneIsland/www/js/lib/account/PaymentView.js b/StoneIsland/www/js/lib/account/PaymentView.js
index 8b49ed1d..0e300f9b 100755
--- a/StoneIsland/www/js/lib/account/PaymentView.js
+++ b/StoneIsland/www/js/lib/account/PaymentView.js
@@ -34,6 +34,11 @@ var PaymentView = FormView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO CHANGE<br>YOUR PAYMENT INFO.", "")
+ return
+ }
app.footer.show("SAVE")
document.body.className = "payment"
this.deferScrollToTop()
diff --git a/StoneIsland/www/js/lib/account/ProfileView.js b/StoneIsland/www/js/lib/account/ProfileView.js
index d36f7f38..df6bc865 100755
--- a/StoneIsland/www/js/lib/account/ProfileView.js
+++ b/StoneIsland/www/js/lib/account/ProfileView.js
@@ -15,6 +15,11 @@ var ProfileView = FormView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO<br>EDIT YOUR PROFILE.", "")
+ return
+ }
app.footer.show("SAVE")
document.body.className = "profile"
if (auth.user.BirthDay.match(/T/)) {
diff --git a/StoneIsland/www/js/lib/account/SettingsView.js b/StoneIsland/www/js/lib/account/SettingsView.js
index 0d6fa807..f6eae13c 100755
--- a/StoneIsland/www/js/lib/account/SettingsView.js
+++ b/StoneIsland/www/js/lib/account/SettingsView.js
@@ -17,6 +17,11 @@ var SettingsView = FormView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO CHANGE<br>YOUR NOTIFICATION SETTINGS.", "")
+ return
+ }
document.body.className = "settings"
this.deferScrollToTop()
diff --git a/StoneIsland/www/js/lib/account/ShippingView.js b/StoneIsland/www/js/lib/account/ShippingView.js
index 0bf88025..3b7b555a 100755
--- a/StoneIsland/www/js/lib/account/ShippingView.js
+++ b/StoneIsland/www/js/lib/account/ShippingView.js
@@ -32,6 +32,11 @@ var ShippingView = FormView.extend({
show: function(){
if (! auth.logged_in()) { return app.router.go("intro") }
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO<br>EDIT YOUR SHIPPING INFO.", "")
+ return
+ }
// this.preload( this.data || this.test_data )
app.footer.show("SAVE")
document.body.className = "shipping"
diff --git a/StoneIsland/www/js/lib/blogs/ArchiveView.js b/StoneIsland/www/js/lib/blogs/ArchiveView.js
index e7211036..5a024ac9 100755
--- a/StoneIsland/www/js/lib/blogs/ArchiveView.js
+++ b/StoneIsland/www/js/lib/blogs/ArchiveView.js
@@ -44,6 +44,9 @@ var ArchiveView = ScrollableView.extend({
app.footer.hide()
this.back()
document.body.className = "archive"
+ if (! this.populated) {
+ this.populate( BACKUP_DB.archive )
+ }
},
populate: function(data){
diff --git a/StoneIsland/www/js/lib/blogs/HubView.js b/StoneIsland/www/js/lib/blogs/HubView.js
index 687a3b95..9433b686 100755
--- a/StoneIsland/www/js/lib/blogs/HubView.js
+++ b/StoneIsland/www/js/lib/blogs/HubView.js
@@ -21,11 +21,16 @@ var HubView = ScrollableView.extend({
this.deferScrollToTop()
app.footer.hide()
document.body.className = "hub"
+ if (! this.populated) {
+ this.populate( BACKUP_DB.hub )
+ }
},
galleries: {},
+ populated: false,
populate: function(data){
// sort posts by date, reversed
+ this.populated = true
this.data = data.map(function(s){
return [ +moment(s.date), s ]
}).sort(function(a,b){
diff --git a/StoneIsland/www/js/lib/blogs/StoryView.js b/StoneIsland/www/js/lib/blogs/StoryView.js
index 73b7b83b..808a28b5 100755
--- a/StoneIsland/www/js/lib/blogs/StoryView.js
+++ b/StoneIsland/www/js/lib/blogs/StoryView.js
@@ -23,6 +23,9 @@ var StoryView = ScrollableView.extend({
this.deferScrollToTop()
app.footer.hide()
document.body.className = "story"
+ if (! this.populated) {
+ this.populate( BACKUP_DB.story )
+ }
},
populate: function(data){
diff --git a/StoneIsland/www/js/lib/cart/CartView.js b/StoneIsland/www/js/lib/cart/CartView.js
index 9fd7bc8d..a10efb46 100755
--- a/StoneIsland/www/js/lib/cart/CartView.js
+++ b/StoneIsland/www/js/lib/cart/CartView.js
@@ -36,6 +36,11 @@ var CartView = View.extend({
},
show: function(){
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO<br>VIEW YOUR CART.", "")
+ return
+ }
document.body.className = "cart"
this.show_summary()
},
diff --git a/StoneIsland/www/db.json b/StoneIsland/www/js/lib/etc/backup_db.js
index e45cf316..eec5c415 100755
--- a/StoneIsland/www/db.json
+++ b/StoneIsland/www/js/lib/etc/backup_db.js
@@ -1,4 +1,4 @@
-{
+var BACKUP_DB = {
"story": [
{
"id": "philosophy",
diff --git a/StoneIsland/www/js/lib/products/ClosedStoreView.js b/StoneIsland/www/js/lib/products/ClosedStoreView.js
index 2f242ba4..97b46006 100755
--- a/StoneIsland/www/js/lib/products/ClosedStoreView.js
+++ b/StoneIsland/www/js/lib/products/ClosedStoreView.js
@@ -19,12 +19,20 @@ var ClosedStoreView = View.extend({
},
show: function(){
+ this.setMessage(app.closed.storeClosedMessageOne, app.closed.storeClosedMessageTwo)
+ this.showElement()
+ },
+
+ showElement: function(){
document.body.className = "closed"
this.animate()
app.footer.hide()
- $(".closed_store_msg h3").html(app.closed.storeClosedMessageOne || "THIS STORE IS CURRENTLY CLOSED")
+ },
+
+ setMessage: function(msg_one, msg_two){
+ $(".closed_store_msg h3").html(msg_one || "THIS STORE IS CURRENTLY CLOSED")
if (app.closed.storeClosedMessageTwo) {
- $(".closed_store_msg h4").show().html(app.closed.storeClosedMessageTwo)
+ $(".closed_store_msg h4").show().html(msg_two)
}
else {
$(".closed_store_msg h4").hide()
diff --git a/StoneIsland/www/js/lib/products/CollectionView.js b/StoneIsland/www/js/lib/products/CollectionView.js
index 5480c016..3745f563 100755
--- a/StoneIsland/www/js/lib/products/CollectionView.js
+++ b/StoneIsland/www/js/lib/products/CollectionView.js
@@ -25,6 +25,11 @@ var CollectionView = ScrollableView.extend({
},
show: function(){
+ if (! navigator.onLine) {
+ app.closed.showElement()
+ app.closed.setMessage("PLEASE GO ONLINE TO BROWSE<br>THE STONE ISLAND STORE.", "")
+ return
+ }
if (sdk.env !== "test" && app.closed.storeIsClosed) {
return app.closed.show()
}