Skip to content

Commit

Permalink
Merge branch '1.13' into 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwojs committed Jun 20, 2018
2 parents dd7b75a + 0526298 commit 0ab4ad1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Expand Up @@ -48,6 +48,7 @@ YUI.add('ez-objectrelationsloadplugin', function (Y) {
loadingError = false,
sourceContent = e.content,
destinationContentIds = e.destinationContentIds,
withLocation = e.loadLocation || e.loadLocationPath,
contentDestinations,
end = stack.add(function (error, struct) {
if (error) {
Expand Down Expand Up @@ -77,7 +78,7 @@ YUI.add('ez-objectrelationsloadplugin', function (Y) {
if (!loadedRelation[value]) {
loadedRelation[value] = true;

if (e.loadLocation || e.loadLocationPath) {
if (withLocation) {
this._loadContentStruct(value, e.loadLocation, e.loadLocationPath, end);
} else {
this._loadContent(value, end);
Expand All @@ -86,6 +87,21 @@ YUI.add('ez-objectrelationsloadplugin', function (Y) {
}, this);

stack.done(function () {
relatedContentListArray.sort(function (a, b) {
var indexA,
indexB;

if (withLocation) {
a = a.content;
b = b.content;
}

indexA = destinationContentIds.indexOf(a.get('id'));
indexB = destinationContentIds.indexOf(b.get('id'));

return indexA - indexB;
});

e.target.setAttrs({
relatedContents: relatedContentListArray,
loadingError: loadingError,
Expand Down
Expand Up @@ -13,6 +13,7 @@ YUI.add('ez-objectrelationsloadplugin-tests', function (Y) {
this.Content = function () {
this.set = tests._set;
this.load = tests._load;
this.get = tests._get;
};
this.destination1 = '/api/ezp/v2/content/objects/117';
this.destination2 = '/api/ezp/v2/content/objects/118';
Expand Down Expand Up @@ -62,6 +63,10 @@ YUI.add('ez-objectrelationsloadplugin-tests', function (Y) {
this.id = value;
},

_get: function (name) {

},

_load: function (options, callback) {

},
Expand Down

0 comments on commit 0ab4ad1

Please sign in to comment.