(function () {

	"use strict";

	function editorChangeCollectionCollection (EditorManager, REST, ArrayUtils) {

		return {

			restrict : 'EC',
			templateUrl : 'Rbs/Collection/Collection/editor.twig',
			replace : false,
			require : 'rbsDocumentEditor',

			link : function (scope, element, attrs, editorCtrl) {
				scope.onReady = function(){
					if (!angular.isArray(scope.document.items))
					{
						scope.document.items = [];
					}
				};

				editorCtrl.init('Rbs_Collection_Collection');

				scope.moveTop = function(index){
					if (angular.isArray(scope.document.items))
					{
						ArrayUtils.move(scope.document.items, index, 0);
					}
				};

				scope.moveUp = function(index){
					if (angular.isArray(scope.document.items))
					{
						ArrayUtils.move(scope.document.items, index, index-1);
					}
				};

				scope.moveBottom = function(index){
					if (angular.isArray(scope.document.items))
					{
						ArrayUtils.move(scope.document.items, index, scope.document.items.length-1);
					}
				};

				scope.moveDown = function(index){
					if (angular.isArray(scope.document.items))
					{
						ArrayUtils.move(scope.document.items, index, index+1);
					}
				};

				scope.remove = function(index){
					if (angular.isArray(scope.document.items))
					{
						scope.document.items.splice(index, 1);
					}
				};

				scope.cascadeCreateItem = function(){
					EditorManager.cascade(REST.newResource('Rbs_Collection_Item'), scope.document.label, function(doc){scope.document.items.push(doc);});
				};

				scope.cascadeEditItem = function(index){
					EditorManager.cascade(scope.document.items[index], scope.document.label, function(doc){scope.document.items[index] = doc;});
				};

			}
		};

	}

	editorChangeCollectionCollection.$inject = ['RbsChange.EditorManager', 'RbsChange.REST', 'RbsChange.ArrayUtils'];

	angular.module('RbsChange').directive('rbsDocumentEditorRbsCollectionCollection', editorChangeCollectionCollection);

})();
@@ -1575,36 +1575,28 @@
 )%7B%0A%09%09%09%09%09
-EditorManager.cascad
+REST.resourc
 e(scope.
@@ -1616,16 +1616,74 @@
 s%5Bindex%5D
+).then(%0A%09%09%09%09%09%09function(doc) %7B%0A%09%09%09%09%09%09%09scope.cascadeEdit(doc
 , scope.
@@ -1750,27 +1750,41 @@
 doc;%7D);%0A%09%09%09%09
+%09%09%7D%0A%09%09%09%09%09)%0A%09%09%09%09
 %7D;
-%0A
 %0A%09%09%09%7D%0A%09%09%7D;%0A%0A

Fix Collection editor