This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit 4d74950953e7657ea39edafb90e0ff8f7d178ccd Author: Yannick Martel <martel@©odelutin.com> Date: Thu Feb 5 10:44:34 2015 +0100 can modify privacy and authorized user in document edit --- .../src/main/webapp/js/coselmar-controllers.js | 36 ++++++++++++++++++++++ .../main/webapp/views/documents/editDocument.html | 28 +++++++++++++++-- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index 75dad07..8c23c11 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -232,6 +232,7 @@ coselmarControllers.controller("DocumentViewCtrl", $scope.container = {baseUrl : coselmarConfig.BASE_URL}; $scope.upload = {}; + $scope.users = []; $scope.editSession = $routeParams.edit ? $routeParams.edit : false; @@ -242,6 +243,11 @@ coselmarControllers.controller("DocumentViewCtrl", if (document.publicationDate) { $scope.document.publicationDate = new Date(document.publicationDate); } + // update scope about current user : if he is participant, more option enable in ui + if (document.authorizedUsers) { + $scope.users = document.authorizedUsers; + bindUsers($scope.document.authorizedUsers, $scope.usersIndex); + } }); $scope.deleteDocument = function(documentId){ @@ -335,6 +341,36 @@ coselmarControllers.controller("DocumentViewCtrl", } }; + // Participants, clients and supervisors management for ui-select + $scope.usersIndex = []; + $scope.refreshUsers = function(searchKeyword) { + var searchKeywords = []; + if (searchKeyword && searchKeyword.length > 0) { + searchKeywords.push(searchKeyword); + } + + documentService.findUsers({'role': 'EXPERT', 'active': true, 'fullTextSearch' : searchKeywords}, function(users) { + $scope.users = users; + $scope.usersIndex = []; + angular.forEach($scope.users, function(user) { + $scope.usersIndex[user.id] = user; + }); + bindUsers($scope.document.authorizedUsers, $scope.usersIndex); + }); + } + + // function to be sure to have same user objects in list + var bindUsers = function(toDeal, index) { + if (toDeal) { + for(var i = 0; i < toDeal.length; i++) { + var user = toDeal[i]; + if (index[user.id]) { + toDeal[i] = index[user.id]; + } + } + } + }; + } ]); diff --git a/coselmar-ui/src/main/webapp/views/documents/editDocument.html b/coselmar-ui/src/main/webapp/views/documents/editDocument.html index 4d538e3..7764bc8 100644 --- a/coselmar-ui/src/main/webapp/views/documents/editDocument.html +++ b/coselmar-ui/src/main/webapp/views/documents/editDocument.html @@ -95,8 +95,32 @@ <label class="col-md-2 control-label">{{ 'document.metadata.privacy' | translate }}</label> <div class="col-md-4"> - <input type="text" class="form-control" name="type" - data-ng-model="document.privacy" disabled="disabled"/> + <select class="form-control" name="privacy" + ng-model="document.privacy"> + <option value="PRIVATE">{{ 'common.privacy.private' | translate }}</option> + <option value="PUBLIC">{{ 'common.privacy.public' | translate }}</option> + <option value="RESTRICTED">{{ 'common.privacy.restricted' | translate }}</option> + </select> + + <div ng-if="document.privacy == 'RESTRICTED'"> + {{ 'document.metadata.restricted.info' | translate }} + + <ui-select multiple ng-model="document.authorizedUsers" + theme="bootstrap" reset-search-input="true" + ng-disabled="disabled" class="form-control"> + + <ui-select-match placeholder="John Doe"> + {{$item.firstName}} {{$item.name}} ({{$item.organization}}) + </ui-select-match> + + <ui-select-choices + repeat="user in users track by user.id | propsFilter: {name: $select.search, firstName: $select.search, organization: $select.search}" + refresh="refreshUsers($select.search)" + refresh-delay="500"> + {{user.firstName}} {{user.name}} ({{user.organization}}) + </ui-select-choices> + </ui-select> + </div> </div> </div> </div> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.