active_frontend 14.0.57 → 14.0.58

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: 423d21c42bd7254d7ef43b7834df7f674ca06872
4
- data.tar.gz: 936521347d186c01299d1b1e6a813e3ccfef248e
3
+ metadata.gz: 410ecb7142e9a3940069a50b04e2cc911f4176e9
4
+ data.tar.gz: 48f6845ad13b66025735d9dffabd96bc7683095d
5
5
  SHA512:
6
- metadata.gz: ea0fb467e4f7aa89dd3fca2946d2c3a93db520a9a09d31ca05168902c5a42bee470909d1f8e5bc4d8ce9c358a8efe402caa8f87f8cbc36327585dfb8ba910df4
7
- data.tar.gz: 53130f6e9f6de5cd46248e4ba476fdcc8fb68297f0f4ab79d5610f03db7eac49a1869d6250164f2fc374b78a91bbdbca364b221361b719c944a48433de712aeb
6
+ metadata.gz: 52a2cbc83490faa90a04684f1d5c2454a38b2e791e343c9b773204de68b770232bcf98c5d569cd949c8a1af4562dd6ba55cc55d6c9172efffab6e0d66f3f1055
7
+ data.tar.gz: fd55e040d75bf3f19809eaf32c475bf262e786839ccbd3bfbea4976e6d5d5f497c41b27264b707b64a2b1967eeba3642b6a7e7a5b1c17554c9902086b9867e56
@@ -1,3 +1,3 @@
1
1
  module ActiveFrontend
2
- VERSION = '14.0.57'.freeze
2
+ VERSION = '14.0.58'.freeze
3
3
  end
@@ -7,7 +7,12 @@
7
7
  var Choicepicker = function (element, options) {
8
8
  this.$element = $(element);
9
9
  this.settings = {
10
- options: this.$element.data('options'),
10
+ choices: this.$element.data('choices'),
11
+ text: {
12
+ all: this.$element.data('text-all') || Choicepicker.DEFAULTS.text.all,
13
+ choiceless: this.$element.data('text-choiceless') || Choicepicker.DEFAULTS.text.choiceless,
14
+ none: this.$element.data('text-none') || Choicepicker.DEFAULTS.text.none
15
+ },
11
16
  type: this.$element.data('type')
12
17
  };
13
18
  this.options = $.extend({}, Choicepicker.DEFAULTS, this.settings, options);
@@ -22,15 +27,15 @@
22
27
 
23
28
  Choicepicker.VERSION = '1.0.0';
24
29
  Choicepicker.DEFAULTS = {
25
- callback: function (option) {},
30
+ callback: function (choice) {},
31
+ choices: [],
32
+ choiceClass: 'form-align-vertical',
26
33
  item: '<li></li>',
27
34
  menu: '<ul class="choicepicker dropmenu caret"><span></span></ul>',
28
- optionClass: 'form-align-vertical',
29
- options: [],
30
35
  text: {
31
36
  all: 'All',
32
- none: 'None',
33
- optionless: 'No options available'
37
+ choiceless: 'No choices available',
38
+ none: 'None'
34
39
  },
35
40
  type: 'checkbox'
36
41
  };
@@ -38,7 +43,7 @@
38
43
  Choicepicker.prototype.constructor = Choicepicker;
39
44
 
40
45
  Choicepicker.prototype.init = function () {
41
- if (!this.hasOptions()) return;
46
+ if (!this.hasChoices()) return;
42
47
 
43
48
  this.elementReadOnly();
44
49
  this.setWidget();
@@ -54,7 +59,7 @@
54
59
  Choicepicker.prototype.clickWidget = function (e) {
55
60
  e.stopPropagation();
56
61
 
57
- if (!this.hasOptions()) return;
62
+ if (!this.hasChoices()) return;
58
63
 
59
64
  this.setVal();
60
65
  };
@@ -63,7 +68,7 @@
63
68
  var _self = this;
64
69
  var menu = $(this.options.menu);
65
70
 
66
- $.each(this.options.options, function (index, hash) {
71
+ $.each(this.options.choices, function (index, hash) {
67
72
  var item = $(_self.options.item);
68
73
 
69
74
  item.append(_self.optionTemplate(hash))
@@ -145,7 +150,7 @@
145
150
  var checkbox = $('<input type="' + type +'" value="' + hash.value + '" name="' + hash.name + '" id="' + selector + '">');
146
151
  checkbox.prop('checked', hash.checked);
147
152
 
148
- var container = $('<div class="form-' + type + ' ' + this.options.optionClass + '">');
153
+ var container = $('<div class="form-' + type + ' ' + this.options.choiceClass + '">');
149
154
  container.append(checkbox);
150
155
  container.append(label);
151
156
 
@@ -173,23 +178,23 @@
173
178
  return label + ' (+' + count + ')';
174
179
  };
175
180
 
176
- Choicepicker.prototype.optionsCount = function () {
177
- return Object.keys(this.options.options).length;
181
+ Choicepicker.prototype.choiceCount = function () {
182
+ return Object.keys(this.options.choices).length;
178
183
  };
179
184
 
180
- Choicepicker.prototype.hasOptions = function () {
181
- return this.optionsCount() !== 0;
185
+ Choicepicker.prototype.hasChoices = function () {
186
+ return this.choiceCount() !== 0;
182
187
  };
183
188
 
184
189
  Choicepicker.prototype.setSelectionsLabel = function () {
185
190
  var _self = this;
186
- var total = this.optionsCount();
191
+ var total = this.choiceCount();
187
192
  var count = 0;
188
193
  var label = '';
189
194
 
190
- if (total === 0) return this.options.text.optionless;
195
+ if (total === 0) return this.options.text.choiceless;
191
196
 
192
- $.each(this.options.options, function (index, hash) {
197
+ $.each(this.options.choices, function (index, hash) {
193
198
  if (hash.checked === undefined) {
194
199
  hash.checked = false;
195
200
  } else {
@@ -247,10 +252,12 @@
247
252
 
248
253
  $(document)
249
254
  .on('ready.bs.choicepicker.data-api', function () {
250
- var $this = $(this).find('[data-toggle="choicepicker"]');
251
- if ($this.data('choicepicker')) return;
252
- Plugin.call($this, $this.data());
253
- }).on('focus.bs.choicepicker.data-api click.bs.choicepicker.data-api', function (e) {
255
+ $('[data-toggle="choicepicker"]').each(function () {
256
+ var $this = $(this);
257
+ if ($this.data('choicepicker')) return;
258
+ Plugin.call($this, $this.data());
259
+ });
260
+ }).on('focus.bs.choicepicker.data-api click.bs.choicepicker.data-api', '[data-toggle="choicepicker"]', function (e) {
254
261
  var $this = $(this);
255
262
  if ($this.data('choicepicker')) return;
256
263
  Plugin.call($this, $this.data());
@@ -492,7 +492,10 @@ textarea {
492
492
  input,
493
493
  textarea,
494
494
  select {
495
- &:focus + label {
495
+ &:focus + label,
496
+ &:focus + .dropmenu + label,
497
+ &:focus + .dropdown + label,
498
+ &:focus + .dropup + label {
496
499
  opacity: 1;
497
500
  top: 0;
498
501
  }
@@ -520,10 +523,6 @@ textarea {
520
523
  vertical-align: middle;
521
524
  }
522
525
 
523
- .btn {
524
- padding-left: 10px;
525
- padding-right: 10px;
526
- }
527
526
  .form-addon {
528
527
  border-style: solid;
529
528
  border-width: 1px;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 14.0.57
4
+ version: 14.0.58
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez