From 7686a892d556333194349f73fee3a268b6202d66 Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Wed, 15 Oct 2014 16:52:56 +0000
Subject: [PATCH] #2021 config - Fixed some catalogs, LicenseType and Users

---
 securis/src/main/resources/static/js/angular/chosen.js |   53 ++++++++++++++++++++++++++++-------------------------
 1 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/securis/src/main/resources/static/js/angular/chosen.js b/securis/src/main/resources/static/js/angular/chosen.js
index 8862297..23ba74e 100644
--- a/securis/src/main/resources/static/js/angular/chosen.js
+++ b/securis/src/main/resources/static/js/angular/chosen.js
@@ -1,11 +1,12 @@
-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.6.2
 (function() {
   var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
 
   angular.module('localytics.directives', []);
 
   angular.module('localytics.directives').directive('chosen', function() {
-    var CHOSEN_OPTION_WHITELIST, NG_OPTIONS_REGEXP, chosen, isEmpty, snakeCase;
+    var CHOSEN_OPTION_WHITELIST, NG_OPTIONS_REGEXP, isEmpty, snakeCase;
+
     NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/;
     CHOSEN_OPTION_WHITELIST = ['noResultsText', 'allowSingleDeselect', 'disableSearchThreshold', 'disableSearch', 'enableSplitWordSearch', 'inheritSelectClasses', 'maxSelectedOptions', 'placeholderTextMultiple', 'placeholderTextSingle', 'searchContains', 'singleBackstrokeDelete', 'displayDisabledOptions', 'displaySelectedOptions', 'width'];
     snakeCase = function(input) {
@@ -15,6 +16,7 @@
     };
     isEmpty = function(value) {
       var key;
+
       if (angular.isArray(value)) {
         return value.length === 0;
       } else if (angular.isObject(value)) {
@@ -26,12 +28,13 @@
       }
       return true;
     };
-    return chosen = {
+    return {
       restrict: 'A',
       require: '?ngModel',
       terminal: true,
-      link: function(scope, element, attr, ctrl) {
-        var disableWithMessage, empty, initOrUpdate, initialized, match, options, origRender, removeEmptyMessage, startLoading, stopLoading, valuesExpr, viewWatch;
+      link: function(scope, element, attr, ngModel) {
+        var chosen, defaultText, disableWithMessage, empty, initOrUpdate, match, options, origRender, removeEmptyMessage, startLoading, stopLoading, valuesExpr, viewWatch;
+
         element.addClass('localytics-chosen');
         options = scope.$eval(attr.chosen) || {};
         angular.forEach(attr, function(value, key) {
@@ -45,56 +48,56 @@
         stopLoading = function() {
           return element.removeClass('loading').attr('disabled', false).trigger('chosen:updated');
         };
-        initialized = false;
+        chosen = null;
+        defaultText = null;
         empty = false;
         initOrUpdate = function() {
-          if (initialized) {
+          if (chosen) {
             return element.trigger('chosen:updated');
           } else {
-            element.chosen(options);
-            return initialized = true;
+            chosen = element.chosen(options).data('chosen');
+            return defaultText = chosen.default_text;
           }
         };
         removeEmptyMessage = function() {
           empty = false;
-          return element.find('option.empty').remove();
+          return element.attr('data-placeholder', defaultText);
         };
-        disableWithMessage = function(message) {
+        disableWithMessage = function() {
           empty = true;
-          return element.empty().append("<option selected class=\"empty\">" + message + "</option>").attr('disabled', true).trigger('chosen:updated');
+          return element.attr('data-placeholder', chosen.results_none_found).attr('disabled', true).trigger('chosen:updated');
         };
-        if (ctrl) {
-          origRender = ctrl.$render;
-          ctrl.$render = function() {
+        if (ngModel) {
+          origRender = ngModel.$render;
+          ngModel.$render = function() {
             origRender();
             return initOrUpdate();
           };
           if (attr.multiple) {
             viewWatch = function() {
-              return ctrl.$viewValue;
+              return ngModel.$viewValue;
             };
-            scope.$watch(viewWatch, ctrl.$render, true);
+            scope.$watch(viewWatch, ngModel.$render, true);
           }
         } else {
           initOrUpdate();
         }
-        attr.$observe('disabled', function(value) {
+        attr.$observe('disabled', function() {
           return element.trigger('chosen:updated');
         });
-        if (attr.ngOptions) {
+        if (attr.ngOptions && ngModel) {
           match = attr.ngOptions.match(NG_OPTIONS_REGEXP);
           valuesExpr = match[7];
-          if (angular.isUndefined(scope.$eval(valuesExpr))) {
-            startLoading();
-          }
           return scope.$watchCollection(valuesExpr, function(newVal, oldVal) {
-            if (newVal !== oldVal) {
+            if (angular.isUndefined(newVal)) {
+              return startLoading();
+            } else {
               if (empty) {
                 removeEmptyMessage();
               }
               stopLoading();
               if (isEmpty(newVal)) {
-                return disableWithMessage(options.no_results_text || 'No values available');
+                return disableWithMessage();
               }
             }
           });
@@ -103,4 +106,4 @@
     };
   });
 
-}).call(this);
+}).call(this);
\ No newline at end of file

--
Gitblit v1.3.2