This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.forge.codelutin.com/coselmar.git commit 6b45567e0e81e362bb3110d2b55d18f5471815ba Author: Yannick Martel <martel@©odelutin.com> Date: Wed Feb 17 16:39:00 2016 +0100 refs-80 #8004 try new way to input document keywords --- .../src/main/webapp/js/coselmar-controllers.js | 20 ++++++++++++++ .../main/webapp/views/documents/editDocument.html | 32 ++++++++++++++++------ .../main/webapp/views/documents/newdocument.html | 24 ++++++++++++---- 3 files changed, 62 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 39eeb3f..b4f8a56 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -311,6 +311,7 @@ coselmarControllers.controller("NewDocumentCtrl", ['$scope', '$location', 'notif $scope.upload = {}; $scope.existing = {'types' : [], 'keywords' : []}; $scope.users = []; + $scope.toAddKeywords = {}; documentService.findAllTypes(function(results) { $scope.existing.types = results; @@ -408,6 +409,14 @@ coselmarControllers.controller("NewDocumentCtrl", ['$scope', '$location', 'notif $location.path('/documents'); } + $scope.getExistingKeywords = function(search) { + var newKeywords = $scope.existing.keywords.slice(); + if (search && newKeywords.indexOf(search) === -1) { + newKeywords.unshift(search); + } + return newKeywords; + } + $scope.addKeyword = function(keywordList) { if (keywordList) { var keywords = keywordList.split( /,\s*/ ); @@ -419,6 +428,7 @@ coselmarControllers.controller("NewDocumentCtrl", ['$scope', '$location', 'notif } } $scope.keywordsError = false; + $scope.toAddKeywords = {};// reset field }; $scope.removeKeyword = function(keyword) { @@ -479,6 +489,7 @@ coselmarControllers.controller("DocumentViewCtrl", $scope.upload = {}; $scope.users = []; $scope.hasErrors = false; + $scope.toAddKeywords = {}; $scope.editSession = $routeParams.edit ? $routeParams.edit : false; @@ -615,6 +626,14 @@ coselmarControllers.controller("DocumentViewCtrl", $location.search(""); } + $scope.getExistingKeywords = function(search) { + var newKeywords = $scope.existing.keywords.slice(); + if (search && newKeywords.indexOf(search) === -1) { + newKeywords.unshift(search); + } + return newKeywords; + } + $scope.addKeyword = function(keywordList) { if (keywordList) { var keywords = keywordList.split( /,\s*/ ); @@ -626,6 +645,7 @@ coselmarControllers.controller("DocumentViewCtrl", } } $scope.keywordsError = false; + $scope.toAddKeywords = {};// reset field }; $scope.removeKeyword = function(keyword) { diff --git a/coselmar-ui/src/main/webapp/views/documents/editDocument.html b/coselmar-ui/src/main/webapp/views/documents/editDocument.html index 916d246..04143b4 100644 --- a/coselmar-ui/src/main/webapp/views/documents/editDocument.html +++ b/coselmar-ui/src/main/webapp/views/documents/editDocument.html @@ -200,15 +200,29 @@ × </button> </span> - <input type="text" class="form-control" name="keywords" - placeholder="{{ 'placeholder.addKeyword' | translate }}" - ng-model="toAddKeyword" list="existingKeywords" /> - <button type="button" class="btn btn-primary tag-input-add" value="{{ 'common.button.add' | translate}}" - ng-click="addKeyword(toAddKeyword); toAddKeyword=''"><span class="fa fa-plus"></span></button> - - <datalist id="existingKeywords"> - <option data-ng-repeat="keyword in existing.keywords" value="{{keyword}}"> - </datalist> + <!--<input type="text" class="form-control" name="keywords"--> + <!--placeholder="{{ 'placeholder.addKeyword' | translate }}"--> + <!--ng-model="toAddKeyword" list="existingKeywords" />--> + <!--FIXME #CSS Leo--> + <span class="input-zone"> + <ui-select ng-model="toAddKeywords.selected" + theme="bootstrap" reset-search-input="true" ng-change="addKeyword(toAddKeywords.selected)"> + + <ui-select-match placeholder="{{ 'placeholder.addKeyword' | translate }}"> + {{$select.selected}} + </ui-select-match> + + <ui-select-choices repeat="keyword in getExistingKeywords($select.search) | filter : $select.search" > + {{keyword}} + </ui-select-choices> + </ui-select> + </span> + <!--<button type="button" class="btn btn-primary tag-input-add" value="{{ 'common.button.add' | translate}}"--> + <!--ng-click="addKeyword(toAddKeyword); toAddKeyword=''"><span class="fa fa-plus"></span></button>--> + + <!--<datalist id="existingKeywords">--> + <!--<option data-ng-repeat="keyword in existing.keywords" value="{{keyword}}">--> + <!--</datalist>--> </div> <p ng-show="(document.keywords.length < 1 && !documentForm.keywords.$pristine) || keywordsError" class="help-block">{{ 'document.message.requiredKeywords' | translate }}</p> diff --git a/coselmar-ui/src/main/webapp/views/documents/newdocument.html b/coselmar-ui/src/main/webapp/views/documents/newdocument.html index eb53280..708201d 100644 --- a/coselmar-ui/src/main/webapp/views/documents/newdocument.html +++ b/coselmar-ui/src/main/webapp/views/documents/newdocument.html @@ -194,11 +194,25 @@ </button> </span> - <input type="text" class="form-control" name="keywords" - placeholder="{{ 'placeholder.addKeyword' | translate }}" - ng-model="toAddKeyword" list="existingKeywords" /> - <button type="button" class="btn btn-primary tag-input-add" - ng-click="addKeyword(toAddKeyword); toAddKeyword='';"><span class="fa fa-plus"></span></button> + <!--<input type="text" class="form-control" name="keywords"--> + <!--placeholder="{{ 'placeholder.addKeyword' | translate }}"--> + <!--ng-model="toAddKeyword" list="existingKeywords" />--> + <!--FIXME #CSS Leo--> + <span class="input-zone"> + <ui-select ng-model="toAddKeywords.selected" + theme="bootstrap" reset-search-input="true" ng-change="addKeyword(toAddKeywords.selected)"> + + <ui-select-match placeholder="{{ 'placeholder.addKeyword' | translate }}"> + {{$select.selected}} + </ui-select-match> + + <ui-select-choices repeat="keyword in getExistingKeywords($select.search) | filter : $select.search" > + {{keyword}} + </ui-select-choices> + </ui-select> + </span> + <!--<button type="button" class="btn btn-primary tag-input-add"--> + <!--ng-click="addKeyword(toAddKeyword); toAddKeyword='';"><span class="fa fa-plus"></span></button>--> <datalist id="existingKeywords"> <option data-ng-repeat="keyword in existing.keywords" value="{{keyword}}"> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.