summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/ios/www/js/lib/_router.js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/lib/_router.js')
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/_router.js198
1 files changed, 98 insertions, 100 deletions
diff --git a/StoneIsland/platforms/ios/www/js/lib/_router.js b/StoneIsland/platforms/ios/www/js/lib/_router.js
index 7d487689..42909963 100755
--- a/StoneIsland/platforms/ios/www/js/lib/_router.js
+++ b/StoneIsland/platforms/ios/www/js/lib/_router.js
@@ -1,110 +1,107 @@
var SiteRouter = Router.extend({
+ el: "body",
+ routeByHash: true,
- el: 'body',
- routeByHash: true,
-
- routes: {
- '/': 'intro',
- '/intro': 'intro',
- '/hub': 'hub',
- '/story': 'story',
- '/archive': 'archive',
+ routes: {
+ "/": "intro",
+ "/intro": "intro",
+ "/hub": "hub",
+ "/story": "story",
+ "/archive": "archive",
- '/store': 'collection',
- '/store/closed': 'closed',
- '/store/:code': 'product',
+ "/store": "collection",
+ "/store/closed": "closed",
+ "/store/:code": "product",
- '/account/login': 'login',
- '/account/logout': 'logout',
- '/account/signup': 'signup',
- '/account/profile': 'profile',
- '/account/payment': 'payment',
- '/account/shipping': 'shipping',
- '/account/orders': 'orders',
- '/account/settings': 'settings',
+ "/account/login": "login",
+ "/account/logout": "logout",
+ "/account/signup": "signup",
+ "/account/profile": "profile",
+ "/account/payment": "payment",
+ "/account/shipping": "shipping",
+ "/account/orders": "orders",
+ "/account/settings": "settings",
- '/page/terms': 'terms',
- '/page/account_terms': 'account_terms',
- '/page/privacy': 'privacy',
- '/page/returns': 'returns',
- '/page/care': 'care',
-
- '/search': 'search',
+ "/page/terms": "terms",
+ "/page/account_terms": "account_terms",
+ "/page/privacy": "privacy",
+ "/page/returns": "returns",
+ "/page/care": "care",
- '/cart': 'cart.summary',
- '/cart/summary': 'cart.summary',
- '/cart/payment': 'cart.payment',
- '/cart/shipping': 'cart.shipping',
- '/cart/confirm': 'cart.confirm',
- '/cart/thanks': 'cart.thanks',
- '/cart/error': 'cart.error',
- },
+ "/search": "search",
+
+ "/cart": "cart.summary",
+ "/cart/summary": "cart.summary",
+ "/cart/payment": "cart.payment",
+ "/cart/shipping": "cart.shipping",
+ "/cart/confirm": "cart.confirm",
+ "/cart/thanks": "cart.thanks",
+ "/cart/error": "cart.error",
+ },
terms_routes: [
- 'terms',
- 'account_terms',
- 'privacy',
- 'returns',
- 'care',
- 'logout',
+ "terms",
+ "account_terms",
+ "privacy",
+ "returns",
+ "care",
+ "logout",
],
- initialize: function(){
- var fn
+ initialize: function () {
+ var fn;
for (var route in this.routes) {
- fn = this.routes[route]
- if (! this[fn]) {
- this[fn] = this.default_view(fn)
+ fn = this.routes[route];
+ if (!this[fn]) {
+ this[fn] = this.default_view(fn);
}
}
- },
-
+ },
+
initial_route: null,
- launch: function(){
- console.log("LAUNCH!")
- if (this.initial_route) {
- this.parseRoute( this.initial_route )
- }
- else {
- this.route()
- }
- this.initial_route = null
+ launch: function () {
+ console.log("LAUNCH!");
+ if (this.initial_route) {
+ this.parseRoute(this.initial_route);
+ } else {
+ this.route();
+ }
+ this.initial_route = null;
- app.finished_launching()
- },
+ app.finished_launching();
+ },
- go: function(url){
+ go: function (url) {
if (app.view && app.view.hide) {
- app.view.hide()
+ app.view.hide();
}
- window.location.href = "#/" + url
- this.parseRoute(url)
+ window.location.href = "#/" + url;
+ this.parseRoute(url);
},
-
- default_view: function(name){
- var fn = function(){
- console.log(name)
- var n = [name]
+
+ default_view: function (name) {
+ var fn = function () {
+ console.log(name);
+ var n = [name];
if (app.view != app.login && app.view != app.signin) {
- app.last_view = app.view
+ app.last_view = app.view;
}
if (app.view && app.view.hide) {
- app.view.hide()
+ app.view.hide();
}
if (name.match(/\./)) {
- n = name.split(".")
- console.log(name, n)
- app.view = app[n[0]][n[1]]
- }
- else {
- app.view = app[name]
+ n = name.split(".");
+ console.log(name, n);
+ app.view = app[n[0]][n[1]];
+ } else {
+ app.view = app[name];
}
// window.FirebasePlugin && window.FirebasePlugin.setScreenName(name)
- analytics.sendPageView(name)
- console.log("view >>", app.view)
- app.header.set_back( !! app.view.back )
- app.view.show()
+ analytics.sendPageView(name);
+ console.log("view >>", app.view);
+ app.header.set_back(!!app.view.back);
+ app.view.show();
// var isTermsRoute = this.terms_routes.indexOf(name) !== -1
// var isCartRoute = n[0] === 'cart'
@@ -113,28 +110,29 @@ var SiteRouter = Router.extend({
// return
// }
- var isNotTermsRoute = this.terms_routes.indexOf(name) === -1
- var isCartRoute = n[0] === 'cart'
- var userMightActuallyViewCart = isCartRoute && auth.logged_in()
- var demandingConsent = app.demand_consent && isNotTermsRoute
- if ((userMightActuallyViewCart || demandingConsent) && app.account.consent.check()) {
- console.log('showed consent modal')
- return
+ var isNotTermsRoute = this.terms_routes.indexOf(name) === -1;
+ var isCartRoute = n[0] === "cart";
+ var userMightActuallyViewCart = isCartRoute && auth.logged_in();
+ var demandingConsent = app.demand_consent && isNotTermsRoute;
+ if (
+ (userMightActuallyViewCart || demandingConsent) &&
+ app.account.consent.check()
+ ) {
+ // console.log('showed consent modal')
+ return;
}
- }.bind(this)
- return fn
+ }.bind(this);
+ return fn;
},
- product: function(code){
+ product: function (code) {
if (app.view && app.view.hide) {
- app.view.hide()
+ app.view.hide();
}
- analytics.sendPageView('store/' + code)
- app.view = app.product
- app.header.set_back( true )
- app.product.load(code)
- app.product.show()
- },
-
-})
-
+ analytics.sendPageView("store/" + code);
+ app.view = app.product;
+ app.header.set_back(true);
+ app.product.load(code);
+ app.product.show();
+ },
+});