From b0c42c12b76dd41b67a1a12cd8a354dccf46755b Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Mon, 27 Jul 2015 17:01:30 -0700 Subject: [PATCH] [Mobile] Back Arrow Changes URL correctly that is printed to the console. Is the url to up one level of objects. However not navigating to that object. --- .../browse/res/templates/back-arrow.html | 5 ++-- .../commonUI/browse/src/BrowseController.js | 12 +++------ .../general/res/css/theme-espresso.css | 4 --- .../general/res/sass/mobile/_layout.scss | 2 +- .../general/src/services/UrlService.js | 27 ++++++++++++++++++- .../inspect/src/gestures/InfoGesture.js | 5 ++-- 6 files changed, 36 insertions(+), 19 deletions(-) diff --git a/platform/commonUI/browse/res/templates/back-arrow.html b/platform/commonUI/browse/res/templates/back-arrow.html index 525398f96a..69b8320734 100644 --- a/platform/commonUI/browse/res/templates/back-arrow.html +++ b/platform/commonUI/browse/res/templates/back-arrow.html @@ -20,6 +20,7 @@ at runtime from the About dialog for additional information. --> - + < - \ No newline at end of file + diff --git a/platform/commonUI/browse/src/BrowseController.js b/platform/commonUI/browse/src/BrowseController.js index 9b5ffc4d71..eb8d5cceb2 100644 --- a/platform/commonUI/browse/src/BrowseController.js +++ b/platform/commonUI/browse/src/BrowseController.js @@ -63,10 +63,9 @@ define( // path to new, addressed, path based on // domainObject $location.path(urlService.urlForLocation("browse", domainObject)); - } - function backArr(domainObject) { + function backArr() { var priorRoute = $route.current, // Act as if params HADN'T changed to avoid page reload unlisten; @@ -79,13 +78,8 @@ define( } unlisten(); }); - // urlService.urlForLocation used to adjust current - // path to new, addressed, path based on - // domainObject - - - var thing = urlService.urlForLocation("browse", domainObject); - $location.path(thing); + console.log(urlService.urlForBack("browse", $scope.navigatedObject)); + $location.path(urlService.urlForBack("browse", $scope.navigatedObject)); } // Callback for updating the in-scope reference to the object diff --git a/platform/commonUI/general/res/css/theme-espresso.css b/platform/commonUI/general/res/css/theme-espresso.css index 405b371e1a..f9a59ef071 100644 --- a/platform/commonUI/general/res/css/theme-espresso.css +++ b/platform/commonUI/general/res/css/theme-espresso.css @@ -890,10 +890,6 @@ mct-container { .object-header .label .context-available { opacity: 1 !important; } } -/* line 170, ../sass/mobile/_layout.scss */ -.mobile-back-arrow { - font-size: 0.8em; } - @media screen and (min-device-width: 800px) and (min-device-height: 1025px), screen and (min-device-width: 1025px) and (min-device-height: 800px) { /* line 175, ../sass/mobile/_layout.scss */ .desktop-hide { diff --git a/platform/commonUI/general/res/sass/mobile/_layout.scss b/platform/commonUI/general/res/sass/mobile/_layout.scss index 0a634b4235..f1d7c306b3 100644 --- a/platform/commonUI/general/res/sass/mobile/_layout.scss +++ b/platform/commonUI/general/res/sass/mobile/_layout.scss @@ -168,7 +168,7 @@ } .mobile-back-arrow { - font-size: 0.8em; +// font-size: 0.8em; } diff --git a/platform/commonUI/general/src/services/UrlService.js b/platform/commonUI/general/src/services/UrlService.js index 4562059d0c..a700f288d4 100644 --- a/platform/commonUI/general/src/services/UrlService.js +++ b/platform/commonUI/general/src/services/UrlService.js @@ -55,6 +55,23 @@ define( return path; } + function urlForLastLocation(mode, domainObject) { + var context = domainObject && + domainObject.getCapability('context'), + objectPath = context ? context.getPath() : [], + editedPath = (objectPath.length > 1) ? objectPath.slice(0, -1) : objectPath, + ids = editedPath.map(function (domainObject) { + return domainObject.getId(); + }), + // Parses the path together. Starts with the + // default index.html file, then the mode passed + // into the service, followed by ids in the url + // joined by '/', and lastly the view path from + // the current location + path = mode + "/" + ids.slice(1).join("/"); + return path; + } + // Uses the Url for the current location // from the urlForLocation function and // includes the view and the index path @@ -65,6 +82,12 @@ define( return newTabPath; } + function urlForBack(mode, domainObject) { + var newTabPath = + "index.html#/" + urlForLastLocation(mode, domainObject); + return newTabPath; + } + return { /** * Returns the Url path for a specific domain object @@ -84,7 +107,9 @@ define( * @param {DomainObject} value of the domain object * to get the path of */ - urlForLocation: urlForLocation + urlForLocation: urlForLocation, + + urlForBack: urlForBack }; } diff --git a/platform/commonUI/inspect/src/gestures/InfoGesture.js b/platform/commonUI/inspect/src/gestures/InfoGesture.js index 67107773f5..4cac0ff98a 100644 --- a/platform/commonUI/inspect/src/gestures/InfoGesture.js +++ b/platform/commonUI/inspect/src/gestures/InfoGesture.js @@ -125,9 +125,10 @@ define( if (!queryService.isMobile(navigator.userAgent)) { // Show bubble (on a timeout) on mouse over element.on('mouseenter', showBubble); - } else if (queryService.isMobile(navigator.userAgent)) { - element.on('touchstart', showTouchBubble); } +// else if (queryService.isMobile(navigator.userAgent)) { +// element.on('touchstart', showTouchBubble); +// } // Also make sure we dismiss bubble if representation is destroyed // before the mouse actually leaves it