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 d21577dcbd5610154880ab9dc637d254d62350ba Author: Yannick Martel <martel@©odelutin.com> Date: Thu Dec 4 18:24:21 2014 +0100 from question edit, can create a document to attach it on question : request on service returns the document --- .../src/main/xmi/coselmar-model.zargo | Bin 9632 -> 9660 bytes .../coselmar/services/v1/DocumentsWebService.java | 8 ++++++-- .../src/main/webapp/js/coselmar-controllers.js | 3 +++ .../webapp/views/documents/modalDocumentEdit.html | 17 +++++------------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/coselmar-persistence/src/main/xmi/coselmar-model.zargo b/coselmar-persistence/src/main/xmi/coselmar-model.zargo index bfdc485..9dd868f 100644 Binary files a/coselmar-persistence/src/main/xmi/coselmar-model.zargo and b/coselmar-persistence/src/main/xmi/coselmar-model.zargo differ diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java index dbb5182..f3940ab 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java @@ -64,7 +64,7 @@ public class DocumentsWebService extends CoselmarWebServiceSupport { private static final Log log = getLog(DocumentsWebService.class); public static final List<String> DOCUMENT_EDIT_ALLOWED_USER_ROLES = - Lists.newArrayList(CoselmarUserRole.EXPERT.name()); + Lists.newArrayList(CoselmarUserRole.EXPERT.name(), CoselmarUserRole.SUPERVISOR.name()); public static final List<String> DOCUMENT_VIEW_ALLOWED_USER_ROLES = Lists.newArrayList( @@ -136,7 +136,7 @@ public class DocumentsWebService extends CoselmarWebServiceSupport { return result; } - public void addDocument(DocumentBean document, UploadFile uploadFile) throws InvalidCredentialException, UnauthorizedException { + public DocumentBean addDocument(DocumentBean document, UploadFile uploadFile) throws InvalidCredentialException, UnauthorizedException { // Check authentication String authorization = getContext().getHeader("Authorization"); @@ -217,6 +217,10 @@ public class DocumentsWebService extends CoselmarWebServiceSupport { } commit(); + String lightId = getPersistenceContext().getTopiaIdFactory().getRandomPart(documentEntity.getTopiaId()); + DocumentBean result = BeanEntityConverter.toBean(lightId, documentEntity); + return result; + } public Render getDocumentFile(String documentId) { diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index c103428..e19dc55 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -396,6 +396,9 @@ coselmarControllers.controller('ModalCreateDocumentsCtrl', function ($scope, $mo $scope.create = function (isValidForm) { if (isValidForm) { + if ($scope.upload.file) { + $scope.document.withFile = true; + } documentService.createDocument( $scope.document, $scope.upload.file, function(document) { $modalInstance.close(document); diff --git a/coselmar-ui/src/main/webapp/views/documents/modalDocumentEdit.html b/coselmar-ui/src/main/webapp/views/documents/modalDocumentEdit.html index ba57ce6..2d115ac 100644 --- a/coselmar-ui/src/main/webapp/views/documents/modalDocumentEdit.html +++ b/coselmar-ui/src/main/webapp/views/documents/modalDocumentEdit.html @@ -5,7 +5,7 @@ </div> <form class="form-horizontal" name="documentForm" role="form" - ng-submit="createNewDocument(documentForm.$valid)"> + ng-submit="create(documentForm.$valid)"> <div class="modal-body"> @@ -44,7 +44,7 @@ <!-- Line with file and externalURL --> <div class="form-group" ng-class="{'has-error' : - !documentForm.externalUrl.$invalid && !documentForm.externalUrl.$pristine && + documentForm.externalUrl.$invalid && !documentForm.externalUrl.$pristine && !upload.file}"> <div class=""> <label class="col-md-2 control-label">File</label> @@ -124,7 +124,7 @@ <div class="" ng-class="{'has-error' : documentForm.authors.$invalid && !documentForm.authors.$pristine}"> - <label class="col-md-1 control-label">Authors</label> + <label class="col-md-1 control-label">Authors *</label> <div class="col-md-4"> <input type="text" class="form-control" name="authors" @@ -175,7 +175,7 @@ <!-- End Line with Summary --> <div class="form-group" ng-class="{'has-error' : documentForm.summary.$invalid && !documentForm.summary.$pristine}"> - <label class="col-md-2 control-label">Summary</label> + <label class="col-md-2 control-label">Summary *</label> <div class="col-md-10"> <textarea type="text" class="form-control" name="summary" rows="5" @@ -186,17 +186,10 @@ </div> </div> - <div class="form-group"> - <div style="float-right col-md-4"> - <input type="submit" value="Submit" class="btn btn-primary" - ng-if="documentForm.$valid && privacy != 'RESTRICTED'"/> - </div> - </div> - </div> <div class="modal-footer"> - <input type="submit" class="btn btn-primary" ng-click="create()"/> + <input type="submit" class="btn btn-primary" /> <button class="btn btn-warning" ng-click="cancel()">Cancel</button> </div> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.