Commit 67ac254e authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Refactoriza y corrige actualización de capas

parent 27da9c45
Loading
Loading
Loading
Loading
+19 −6
Original line number Diff line number Diff line
@@ -149,10 +149,9 @@ define([
		_removeCallback: function(evt) {

			var item = evt.item,
				itemId = item.id,
				target;

			if (itemId.indexOf('category') !== -1) {
			if (this._itemIsACategory(item)) {
				target = redmicConfig.services.atlasCategoryEdition;
			} else {
				target = redmicConfig.services.atlasLayerEdition;
@@ -160,7 +159,7 @@ define([

			this._emitEvt('REMOVE', {
				target: target,
				id: itemId
				id: item.id
			});
		},

@@ -213,9 +212,23 @@ define([
			this._emitEvt('LOADED');
			this._emitEvt('REFRESH');

 			var savedObj = this._getSavedObjToPublish ? this._getSavedObjToPublish(result) : result;
			var item = result.body || result;

			if (this._itemIsACategory(item)) {
				var savedObj = this._getSavedObjToPublish ? this._getSavedObjToPublish(result) : result;
				this._emitEvt('SAVED', savedObj);
			}
		},

		_itemIsACategory: function(item) {

			if (!item) {
				return;
			}

			var itemId = item.id;

			return itemId.indexOf('category') !== -1;
		}
	});
});