Merge pull request #1088 from bjarnef/dev-v7-U4-6121

U4-6121 - Sorting in Related Links was not working correctly
This commit is contained in:
Mads Rasmussen
2016-02-03 14:01:31 +01:00
2 changed files with 3 additions and 13 deletions

View File

@@ -154,15 +154,7 @@
items: '> tr',
tolerance: 'pointer',
update: function (e, ui) {
// Get the new and old index for the moved element (using the URL as the identifier)
var newIndex = ui.item.index();
var movedLinkUrl = ui.item.attr('data-link');
var originalIndex = getElementIndexByUrl(movedLinkUrl);
// Move the element in the model
var movedElement = $scope.model.value[originalIndex];
$scope.model.value.splice(originalIndex, 1);
$scope.model.value.splice(newIndex, 0, movedElement);
}
};

View File

@@ -10,7 +10,7 @@
<td></td>
</tr>
</thead>
<tbody ui-sortable="sortableOptions">
<tbody ui-sortable="sortableOptions" ng-model="model.value">
<tr ng-repeat="link in model.value" data-link="{{link.link}}">
<td style="width: 20px"><i class="icon icon-navigation handle"></i></td>
<td style="word-wrap:break-word; word-break: break-all">
@@ -20,9 +20,7 @@
<td style="word-wrap:break-word; word-break: break-all">
<div ng-show="!link.edit">
<a href="{{link.link}}" target="_blank" ng-show="!link.isInternal">{{link.link}}</a>
<a href="#/content/content/edit/{{link.internal}}" target="_blank" ng-show="link.isInternal" ng-bind="link.internalName">
</a>
<a href="#/content/content/edit/{{link.internal}}" target="_blank" ng-show="link.isInternal" ng-bind="link.internalName"></a>
</div>
<div ng-show="link.edit">
<div ng-show="!link.isInternal">