selectize-rails 0.12.2 → 0.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7e84f5ce126f32fbabf41a9e52abf21ee50f21a
4
- data.tar.gz: 2116854e115d27fd63d4de6c5204247d69fa2e21
3
+ metadata.gz: 2c8d908c072aaa1116700105374016f432ad3ab8
4
+ data.tar.gz: 14dfd92a4353e875f4ca38a9db0e7627e1bd91b0
5
5
  SHA512:
6
- metadata.gz: 27112eea339556194297538b0b2594479e67f3c291a8a5ca21a58c53456ce7b3a7113a9f61be5fe1cb7e696f2e7954da736415798c04fe6d7fa22274290916e7
7
- data.tar.gz: 9e01c04d222aeee330d023e6e45ba27a17e8059476ddb447f64c169139359ccdd044e7dbbcba6f760c2860b3d797540c489d8e20adea8349c222d4c631c7b81e
6
+ metadata.gz: e344f217217bfaa24fd820d6a48663b3e5bc45cd0ce1412e90cf21dd8a0ef4c6bdbeca5c3491a396b4ee2f8d8cb6f582f8fc51f9c1d9d892f56f962b743036b5
7
+ data.tar.gz: 3dac8c6a26a4e3ed82170b114f8457e5c8f2c097bf5730911e508aac957939475353205d8dcf2438932f78ce523abc085a3c5c937c78549b2b8a49d253b8a8c5
@@ -1,25 +1,28 @@
1
- # Changelog
2
-
3
- | Version | Notes |
4
- | --------:| ----------------------------------------------------------- |
5
- | 0.12.0 | Update to v0.12.0 of selectize.js |
6
- | 0.11.2 | Update to v0.11.2 of selectize.js |
7
- | 0.11.0 | Update to v0.11.0 of selectize.js |
8
- | 0.9.1 | Update to v0.9.1 of selectize.js |
9
- | 0.9.0 | Update to v0.9.0 of selectize.js |
10
- | 0.8.5 | Update to v0.8.5 of selectize.js |
11
- | 0.8.4 | Update to v0.8.4 of selectize.js |
12
- | 0.8.3 | Update to v0.8.3 of selectize.js |
13
- | 0.8.1 | Update to v0.8.1 of selectize.js |
14
- | 0.8.0 | Update to v0.8.0 of selectize.js |
15
- | 0.7.7 | Update to v0.7.7 of selectize.js |
16
- | 0.7.6 | Update to v0.7.6 of selectize.js |
17
- | 0.7.5 | Update to v0.7.5 of selectize.js |
18
- | 0.7.4 | Update to v0.7.4 of selectize.js |
19
- | 0.7.3 | Update to v0.7.3 of selectize.js |
20
- | 0.7.2 | Update to v0.7.2 of selectize.js |
21
- | 0.7.0 | Update to v0.7.0 of selectize.js |
22
- | 0.6.14 | Update to v0.6.14 of selectize.js |
23
- | 0.6.4 | Update to v0.6.4 of selectize.js |
24
- | 0.6.1 | Update and set gem version equal to selectize.js version |
25
- | 0.1.0 | Initial release |
1
+ # Changelog
2
+
3
+ | Version | Notes |
4
+ | --------:| ----------------------------------------------------------- |
5
+ | 0.12.3 | Update to v0.12.3 of selectize.js |
6
+ | 0.12.2 | Update to v0.12.2 of selectize.js |
7
+ | 0.12.1 | Update to v0.12.1 of selectize.js |
8
+ | 0.12.0 | Update to v0.12.0 of selectize.js |
9
+ | 0.11.2 | Update to v0.11.2 of selectize.js |
10
+ | 0.11.0 | Update to v0.11.0 of selectize.js |
11
+ | 0.9.1 | Update to v0.9.1 of selectize.js |
12
+ | 0.9.0 | Update to v0.9.0 of selectize.js |
13
+ | 0.8.5 | Update to v0.8.5 of selectize.js |
14
+ | 0.8.4 | Update to v0.8.4 of selectize.js |
15
+ | 0.8.3 | Update to v0.8.3 of selectize.js |
16
+ | 0.8.1 | Update to v0.8.1 of selectize.js |
17
+ | 0.8.0 | Update to v0.8.0 of selectize.js |
18
+ | 0.7.7 | Update to v0.7.7 of selectize.js |
19
+ | 0.7.6 | Update to v0.7.6 of selectize.js |
20
+ | 0.7.5 | Update to v0.7.5 of selectize.js |
21
+ | 0.7.4 | Update to v0.7.4 of selectize.js |
22
+ | 0.7.3 | Update to v0.7.3 of selectize.js |
23
+ | 0.7.2 | Update to v0.7.2 of selectize.js |
24
+ | 0.7.0 | Update to v0.7.0 of selectize.js |
25
+ | 0.6.14 | Update to v0.6.14 of selectize.js |
26
+ | 0.6.4 | Update to v0.6.4 of selectize.js |
27
+ | 0.6.1 | Update and set gem version equal to selectize.js version |
28
+ | 0.1.0 | Initial release |
data/README.md CHANGED
@@ -30,17 +30,18 @@ In your `application.css`, include the following:
30
30
 
