branch develop updated (767c8a8 -> d8f4922)
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 767c8a8 Display improvments new d8f4922 add error on modal when no file and no externalURL given for document internal-test #6682 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 d8f49221acc2013627c30037b3d8c4bc9c4193cd Author: Yannick Martel <martel@©odelutin.com> Date: Thu Feb 19 16:36:34 2015 +0100 add error on modal when no file and no externalURL given for document internal-test #6682 Summary of changes: .../src/main/webapp/js/coselmar-controllers.js | 24 ++++++++++++++++------ .../webapp/views/documents/modalDocumentEdit.html | 24 ++++++++++++++-------- 2 files changed, 34 insertions(+), 14 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 d8f49221acc2013627c30037b3d8c4bc9c4193cd Author: Yannick Martel <martel@©odelutin.com> Date: Thu Feb 19 16:36:34 2015 +0100 add error on modal when no file and no externalURL given for document internal-test #6682 --- .../src/main/webapp/js/coselmar-controllers.js | 24 ++++++++++++++++------ .../webapp/views/documents/modalDocumentEdit.html | 24 ++++++++++++++-------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index 64a4f00..b988fa8 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -1320,7 +1320,7 @@ coselmarControllers.controller('ModalSearchQuestionsCtrl', function ($scope, $mo }); -coselmarControllers.controller('ModalCreateDocumentsCtrl', function ($scope, $modalInstance, documentService) { +coselmarControllers.controller('ModalCreateDocumentsCtrl', function ($scope, $modalInstance, documentService, errorService) { $scope.document = {'privacy': 'PUBLIC', 'keywords' : []}; $scope.upload = {}; @@ -1338,6 +1338,7 @@ coselmarControllers.controller('ModalCreateDocumentsCtrl', function ($scope, $mo if (keyword && $scope.document.keywords.indexOf(keyword) == -1) { $scope.document.keywords.push(keyword); } + $scope.keywordsError = false; } $scope.removeKeyword = function(keyword) { @@ -1345,6 +1346,10 @@ coselmarControllers.controller('ModalCreateDocumentsCtrl', function ($scope, $mo if (keyword && position != -1) { $scope.document.keywords.splice(position, 1); } + + if ($scope.document.keywords.length == 0) { + $scope.keywordsError = true; + } } $scope.create = function (isValidForm) { @@ -1353,7 +1358,15 @@ coselmarControllers.controller('ModalCreateDocumentsCtrl', function ($scope, $mo $scope.document.publicationDate = $scope.document.publicationDate.getTime(); } - if (isValidForm) { + if ($scope.document.keywords.length == 0) { + $scope.keywordsError = true; + + } else if (!$scope.document.externalUrl && !$scope.upload.file) { + $scope.hasErrors = true; + $scope.missingFileOrExternalError = true; + + } else if (isValidForm) { + $scope.hasErrors = false; documentService.saveDocument($scope.document, function(document) { if ($scope.upload.file) { var documentId = document.id; @@ -1363,10 +1376,9 @@ coselmarControllers.controller('ModalCreateDocumentsCtrl', function ($scope, $mo } else { $modalInstance.close(document); } - }, function(error) { - console.log("error occurs"); - } - ); + }, errorService.defaultFailOnCall); + } else { + $scope.hasErrors = true; } }; diff --git a/coselmar-ui/src/main/webapp/views/documents/modalDocumentEdit.html b/coselmar-ui/src/main/webapp/views/documents/modalDocumentEdit.html index 5366525..409ccd8 100644 --- a/coselmar-ui/src/main/webapp/views/documents/modalDocumentEdit.html +++ b/coselmar-ui/src/main/webapp/views/documents/modalDocumentEdit.html @@ -119,9 +119,9 @@ <!-- Line with file and externalURL --> <div class="form-group" - ng-class="{'has-error' : - documentForm.externalUrl.$invalid && !documentForm.externalUrl.$pristine && - !upload.file}"> + ng-class="{'has-error' : (!document.externalUrl + && !documentForm.externalUrl.$pristine && !upload.file) + || missingFileOrExternalError }"> <div class=""> <label class="col-md-2 control-label">{{ 'document.metadata.file' | translate }}</label> @@ -149,17 +149,19 @@ <!-- 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> + <label class="col-md-2 control-label">{{ 'document.metadata.keywords' | translate }} * + <span class="fa fa-info-circle" tooltip-placement="bottom" tooltip-html-unsafe="{{ 'document.message.info.keywords' | translate }}"></span> + </label> <div class="col-md-2"> <input type="text" class="form-control" name="keywords" placeholder="Validate with add" data-ng-model="modalToAddKeyword" list="modalExistingKeywords"/> - <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="modalExistingKeywords"> @@ -273,11 +275,17 @@ </div> <!-- End Line with Comment --> + <!-- In case of errors --> + <div ng-if="documentForm.$invalid || hasErrors" class="has-error"> + <div class="text-center help-block">{{ 'common.message.missingMandatoryFields' | translate }}</div> + </div> + </div> <div class="modal-footer"> <button class="btn btn-action btn-disable" ng-click="cancel()">{{ 'common.button.cancel' | translate }}</button> - <input type="submit" value="Submit" class="btn btn-action btn-success float-right" /> + <input type="submit" value="Submit" class="btn btn-action btn-success float-right" + ng-disabled="documentForm.$invalid || keywordsError || (!document.externalUrl && !file.upload)" /> </div> </form> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm