From 1d0af0b3b626a579e36e331f153e56477afecdfa Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 10 Nov 2015 20:27:04 -0800 Subject: [PATCH 1/5] Drop Gesture --- platform/representation/src/gestures/DropGesture.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/representation/src/gestures/DropGesture.js b/platform/representation/src/gestures/DropGesture.js index b330b4ce93..aea8f3b645 100644 --- a/platform/representation/src/gestures/DropGesture.js +++ b/platform/representation/src/gestures/DropGesture.js @@ -81,7 +81,7 @@ define( //Refresh domain object on each dragOver to catch external // updates to the model //Don't use EditableDomainObject for folders, allow immediate persistence - editableDomainObject = domainObject instanceof EditableDomainObject || domainObject.getModel().type==='folder' ? domainObject : new EditableDomainObject(domainObject, $q); + editableDomainObject = domainObject.getDomainObject || domainObject.getModel().type==='folder' ? domainObject : new EditableDomainObject(domainObject, $q); actionCapability = editableDomainObject.getCapability('action'); var event = (e || {}).originalEvent || e, From 5a2f073975e1b2e48f5f763d15e1a4e2e0de253f Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 10 Nov 2015 20:43:31 -0800 Subject: [PATCH 2/5] commented out extraeneous span --- platform/commonUI/browse/res/templates/browse-object.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/commonUI/browse/res/templates/browse-object.html b/platform/commonUI/browse/res/templates/browse-object.html index b4fe5a3df1..8401c77faf 100644 --- a/platform/commonUI/browse/res/templates/browse-object.html +++ b/platform/commonUI/browse/res/templates/browse-object.html @@ -103,8 +103,8 @@ ng-class="{ major: $index === 0 }"> {{btn.title}} - --> - + + --> Date: Tue, 10 Nov 2015 22:10:43 -0800 Subject: [PATCH 3/5] Fixed buttons not appearing on edit mode click --- platform/commonUI/edit/bundle.json | 2 +- platform/commonUI/edit/src/actions/EditAction.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/platform/commonUI/edit/bundle.json b/platform/commonUI/edit/bundle.json index 37c6175d6b..9fe3c8d1d5 100644 --- a/platform/commonUI/edit/bundle.json +++ b/platform/commonUI/edit/bundle.json @@ -38,7 +38,7 @@ { "key": "edit", "implementation": "actions/EditAction.js", - "depends": [ "$location", "navigationService", "$log" ], + "depends": [ "$location", "navigationService", "$log", "now" ], "description": "Edit this object.", "category": "view-control", "glyph": "p" diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index a699036a18..1554526439 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -46,7 +46,7 @@ define( * @constructor * @implements {Action} */ - function EditAction($location, navigationService, $log, context) { + function EditAction($location, navigationService, $log, now, context) { var domainObject = (context || {}).domainObject; // We cannot enter Edit mode if we have no domain object to @@ -65,6 +65,7 @@ define( this.domainObject = domainObject; this.$location = $location; this.navigationService = navigationService; + this.now = now; } /** @@ -72,7 +73,11 @@ define( */ EditAction.prototype.perform = function () { if (!this.domainObject.getDomainObject) { - this.navigationService.setNavigation(new EditableDomainObject(this.domainObject)); + //var editableModel = + // JSON.parse(JSON.stringify(this.domainObject.getModel())); + var editableModel = this.domainObject.getModel(); + editableModel.modified = this.now(); + this.navigationService.setNavigation(new EditableDomainObject(this.domainObject, editableModel)); } //this.$location.path("/edit"); }; From 4c0a79116a89c6fb75cbb41ad8d3c2da3b36ab8f Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 11 Nov 2015 11:52:30 -0800 Subject: [PATCH 4/5] Added refresh check for editability --- platform/representation/src/MCTRepresentation.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/platform/representation/src/MCTRepresentation.js b/platform/representation/src/MCTRepresentation.js index d1937389d2..5fab004205 100644 --- a/platform/representation/src/MCTRepresentation.js +++ b/platform/representation/src/MCTRepresentation.js @@ -96,6 +96,7 @@ define( toClear = [], // Properties to clear out of scope on change counter = 0, couldRepresent = false, + couldEdit = false, lastId, lastKey, changeTemplate = templateLinker.link($scope, element); @@ -143,11 +144,13 @@ define( }); } - function unchanged(canRepresent, id, key) { + function unchanged(canRepresent, canEdit, id, key) { return canRepresent && couldRepresent && id === lastId && - key === lastKey; + key === lastKey && + canEdit && + couldEdit; } // General-purpose refresh mechanism; should set up the scope @@ -159,10 +162,11 @@ define( path = representation && getPath(representation), uses = ((representation || {}).uses || []), canRepresent = !!(path && domainObject), + canEdit = !!(domainObject && domainObject.hasCapability('editor')), id = domainObject && domainObject.getId(), key = $scope.key; - if (unchanged(canRepresent, id, key)) { + if (unchanged(canRepresent, canEdit, id, key)) { return; } @@ -190,6 +194,7 @@ define( // To allow simplified change detection next time around couldRepresent = canRepresent; + couldEdit = canEdit; lastId = id; lastKey = key; From 5f8d13672fe3d8d2c1b65bf9322eec9449aefb7c Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 11 Nov 2015 11:58:15 -0800 Subject: [PATCH 5/5] Reverted model modified hack --- platform/commonUI/edit/bundle.json | 2 +- platform/commonUI/edit/src/actions/EditAction.js | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/platform/commonUI/edit/bundle.json b/platform/commonUI/edit/bundle.json index 9fe3c8d1d5..37c6175d6b 100644 --- a/platform/commonUI/edit/bundle.json +++ b/platform/commonUI/edit/bundle.json @@ -38,7 +38,7 @@ { "key": "edit", "implementation": "actions/EditAction.js", - "depends": [ "$location", "navigationService", "$log", "now" ], + "depends": [ "$location", "navigationService", "$log" ], "description": "Edit this object.", "category": "view-control", "glyph": "p" diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index 1554526439..a699036a18 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -46,7 +46,7 @@ define( * @constructor * @implements {Action} */ - function EditAction($location, navigationService, $log, now, context) { + function EditAction($location, navigationService, $log, context) { var domainObject = (context || {}).domainObject; // We cannot enter Edit mode if we have no domain object to @@ -65,7 +65,6 @@ define( this.domainObject = domainObject; this.$location = $location; this.navigationService = navigationService; - this.now = now; } /** @@ -73,11 +72,7 @@ define( */ EditAction.prototype.perform = function () { if (!this.domainObject.getDomainObject) { - //var editableModel = - // JSON.parse(JSON.stringify(this.domainObject.getModel())); - var editableModel = this.domainObject.getModel(); - editableModel.modified = this.now(); - this.navigationService.setNavigation(new EditableDomainObject(this.domainObject, editableModel)); + this.navigationService.setNavigation(new EditableDomainObject(this.domainObject)); } //this.$location.path("/edit"); };