From cedf6c7baedde4687d11c92ec447594dec7ea9bd Mon Sep 17 00:00:00 2001 From: Andrey Eremin Date: Tue, 4 Mar 2014 16:27:01 +0400 Subject: [PATCH] Update angular-ui-select2 to version 0.0.5. --- README.md | 2 +- lib/angular/ui/select2/rails/version.rb | 2 +- .../angular-ui-select2-original.js | 65 ++++++++++++------- 3 files changed, 43 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 2a8dd82..bb0196f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # angular-ui-select2-rails -[angular-ui-select2](https://github.com/angular-ui/ui-select2) packaged for Rails assets pipeline +[angular-ui-select2](https://github.com/angular-ui/ui-select2) v0.0.5 packaged for Rails assets pipeline ## Usage diff --git a/lib/angular/ui/select2/rails/version.rb b/lib/angular/ui/select2/rails/version.rb index e4ffd9a..fb7ffd9 100644 --- a/lib/angular/ui/select2/rails/version.rb +++ b/lib/angular/ui/select2/rails/version.rb @@ -2,7 +2,7 @@ module Angular module Ui module Select2 module Rails - VERSION = "0.1.1" + VERSION = "0.1.2" end end end diff --git a/vendor/assets/javascripts/angular-ui-select2-original.js b/vendor/assets/javascripts/angular-ui-select2-original.js index d8c50fa..3b2da3b 100644 --- a/vendor/assets/javascripts/angular-ui-select2-original.js +++ b/vendor/assets/javascripts/angular-ui-select2-original.js @@ -12,12 +12,13 @@ angular.module('ui.select2', []).value('uiSelect2Config', {}).directive('uiSelec } return { require: 'ngModel', + priority: 1, compile: function (tElm, tAttrs) { var watch, repeatOption, repeatAttr, isSelect = tElm.is('select'), - isMultiple = (tAttrs.multiple !== undefined); + isMultiple = angular.isDefined(tAttrs.multiple); // Enable watching of the options dataset if in use if (tElm.is('select')) { @@ -39,21 +40,21 @@ angular.module('ui.select2', []).value('uiSelect2Config', {}).directive('uiSelec var convertToAngularModel = function(select2_data) { var model; if (opts.simple_tags) { - model = [] + model = []; angular.forEach(select2_data, function(value, index) { - model.push(value.id) - }) + model.push(value.id); + }); } else { - model = select2_data + model = select2_data; } - return model - } + return model; + }; /* Convert from Angular view-model to Select2 view-model. */ var convertToSelect2Model = function(angular_data) { - var model = [] + var model = []; if (!angular_data) { return model; } @@ -64,12 +65,12 @@ angular.module('ui.select2', []).value('uiSelect2Config', {}).directive('uiSelec angular_data, function(value, index) { model.push({'id': value, 'text': value}); - }) + }); } else { model = angular_data; } - return model - } + return model; + }; if (isSelect) { // Use