diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-08-05 18:33:24 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-08-05 18:33:24 -0400 |
| commit | 1d2c2624c6e84c0f5ea7f7f7fc8e638a6ea5bcdd (patch) | |
| tree | 0e54d0caf47eeb1448aaf0cdb1c70439d1a065b3 /public/assets/javascripts/ui | |
| parent | 8cf6d964f91354f85a2b831e2b6e313b04a72173 (diff) | |
| parent | bac4d6a8c8566814e851452bedf5fa7ce596d54d (diff) | |
Merge branch 'mobile'
Diffstat (limited to 'public/assets/javascripts/ui')
| -rw-r--r-- | public/assets/javascripts/ui/_router.js | 22 | ||||
| -rw-r--r-- | public/assets/javascripts/ui/editor/EditorSettings.js | 2 | ||||
| -rw-r--r-- | public/assets/javascripts/ui/lib/Router.js | 21 |
3 files changed, 27 insertions, 18 deletions
diff --git a/public/assets/javascripts/ui/_router.js b/public/assets/javascripts/ui/_router.js index 4ff3581..d07810e 100644 --- a/public/assets/javascripts/ui/_router.js +++ b/public/assets/javascripts/ui/_router.js @@ -36,11 +36,18 @@ var SiteRouter = Router.extend({ "/project": 'projectPicker', "/project/new": 'newProject', "/project/new/:layout": 'projectNewWithLayout', - "/project/:name": 'project', + "/project/:name": 'projectViewer', + "/project/:name/edit": 'projectEditor', "/project/:name/view": 'projectViewer', "/test/wallpaper": 'testWallpaper', }, + + mobileRoutes: { + "/": 'home', + "/profile": 'profile', + "/project/:name": 'projectViewer', + }, initialize: function(){ this.signUpModal = new SignUpModal() @@ -56,6 +63,11 @@ var SiteRouter = Router.extend({ this.route() + if (is_mobile) { + $(".topLinks").hide() + $(".share").hide() + } + $("body").removeClass("loading") }, @@ -123,14 +135,6 @@ var SiteRouter = Router.extend({ this.readerView.load(name) }, -/* - editProject: function(e){ - e && e.preventDefault() - window.history.pushState(null, document.title, "/project/edit") - this.editProjectModal.load() - }, -*/ - signup: function(e){ e && e.preventDefault() window.history.pushState(null, document.title, "/signup") diff --git a/public/assets/javascripts/ui/editor/EditorSettings.js b/public/assets/javascripts/ui/editor/EditorSettings.js index 13a6f60..d6a79fb 100644 --- a/public/assets/javascripts/ui/editor/EditorSettings.js +++ b/public/assets/javascripts/ui/editor/EditorSettings.js @@ -130,7 +130,7 @@ var EditorSettings = FormView.extend({ this.$name.val(data.name) this.action = this.updateAction - window.history.pushState(null, document.title, "/project/" + data.slug) + window.history.pushState(null, document.title, "/project/" + data.slug + "/edit") }, }) diff --git a/public/assets/javascripts/ui/lib/Router.js b/public/assets/javascripts/ui/lib/Router.js index 5877f93..0b6385c 100644 --- a/public/assets/javascripts/ui/lib/Router.js +++ b/public/assets/javascripts/ui/lib/Router.js @@ -4,7 +4,8 @@ var Router = View.extend({ this.originalPath = window.location.pathname - var pathname = window.location.pathname, + var routes = is_mobile ? this.mobileRoutes : this.routes, + pathname = window.location.pathname, path = pathname.split("/"); for (var i = 0; i < path.length; i++) { @@ -13,7 +14,7 @@ var Router = View.extend({ } } - if (pathname in this.routes) { + if (pathname in routes) { this[this.routes[pathname]](null) } @@ -21,35 +22,39 @@ var Router = View.extend({ path.pop() } - for (var route in this.routes) { + for (var route in routes) { var routePath = route.split("/") if (routePath[1] == path[1]) { if (routePath[2] && routePath[2].indexOf(":") !== -1 && path[2] && (path[3] === routePath[3]) ) { this[this.routes[route]](null, path[2]) - break; + return } else if (routePath[2] == path[2]) { if (routePath[3] && path[3]) { if (routePath[3].indexOf(":") !== -1) { this[this.routes[route]](null, path[3]) - break; + return } else if (routePath[3] == path[3]) { this[this.routes[route]](null) - break; + return } } else if (! routePath[3] && ! path[3]) { this[this.routes[route]](null) - break; + return } } else if (! routePath[2] && (! path[2].length || ! path[2])) { this[this.routes[route]](null) - break; + return } } } + + if (is_mobile) { + window.location.href = "/" + } } }) |
