Commit b9cdef93 authored by jaapjansma's avatar jaapjansma
Browse files

Merge branch 'artfulrobot-reorder-actions' into 'master'

Allow re-ordering of actions

See merge request !20
parents 16b319d3 2e74169f
......@@ -10,7 +10,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="action in actions " ng-class-even="'crm-entity even-row even'" ng-class-odd="'crm-entity odd-row odd'">
<tr ng-repeat="(i, action) in actions " ng-class-even="'crm-entity even-row even'" ng-class-odd="'crm-entity odd-row odd'">
<td>{{action.title}}</td>
<td>{{actionTitles[action.type]}}</td>
<td>
......@@ -28,6 +28,12 @@
<td>
<a crm-icon="fa-edit" class="crm-hover-button" ng-click="editAction(action)" title="{{ts('Edit')}}">{{ts('Edit')}}</a>
<a crm-icon="fa-trash" class="crm-hover-button" ng-click="removeAction(action)" title="{{ts('Remove')}}">{{ts('Remove')}}</a>
<a crm-icon="fa-chevron-up" class="crm-hover-button" title="{{ts('Move up')}}"
ng-show="i > 0" ng-click="moveAction(i, -1)"
>{{ts('Move up')}}</a>
<a crm-icon="fa-chevron-down" class="crm-hover-button" title="{{ts('Move down')}}"
ng-show="i < actions.length - 1" ng-click="moveAction(i, 1)"
>{{ts('Move down')}}</a>
</td>
</tr>
</tbody>
......
......@@ -94,6 +94,13 @@
});
};
$scope.moveAction = function moveAction(index, dir) {
var actionToMove = $scope.actions.splice(index, 1)[0];
$scope.actions.splice(index + dir, 0, actionToMove);
$scope.formProcessorActionsForm.$setDirty();
};
$scope.removeAction = function removeAction(action) {
var index = $scope.actions.indexOf(action);
if (index >= 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment