branch develop updated (3197429 -> 0c5e21f)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git from 3197429 fixes #6615 order documents by deposit date desc in questions new 0c5e21f fixes #6618 add new types for document The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 0c5e21fe805ceed2481079deb45be005f866806e Author: Yannick Martel <martel@©odelutin.com> Date: Fri Feb 6 11:25:00 2015 +0100 fixes #6618 add new types for document Summary of changes: .../fr/ifremer/coselmar/beans/DocumentBean.java | 4 ++- coselmar-ui/src/main/webapp/i18n/en.js | 2 ++ coselmar-ui/src/main/webapp/i18n/fr.js | 2 ++ .../src/main/webapp/js/coselmar-controllers.js | 29 ++++++++++++++++++---- .../main/webapp/views/documents/editDocument.html | 10 +++++--- .../webapp/views/documents/modalDocumentEdit.html | 2 ++ .../main/webapp/views/documents/newdocument.html | 12 +++++---- .../main/webapp/views/documents/viewDocument.html | 2 ++ 8 files changed, 48 insertions(+), 15 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
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 0c5e21fe805ceed2481079deb45be005f866806e Author: Yannick Martel <martel@©odelutin.com> Date: Fri Feb 6 11:25:00 2015 +0100 fixes #6618 add new types for document --- .../fr/ifremer/coselmar/beans/DocumentBean.java | 4 ++- coselmar-ui/src/main/webapp/i18n/en.js | 2 ++ coselmar-ui/src/main/webapp/i18n/fr.js | 2 ++ .../src/main/webapp/js/coselmar-controllers.js | 29 ++++++++++++++++++---- .../main/webapp/views/documents/editDocument.html | 10 +++++--- .../webapp/views/documents/modalDocumentEdit.html | 2 ++ .../main/webapp/views/documents/newdocument.html | 12 +++++---- .../main/webapp/views/documents/viewDocument.html | 2 ++ 8 files changed, 48 insertions(+), 15 deletions(-) diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/DocumentBean.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/DocumentBean.java index c7527c6..390e366 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/DocumentBean.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/DocumentBean.java @@ -77,7 +77,9 @@ public class DocumentBean implements Serializable { if (depositDate != null) { this.depositDate = new Date(depositDate.getTime()); } - this.keywords = new HashSet<>(keywords); + if (keywords != null) { + this.keywords = new HashSet<>(keywords); + } this.mimeType = mimeType; this.type = type; diff --git a/coselmar-ui/src/main/webapp/i18n/en.js b/coselmar-ui/src/main/webapp/i18n/en.js index 6029427..ca4cc92 100644 --- a/coselmar-ui/src/main/webapp/i18n/en.js +++ b/coselmar-ui/src/main/webapp/i18n/en.js @@ -86,6 +86,8 @@ var translateEN = { "document.metadata.type.poster" : "Poster", "document.metadata.type.conferenceArticle" : "Conference article", "document.metadata.type.conferenceSummary" : "Conference summary", +"document.metadata.type.data" : "Data", +"document.metadata.type.other" : "Other", "document.metadata.file" : "File", "document.metadata.mimetype" : "Mime Type", "document.metadata.externalUrl" : "External URL", diff --git a/coselmar-ui/src/main/webapp/i18n/fr.js b/coselmar-ui/src/main/webapp/i18n/fr.js index b69bff8..34f92d9 100644 --- a/coselmar-ui/src/main/webapp/i18n/fr.js +++ b/coselmar-ui/src/main/webapp/i18n/fr.js @@ -86,6 +86,8 @@ var translateFR = { "document.metadata.type.poster" : "Poster", "document.metadata.type.conferenceArticle" : "Acte de colloque", "document.metadata.type.conferenceSummary" : "Communication sans actes", +"document.metadata.type.data" : "Données", +"document.metadata.type.other" : "Autre", "document.metadata.file" : "Fichier", "document.metadata.mimetype" : "Type Mime", "document.metadata.externalUrl" : "URL externe", diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index 2dad51f..3a46673 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -103,6 +103,10 @@ coselmarControllers.controller("unauthorizedCtrl", ['$scope', function ($scope) }]); +///////////////////////////////////////////////// +//////////// Documents Part /////////////////// +///////////////////////////////////////////////// + // Controller for All Documents View coselmarControllers.controller("DocumentsCtrl", ['$scope', '$route', '$routeParams', '$location', 'documentService', function($scope, $route, $routeParams, $location, documentService){ @@ -184,14 +188,17 @@ coselmarControllers.controller("NewDocumentCtrl", ['$scope', '$location', 'docum $scope.existing.keywords = results; }); - $scope.createNewDocument = function(isValidForm){ + $scope.createNewDocument = function(){ if (angular.isDate($scope.document.publicationDate)) { $scope.document.publicationDate = $scope.document.publicationDate.getTime(); } - // Call service to create a new document - if (isValidForm) { + if ($scope.document.keywords.length == 0) { + $scope.keywordsError = true; + } else { + // Call service to create a new document + documentService.saveDocument($scope.document, function(document) { if ($scope.upload.file) { var documentId = document.id; @@ -214,6 +221,7 @@ coselmarControllers.controller("NewDocumentCtrl", ['$scope', '$location', 'docum if (keyword && $scope.document.keywords.indexOf(keyword) == -1) { $scope.document.keywords.push(keyword); } + $scope.keywordsError = false; }; $scope.removeKeyword = function(keyword) { @@ -221,6 +229,10 @@ coselmarControllers.controller("NewDocumentCtrl", ['$scope', '$location', 'docum if (keyword && position != -1) { $scope.document.keywords.splice(position, 1); } + + if ($scope.document.keywords.length == 0) { + $scope.keywordsError = true; + } }; }]); @@ -305,7 +317,10 @@ coselmarControllers.controller("DocumentViewCtrl", } // Call service to save document - if ($scope.isFormValid()) { + if ($scope.document.keywords.length == 0) { + $scope.keywordsError = true; + + } else if ($scope.isFormValid()) { $scope.hasErrors = false; documentService.saveDocument($scope.document, function() { @@ -332,6 +347,7 @@ coselmarControllers.controller("DocumentViewCtrl", if (keyword && $scope.document.keywords.indexOf(keyword) == -1) { $scope.document.keywords.push(keyword); } + $scope.keywordsError = false; }; $scope.removeKeyword = function(keyword) { @@ -339,6 +355,10 @@ coselmarControllers.controller("DocumentViewCtrl", if (keyword && position != -1) { $scope.document.keywords.splice(position, 1); } + + if ($scope.document.keywords.length == 0) { + $scope.keywordsError = true; + } }; // Participants, clients and supervisors management for ui-select @@ -847,7 +867,6 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam } if (!$scope.question.themes || $scope.question.themes.length == 0) { - console.log($scope.question) $scope.themesError = true; } else { // Call service to create a new question diff --git a/coselmar-ui/src/main/webapp/views/documents/editDocument.html b/coselmar-ui/src/main/webapp/views/documents/editDocument.html index caf807c..dcd81c1 100644 --- a/coselmar-ui/src/main/webapp/views/documents/editDocument.html +++ b/coselmar-ui/src/main/webapp/views/documents/editDocument.html @@ -80,6 +80,8 @@ <option value="POSTER">{{ 'document.metadata.type.poster' | translate }}</option> <option value="CONFERENCE_ARTICLE">{{ 'document.metadata.type.conferenceArticle' | translate }}</option> <option value="CONFERENCE_SUMMARY">{{ 'document.metadata.type.conferenceSummary' | translate }}</option> + <option value="DATA">{{ 'document.metadata.type.data' | translate }}</option> + <option value="OTHER">{{ 'document.metadata.type.other' | translate }}</option> </select> <p ng-show="documentForm.type.$invalid && !documentForm.type.$pristine" @@ -170,8 +172,8 @@ <!-- Line with Keywords --> <div class="form-group"> - <div ng-class="{'has-error' : documentForm.keywords.$invalid - && !documentForm.keywords.$pristine}"> + <div ng-class="{'has-error' : (document.keywords.length == 0 + && !documentForm.keywords.$pristine) || keywordsError}"> <label class="col-md-2 control-label">{{ 'document.metadata.keywords' | translate }} *</label> @@ -180,7 +182,7 @@ placeholder="Validate with add" ng-model="toAddKeyword" list="existingKeywords" /> - <p ng-show="document.keywords.length < 1 && !documentForm.keywords.$pristine" + <p ng-show="(document.keywords.length < 1 && !documentForm.keywords.$pristine) || keywordsError" class="help-block">{{ 'document.message.requiredKeywords' | translate }}</p> </div> <datalist id="existingKeywords"> @@ -292,7 +294,7 @@ </div> <div class="actions"> <input type="submit" value="Submit" class="btn btn-action btn-success" - ng-click="saveDocument()" ng-disabled="documentForm.$invalid" /> + ng-click="saveDocument()" ng-disabled="documentForm.$invalid || keywordsError" /> </div> </div> </form> diff --git a/coselmar-ui/src/main/webapp/views/documents/modalDocumentEdit.html b/coselmar-ui/src/main/webapp/views/documents/modalDocumentEdit.html index 71a85fb..a54e568 100644 --- a/coselmar-ui/src/main/webapp/views/documents/modalDocumentEdit.html +++ b/coselmar-ui/src/main/webapp/views/documents/modalDocumentEdit.html @@ -68,6 +68,8 @@ <option value="POSTER">{{ 'document.metadata.type.poster' | translate }}</option> <option value="CONFERENCE_ARTICLE">{{ 'document.metadata.type.conferenceArticle' | translate }}</option> <option value="CONFERENCE_SUMMARY">{{ 'document.metadata.type.conferenceSummary' | translate }}</option> + <option value="DATA">{{ 'document.metadata.type.data' | translate }}</option> + <option value="OTHER">{{ 'document.metadata.type.other' | translate }}</option> </select> <p ng-show="documentForm.type.$invalid && !documentForm.type.$pristine" diff --git a/coselmar-ui/src/main/webapp/views/documents/newdocument.html b/coselmar-ui/src/main/webapp/views/documents/newdocument.html index 132e1af..cb836cd 100644 --- a/coselmar-ui/src/main/webapp/views/documents/newdocument.html +++ b/coselmar-ui/src/main/webapp/views/documents/newdocument.html @@ -36,7 +36,7 @@ <div class=""> <form class="form-horizontal" name="documentForm" role="form" - ng-submit="createNewDocument(documentForm.$valid)"> + ng-submit="createNewDocument()"> <!-- Line with Title & Authors --> <div class="form-group row"> @@ -89,6 +89,8 @@ <option value="POSTER">{{ 'document.metadata.type.poster' | translate }}</option> <option value="CONFERENCE_ARTICLE">{{ 'document.metadata.type.conferenceArticle' | translate }}</option> <option value="CONFERENCE_SUMMARY">{{ 'document.metadata.type.conferenceSummary' | translate }}</option> + <option value="DATA">{{ 'document.metadata.type.data' | translate }}</option> + <option value="OTHER">{{ 'document.metadata.type.other' | translate }}</option> </select> <p ng-show="documentForm.type.$invalid && !documentForm.type.$pristine" @@ -164,8 +166,8 @@ <!-- Line with Keywords --> <div class="form-group"> - <div ng-class="{'has-error' : documentForm.keywords.$invalid - && !documentForm.keywords.$pristine}"> + <div ng-class="{'has-error' : (document.keywords.length == 0 + && !documentForm.keywords.$pristine) || keywordsError}"> <label class="col-md-2 control-label">{{ 'document.metadata.keywords' | translate }} *</label> @@ -174,7 +176,7 @@ placeholder="Validate with add" ng-model="toAddKeyword" list="existingKeywords" /> - <p ng-show="document.keywords.length < 1 && !documentForm.keywords.$pristine" + <p ng-show="(document.keywords.length < 1 && !documentForm.keywords.$pristine) || keywordsError" class="help-block">{{ 'document.message.requiredKeywords' | translate }}</p> </div> <datalist id="existingKeywords"> @@ -282,7 +284,7 @@ <div class="form-group actions" ng-if="privacy != 'RESTRICTED'"> <input type="submit" value="Submit" class="btn btn-action" - ng-disabled="documentForm.$invalid"/> + ng-disabled="documentForm.$invalid || keywordsError"/> </div> </form> </div> diff --git a/coselmar-ui/src/main/webapp/views/documents/viewDocument.html b/coselmar-ui/src/main/webapp/views/documents/viewDocument.html index 93efff2..95ce5ed 100644 --- a/coselmar-ui/src/main/webapp/views/documents/viewDocument.html +++ b/coselmar-ui/src/main/webapp/views/documents/viewDocument.html @@ -50,6 +50,8 @@ <dd ng-if="document.type == 'POSTER'">{{ 'document.metadata.type.poster' | translate }}</dd> <dd ng-if="document.type == 'CONFERENCE_ARTICLE'">{{ 'document.metadata.type.conferenceArticle' | translate }}</dd> <dd ng-if="document.type == 'CONFERENCE_SUMMARY'">{{ 'document.metadata.type.conferenceSummary' | translate }}</dd> + <dd ng-if="document.type == 'DATA'">{{ 'document.metadata.type.data' | translate }}</dd> + <dd ng-if="document.type == 'OTHER'">{{ 'document.metadata.type.other' | translate }}</dd> </dl> <dl> <dt>{{ 'document.metadata.mimetype' | translate }}</dt> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm