diff --git a/platform/commonUI/browse/bundle.json b/platform/commonUI/browse/bundle.json index 6cb0fcdb27..484eb96483 100644 --- a/platform/commonUI/browse/bundle.json +++ b/platform/commonUI/browse/bundle.json @@ -35,7 +35,8 @@ { "key": "BrowseObjectController", "implementation": "BrowseObjectController.js", - "depends": [ "$scope", "$location", "$route", "$q" ] + "depends": [ "$scope", "$location", "$route", "$q", + "navigationService" ] }, { "key": "CreateMenuController", diff --git a/platform/commonUI/browse/res/templates/browse-object.html b/platform/commonUI/browse/res/templates/browse-object.html index 5d1799f5ac..f9bf109abf 100644 --- a/platform/commonUI/browse/res/templates/browse-object.html +++ b/platform/commonUI/browse/res/templates/browse-object.html @@ -20,9 +20,10 @@ at runtime from the About dialog for additional information. -->
- + {{btn.title}} diff --git a/platform/commonUI/browse/src/BrowseObjectController.js b/platform/commonUI/browse/src/BrowseObjectController.js index 0beb51c514..0953d06f4d 100644 --- a/platform/commonUI/browse/src/BrowseObjectController.js +++ b/platform/commonUI/browse/src/BrowseObjectController.js @@ -33,7 +33,8 @@ define( * @memberof platform/commonUI/browse * @constructor */ - function BrowseObjectController($scope, $location, $route, $q) { + function BrowseObjectController($scope, $location, $route, $q, navigationService) { + var navigatedObject; function setViewForDomainObject(domainObject) { var locationViewKey = $location.search().view; @@ -50,7 +51,7 @@ define( .forEach(selectViewIfMatching); } $scope.editMode = domainObject.getDomainObject ? true : false; - console.log("edit mode set to " + $scope.editMode); + navigatedObject = domainObject; } function updateQueryParam(viewKey) { @@ -72,11 +73,13 @@ define( $scope.$watch('domainObject', setViewForDomainObject); $scope.$watch('representation.selected.key', updateQueryParam); -/* $scope.$on(GestureConstants.MCT_DROP_EVENT, function() { - console.log("Edit mode changed"); - $scope.editMode = true; - }); */ - console.log("Controller loaded"); + $scope.cancelEditing = function() { + navigationService.setNavigation($scope.domainObject.getDomainObject()); + } + + $scope.doAction = function (action){ + $scope[action] && $scope[action](); + } } diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index 86a8a75540..a699036a18 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -25,8 +25,8 @@ * Module defining EditAction. Created by vwoeltje on 11/14/14. */ define( - [], - function () { + ['../objects/EditableDomainObject'], + function (EditableDomainObject) { "use strict"; // A no-op action to return in the event that the action cannot @@ -71,8 +71,10 @@ define( * Enter edit mode. */ EditAction.prototype.perform = function () { - this.navigationService.setNavigation(this.domainObject); - this.$location.path("/edit"); + if (!this.domainObject.getDomainObject) { + this.navigationService.setNavigation(new EditableDomainObject(this.domainObject)); + } + //this.$location.path("/edit"); }; /** @@ -83,10 +85,11 @@ define( */ EditAction.appliesTo = function (context) { var domainObject = (context || {}).domainObject, - type = domainObject && domainObject.getCapability('type'); + type = domainObject && domainObject.getCapability('type'), + isEditMode = domainObject && domainObject.getDomainObject ? true : false; // Only allow creatable types to be edited - return type && type.hasFeature('creation'); + return type && type.hasFeature('creation') && !isEditMode; }; return EditAction;