Up/down buttons for changing the order of related links
This commit is contained in:
@@ -92,6 +92,12 @@
|
||||
link.isInternal = !link.isInternal;
|
||||
$event.preventDefault();
|
||||
};
|
||||
|
||||
$scope.move = function (index, direction) {
|
||||
var temp = $scope.model.value[index];
|
||||
$scope.model.value[index] = $scope.model.value[index + direction];
|
||||
$scope.model.value[index + direction] = temp;
|
||||
};
|
||||
|
||||
function select(data) {
|
||||
if ($scope.currentEditLink != null) {
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
<td>
|
||||
|
||||
<div class="btn-group" ng-show="!link.edit">
|
||||
<button type="button" class="btn btn-default" ng-click="move($index, -1)" ng-disabled="$first">Up</button>
|
||||
<button type="button" class="btn btn-default" ng-click="move($index, 1)" ng-disabled="$last">Down</button>
|
||||
<button type="button" class="btn btn-default" ng-click="edit($index)">Edit</button>
|
||||
<button type="button" class="btn btn-default" ng-click="delete($index)">Delete</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user