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 3dc7016a4cf9c3f81ff8e05135074f6fefcfc5f6 Author: Yannick Martel <martel@©odelutin.com> Date: Fri Jan 15 16:35:41 2016 +0100 fixes #7910 allow multi-add on keywords and themes --- .../src/main/webapp/js/coselmar-controllers.js | 63 +++++++++++++++------- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index 742dbea..500f88e 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -334,11 +334,17 @@ coselmarControllers.controller("NewDocumentCtrl", ['$scope', '$location', 'notif }; - $scope.addKeyword = function(keyword) { - if (keyword && $scope.document.keywords.indexOf(keyword) == -1) { - $scope.document.keywords.push(keyword); + $scope.addKeyword = function(keywordList) { + if (keywordList) { + var keywords = keywordList.split( /,\s*/ ); + for (var i = 0; i < keywords.length; i++) { + var keyword = keywords[i].trim(); + if ($scope.document.keywords.indexOf(keyword) == -1) { + $scope.document.keywords.push(keyword); + } + } } - $scope.keywordsError = false; + $scope.keywordsError = false; }; $scope.removeKeyword = function(keyword) { @@ -481,9 +487,15 @@ coselmarControllers.controller("DocumentViewCtrl", }; - $scope.addKeyword = function(keyword) { - if (keyword && $scope.document.keywords.indexOf(keyword) == -1) { - $scope.document.keywords.push(keyword); + $scope.addKeyword = function(keywordList) { + if (keywordList) { + var keywords = keywordList.split( /,\s*/ ); + for (var i = 0; i < keywords.length; i++) { + var keyword = keywords[i].trim(); + if ($scope.document.keywords.indexOf(keyword) == -1) { + $scope.document.keywords.push(keyword); + } + } } $scope.keywordsError = false; }; @@ -1299,16 +1311,21 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam } }; - $scope.addTheme = function(theme) { + $scope.addTheme = function(themeList) { if (!$scope.question.themes) { $scope.question.themes = []; - $scope.question.themes.push(theme); - - } else if (theme && $scope.question.themes.indexOf(theme) == -1) { - $scope.question.themes.push(theme); + } + if (themeList) { + var themes = themeList.split( /,\s*/ ); + for (var i = 0; i < themes.length; i++) { + var theme = themes[i].trim(); + if ($scope.question.themes.indexOf(theme) == -1) { + $scope.question.themes.push(theme); + } + } } - $scope.themesError = false; - } + $scope.keywordsError = false; + }; $scope.removeTheme = function(theme) { var position = $scope.question.themes.indexOf(theme); @@ -1540,12 +1557,18 @@ coselmarControllers.controller('ModalCreateDocumentsCtrl', function ($scope, $ui $scope.modalExisting.types = result; }); - $scope.addKeyword = function(keyword) { - if (keyword && $scope.document.keywords.indexOf(keyword) == -1) { - $scope.document.keywords.push(keyword); - } - $scope.keywordsError = false; - } + $scope.addKeyword = function(keywordList) { + if (keywordList) { + var keywords = keywordList.split( /,\s*/ ); + for (var i = 0; i < keywords.length; i++) { + var keyword = keywords[i].trim(); + if ($scope.document.keywords.indexOf(keyword) == -1) { + $scope.document.keywords.push(keyword); + } + } + } + $scope.keywordsError = false; + }; $scope.removeKeyword = function(keyword) { var position = $scope.document.keywords.indexOf(keyword); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.