Modified dirty function

This commit is contained in:
Henry
2016-05-11 17:58:03 -07:00
parent 44f4a82fa1
commit c305fba0a7
4 changed files with 8 additions and 10 deletions

View File

@ -112,7 +112,7 @@ define(
* modifications since the last persist, false otherwise. * modifications since the last persist, false otherwise.
*/ */
EditorCapability.prototype.dirty = function () { EditorCapability.prototype.dirty = function () {
return (this.domainObject.getModel().modified || 0) > (this.domainObject.getModel().persisted || 0); return this.transactionService.size() > 0;
}; };
return EditorCapability; return EditorCapability;

View File

@ -140,5 +140,9 @@ define(
}); });
}; };
TransactionService.prototype.size = function () {
return this.onCommits.length + this.onCancels.length;
};
return TransactionService; return TransactionService;
}); });

View File

@ -86,10 +86,7 @@ define([
"implementation": DropGesture, "implementation": DropGesture,
"depends": [ "depends": [
"dndService", "dndService",
"$q", "$q"
"navigationService",
"instantiate",
"typeService"
] ]
}, },
{ {

View File

@ -38,7 +38,7 @@ define(
* @param {DomainObject} domainObject the domain object whose * @param {DomainObject} domainObject the domain object whose
* composition should be modified as a result of the drop. * composition should be modified as a result of the drop.
*/ */
function DropGesture(dndService, $q, navigationService, instantiate, typeService, element, domainObject) { function DropGesture(dndService, $q, element, domainObject) {
var actionCapability = domainObject.getCapability('action'), var actionCapability = domainObject.getCapability('action'),
scope = element.scope && element.scope(), scope = element.scope && element.scope(),
action; // Action for the drop, when it occurs action; // Action for the drop, when it occurs
@ -70,8 +70,6 @@ define(
} }
function dragOver(e) { function dragOver(e) {
actionCapability = domainObject.getCapability('action');
var event = (e || {}).originalEvent || e, var event = (e || {}).originalEvent || e,
selectedObject = dndService.getData( selectedObject = dndService.getData(
GestureConstants.MCT_EXTENDED_DRAG_TYPE GestureConstants.MCT_EXTENDED_DRAG_TYPE
@ -105,8 +103,7 @@ define(
e.preventDefault(); e.preventDefault();
//Use scope.apply, drop event is outside digest cycle //Use scope.apply, drop event is outside digest cycle
// and if not applied here causes visual artifacts. scope.$apply(function () {
scope.$apply( function() {
if (domainObjectType !== 'folder') { if (domainObjectType !== 'folder') {
domainObject.getCapability('action').perform('edit'); domainObject.getCapability('action').perform('edit');
} }