diff --git a/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsWorkflowEdit.js b/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsWorkflowEdit.js
index ee708b54..5d0a3d7a 100644
--- a/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsWorkflowEdit.js
+++ b/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsWorkflowEdit.js
@@ -3,7 +3,53 @@
/**
* Settings workflow edition page controller.
*/
-angular.module('docs').controller('SettingsWorkflowEdit', function($scope, $dialog, $state, $stateParams, Restangular, $translate) {
+angular.module('docs').controller('SettingsWorkflowEdit', function($scope, $dialog, $state, $stateParams, Restangular, $translate, $q) {
+ /**
+ * UI sortable options.
+ */
+ $scope.sortableOptions = {
+ forceHelperSize: true,
+ forcePlaceholderSize: true,
+ tolerance: 'pointer',
+ handle: '.handle'
+ };
+
+ /**
+ * Auto-complete on ACL target.
+ */
+ $scope.getTargetAclTypeahead = function($viewValue) {
+ var deferred = $q.defer();
+ Restangular.one('acl/target/search')
+ .get({
+ search: $viewValue
+ }).then(function(data) {
+ var output = [];
+
+ // Add the type to use later
+ output.push.apply(output, _.map(data.users, function(user) {
+ user.type = 'USER';
+ return user;
+ }));
+ output.push.apply(output, _.map(data.groups, function(group) {
+ group.type = 'GROUP';
+ return group;
+ }));
+
+ // Send the data to the typeahead directive
+ deferred.resolve(output, true);
+ });
+ return deferred.promise;
+ };
+
+ /**
+ * Add a workflow step.
+ */
+ $scope.addStep = function () {
+ $scope.workflow.steps.push({
+ type: 'VALIDATE'
+ });
+ };
+
/**
* Returns true if in edit mode (false in add mode).
*/
@@ -17,6 +63,7 @@ angular.module('docs').controller('SettingsWorkflowEdit', function($scope, $dial
if ($scope.isEdit()) {
Restangular.one('routemodel', $stateParams.id).get().then(function (data) {
$scope.workflow = data;
+ $scope.workflow.steps = JSON.parse(data.steps);
});
} else {
$scope.workflow = {
@@ -30,6 +77,7 @@ angular.module('docs').controller('SettingsWorkflowEdit', function($scope, $dial
$scope.edit = function () {
var promise = null;
var workflow = angular.copy($scope.workflow);
+ workflow.steps = JSON.stringify(workflow.steps);
if ($scope.isEdit()) {
promise = Restangular
diff --git a/docs-web/src/main/webapp/src/locale/en.json b/docs-web/src/main/webapp/src/locale/en.json
index c4db55cb..4dc084df 100644
--- a/docs-web/src/main/webapp/src/locale/en.json
+++ b/docs-web/src/main/webapp/src/locale/en.json
@@ -266,7 +266,15 @@
"delete_workflow_message": "Do you really want to delete this workflow? Currently running workflows will not be deleted",
"edit_workflow_title": "Edit \"{{ name }}\"",
"add_workflow_title": "Add a workflow",
- "name": "Name"
+ "name": "Name",
+ "name_placeholder": "Step name or description",
+ "drag_help": "Drag and drop to rorder the step",
+ "type": "Step type",
+ "type_approve": "Approve",
+ "type_validate": "Validate",
+ "target": "Assigned to",
+ "target_help": "Approve: Review and continue the workflow
Validate: Accept or reject the review",
+ "add_step": "Add a workflow step"
}
},
"security": {
@@ -391,7 +399,8 @@
"File": "File",
"Group": "Group",
"Tag": "Tag",
- "User": "User"
+ "User": "User",
+ "RouteModel": "Workflow"
},
"selectrelation": {
"typeahead": "Type a document title"
diff --git a/docs-web/src/main/webapp/src/partial/docs/directive.auditlog.html b/docs-web/src/main/webapp/src/partial/docs/directive.auditlog.html
index 072552ae..c87ad733 100644
--- a/docs-web/src/main/webapp/src/partial/docs/directive.auditlog.html
+++ b/docs-web/src/main/webapp/src/partial/docs/directive.auditlog.html
@@ -42,6 +42,9 @@
{{ log.message }}
+
+ {{ log.message }}
+
diff --git a/docs-web/src/main/webapp/src/partial/docs/settings.workflow.edit.html b/docs-web/src/main/webapp/src/partial/docs/settings.workflow.edit.html
index 2f2461dc..68c80f95 100644
--- a/docs-web/src/main/webapp/src/partial/docs/settings.workflow.edit.html
+++ b/docs-web/src/main/webapp/src/partial/docs/settings.workflow.edit.html
@@ -19,48 +19,61 @@
-