webstaff: Improve combo box functionality
authorMike Rylander <mrylander@gmail.com>
Tue, 29 Sep 2015 17:45:02 +0000 (13:45 -0400)
committerKathy Lussier <klussier@masslnc.org>
Tue, 2 Feb 2016 19:58:47 +0000 (14:58 -0500)
Clicking on down arrow shows all options (possibly following
filtered options)

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/staff/services/ui.js

index 5264d68..9cd0abc 100644 (file)
@@ -222,23 +222,31 @@ function($modal, $interpolate) {
             '<div class="input-group">'+
                 '<input type="text" class="form-control" ng-model="selected" ng-change="makeOpen()">'+
                 '<div class="input-group-btn" dropdown ng-class="{open:isopen}">'+
-                    '<button type="button" class="btn btn-default dropdown-toggle"><span class="caret"></span></button>'+
+                    '<button type="button" ng-click="showAll()" class="btn btn-default dropdown-toggle"><span class="caret"></span></button>'+
                     '<ul class="dropdown-menu dropdown-menu-right">'+
                         '<li ng-repeat="item in list|filter:selected"><a href ng-click="changeValue(item)">{{item}}</a></li>'+
+                        '<li ng-if="all" class="divider"><span></span></li>'+
+                        '<li ng-if="all" ng-repeat="item in list"><a href ng-click="changeValue(item)">{{item}}</a></li>'+
                     '</ul>'+
                 '</div>'+
             '</div>',
         controller: ['$scope','$filter',
             function( $scope , $filter) {
 
-                $scope.always = true;
+                $scope.all = false;
                 $scope.isopen = false;
 
+                $scope.showAll = function () {
+                    if ($scope.selected.length > 0)
+                        $scope.all = true;
+                }
+
                 $scope.makeOpen = function () {
-                    return $scope.isopen = $filter('filter')(
+                    $scope.isopen = $filter('filter')(
                         $scope.list,
                         $scope.selected
                     ).length > 0 && $scope.selected.length > 0;
+                    $scope.all = false;
                 }
 
                 $scope.changeValue = function (newVal) {