[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.
This commit is contained in:
Shivam Dave 2015-07-27 17:01:30 -07:00
parent 621ccc25ec
commit b0c42c12b7
6 changed files with 36 additions and 19 deletions

View File

@ -20,6 +20,7 @@
at runtime from the About dialog for additional information.
-->
<span ng-controller="BrowseController">
<span ng-controller="BrowseController"
ng-click="backArrow()">
<a class='icon ui-symbol mobile-back-arrow'>&lt;</a>
</span>
</span>

View File

@ -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

View File

@ -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 {

View File

@ -168,7 +168,7 @@
}
.mobile-back-arrow {
font-size: 0.8em;
// font-size: 0.8em;
}

View File

@ -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
};
}

View File

@ -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