31
31
  ### Themes
32
32
 
33
- To include additional theme's you can replace the `selectize.default` for one of the [theme files](https://github.com/brianreavis/selectize.js/tree/master/dist/css)
33
+ To include additional theme's you can replace the `selectize.default` for one of the [theme files](https://github.com/selectize/selectize.js/tree/master/dist/css)
34
34
 
35
35
 
36
36
  ## Examples
37
37
 
38
- See the [demo page of Brian Reavis](http://brianreavis.github.io/selectize.js/) for examples how to use the plugin
38
+ See the [demo page](http://selectize.github.io/selectize.js/) for examples how to use the plugin
39
39
 
40
40
  ## Changes
41
41
 
42
42
  | Version | Notes |
43
43
  | --------:| ----------------------------------------------------------- |
44
+ | 0.12.3 | Update to v0.12.3 of selectize.js |
44
45
  | 0.12.2 | Update to v0.12.2 of selectize.js |
45
46
  | 0.12.1 | Update to v0.12.1 of selectize.js |
46
47
  | 0.12.0 | Update to v0.12.0 of selectize.js |
@@ -56,7 +57,7 @@ See the [demo page of Brian Reavis](http://brianreavis.github.io/selectize.js/)
56
57
 
57
58
  ## License
58
59
 
59
- * The [selectize.js](http://brianreavis.github.io/selectize.js/) plugin is licensed under the
60
+ * The [selectize.js](http://selectize.github.io/selectize.js/) plugin is licensed under the
60
61
  [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
61
62
  * The [selectize-rails](https://github.com/manuelvanrijn/selectize-rails) project is
62
63
  licensed under the [MIT License](http://opensource.org/licenses/mit-license.html)
@@ -1,5 +1,5 @@
1
- module Selectize
2
- module Rails
3
- VERSION = "0.12.2"
4
- end
5
- end
1
+ module Selectize
2
+ module Rails
3
+ VERSION = "0.12.3"
4
+ end
5
+ end
@@ -635,7 +635,7 @@
635
635
  }));
636
636
 
637
637
  /**
638
- * selectize.js (v0.12.2)
638
+ * selectize.js (v0.12.3)
639
639
  * Copyright (c) 2013–2015 Brian Reavis & contributors
640
640
  *
641
641
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -696,6 +696,20 @@
696
696
  });
697
697
  };
698
698
 
699
+ /**
700
+ * removeHighlight fn copied from highlight v5 and
701
+ * edited to remove with() and pass js strict mode
702
+ */
703
+ jQuery.fn.removeHighlight = function() {
704
+ return this.find("span.highlight").each(function() {
705
+ this.parentNode.firstChild.nodeName;
706
+ var parent = this.parentNode;
707
+ parent.replaceChild(this.firstChild, this);
708
+ parent.normalize();
709
+ }).end();
710
+ };
711
+
712
+
699
713
  var MicroEvent = function() {};
700
714
  MicroEvent.prototype = {
701
715
  on: function(event, fct){
@@ -758,7 +772,8 @@
758
772
  var TAG_INPUT = 2;
759
773
 
760
774
  // for now, android support in general is too spotty to support validity
761
- var SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('form').validity;
775
+ var SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('input').validity;
776
+
762
777
 
763
778
  var isset = function(object) {
764
779
  return typeof object !== 'undefined';
@@ -1088,6 +1103,20 @@
1088
1103
  return tmp.innerHTML;
1089
1104
  };
1090
1105
 
1106
+ var logError = function(message, options){
1107
+ if(!options) options = {};
1108
+ var component = "Selectize";
1109
+
1110
+ console.error(component + ": " + message)
1111
+
1112
+ if(options.explanation){
1113
+ // console.group is undefined in <IE11
1114
+ if(console.group) console.group();
1115
+ console.error(options.explanation);
1116
+ if(console.group) console.groupEnd();
1117
+ }
1118
+ }
1119
+
1091
1120
 
1092
1121
  var Selectize = function($input, settings) {
1093
1122
  var key, i, n, dir, input, self = this;
@@ -1177,7 +1206,18 @@
1177
1206
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1178
1207
 
1179
1208
  MicroEvent.mixin(Selectize);
1180
- MicroPlugin.mixin(Selectize);
1209
+
1210
+ if(typeof MicroPlugin !== "undefined"){
1211
+ MicroPlugin.mixin(Selectize);
1212
+ }else{
1213
+ logError("Dependency MicroPlugin is missing",
1214
+ {explanation:
1215
+ "Make sure you either: (1) are using the \"standalone\" "+
1216
+ "version of Selectize, or (2) require MicroPlugin before you "+
1217
+ "load Selectize."}
1218
+ );
1219
+ }
1220
+
1181
1221
 
1182
1222
  // methods
1183
1223
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -1206,6 +1246,7 @@
1206
1246
  var timeout_focus;
1207
1247
  var classes;
1208
1248
  var classes_plugins;
1249
+ var inputId;
1209
1250
 
1210
1251
  inputMode = self.settings.mode;
1211
1252
  classes = $input.attr('class') || '';
@@ -1217,6 +1258,11 @@
1217
1258
  $dropdown = $('<div>').addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent);
1218
1259
  $dropdown_content = $('<div>').addClass(settings.dropdownContentClass).appendTo($dropdown);
1219
1260
 
1261
+ if(inputId = $input.attr('id')) {
1262
+ $control_input.attr('id', inputId + '-selectized');
1263
+ $("label[for='"+inputId+"']").attr('for', inputId + '-selectized');
1264
+ }
1265
+
1220
1266
  if(self.settings.copyClassesToDropdown) {
1221
1267
  $dropdown.addClass(classes);
1222
1268
  }
@@ -1492,19 +1538,26 @@
1492
1538
  */
1493
1539
  onPaste: function(e) {
1494
1540
  var self = this;
1541
+
1495
1542
  if (self.isFull() || self.isInputHidden || self.isLocked) {
1496
1543
  e.preventDefault();
1497
- } else {
1498
- // If a regex or string is included, this will split the pasted
1499
- // input and create Items for each separate value
1500
- if (self.settings.splitOn) {
1501
- setTimeout(function() {
1502
- var splitInput = $.trim(self.$control_input.val() || '').split(self.settings.splitOn);
1503
- for (var i = 0, n = splitInput.length; i < n; i++) {
1504
- self.createItem(splitInput[i]);
1505
- }
1506
- }, 0);
1507
- }
1544
+ return;
1545
+ }
1546
+
1547
+ // If a regex or string is included, this will split the pasted
1548
+ // input and create Items for each separate value
1549
+ if (self.settings.splitOn) {
1550
+
1551
+ // Wait for pasted text to be recognized in value
1552
+ setTimeout(function() {
1553
+ var pastedText = self.$control_input.val();
1554
+ if(!pastedText.match(self.settings.splitOn)){ return }
1555
+
1556
+ var splitInput = $.trim(pastedText).split(self.settings.splitOn);
1557
+ for (var i = 0, n = splitInput.length; i < n; i++) {
1558
+ self.createItem(splitInput[i]);
1559
+ }
1560
+ }, 0);
1508
1561
  }
1509
1562
  },
1510
1563
 
@@ -2191,6 +2244,7 @@
2191
2244
 
2192
2245
  // highlight matching terms inline
2193
2246
  if (self.settings.highlight && results.query.length && results.tokens.length) {
2247
+ $dropdown_content.removeHighlight();
2194
2248
  for (i = 0, n = results.tokens.length; i < n; i++) {
2195
2249
  highlight($dropdown_content, results.tokens[i].regex);
2196
2250
  }
@@ -2688,12 +2742,26 @@
2688
2742
  * and CSS classes.
2689
2743
  */
2690
2744
  refreshState: function() {
2691
- var invalid, self = this;
2692
- if (self.isRequired) {
2693
- if (self.items.length) self.isInvalid = false;
2694
- self.$control_input.prop('required', invalid);
2695
- }
2696
- self.refreshClasses();
2745
+ this.refreshValidityState();
2746
+ this.refreshClasses();
2747
+ },
2748
+
2749
+ /**
2750
+ * Update the `required` attribute of both input and control input.
2751
+ *
2752
+ * The `required` property needs to be activated on the control input
2753
+ * for the error to be displayed at the right place. `required` also
2754
+ * needs to be temporarily deactivated on the input since the input is
2755
+ * hidden and can't show errors.
2756
+ */
2757
+ refreshValidityState: function() {
2758
+ if (!this.isRequired) return false;
2759
+
2760
+ var invalid = !this.items.length;
2761
+
2762
+ this.isInvalid = invalid;
2763
+ this.$control_input.prop('required', invalid);
2764
+ this.$input.prop('required', !invalid);
2697
2765
  },
2698
2766
 
2699
2767
  /**
@@ -2804,6 +2872,7 @@
2804
2872
 
2805
2873
  if (self.settings.mode === 'single' && self.items.length) {
2806
2874
  self.hideInput();
2875
+ self.$control_input.blur(); // close keyboard on iOS
2807
2876
  }
2808
2877
 
2809
2878
  self.isOpen = false;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * selectize.bootstrap2.css (v0.12.2) - Bootstrap 2 Theme
2
+ * selectize.bootstrap2.css (v0.12.3) - Bootstrap 2 Theme
3
3
  * Copyright (c) 2013–2015 Brian Reavis & contributors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -1,5 +1,5 @@
1
1
  /**
2
- * selectize.bootstrap3.css (v0.12.2) - Bootstrap 3 Theme
2
+ * selectize.bootstrap3.css (v0.12.3) - Bootstrap 3 Theme
3
3
  * Copyright (c) 2013–2015 Brian Reavis & contributors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -1,5 +1,5 @@
1
1
  /**
2
- * selectize.css (v0.12.2)
2
+ * selectize.css (v0.12.3)
3
3
  * Copyright (c) 2013–2015 Brian Reavis & contributors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -1,5 +1,5 @@
1
1
  /**
2
- * selectize.default.css (v0.12.2) - Default Theme
2
+ * selectize.default.css (v0.12.3) - Default Theme
3
3
  * Copyright (c) 2013–2015 Brian Reavis & contributors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -1,5 +1,5 @@
1
1
  /**
2
- * selectize.legacy.css (v0.12.2) - Default Theme
2
+ * selectize.legacy.css (v0.12.3) - Default Theme
3
3
  * Copyright (c) 2013–2015 Brian Reavis & contributors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selectize-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.2
4
+ version: 0.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel van Rijn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-29 00:00:00.000000000 Z
11
+ date: 2016-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler