active_frontend 14.0.62 → 14.0.63
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0647c6a2055bec68003471136ce7027d1ae02ced
|
4
|
+
data.tar.gz: d08bfd2a2cc806e50416a98b9f9852a59d0a056a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50bcb76e32567f43fea27ce0e389d07fbed17876c046f38103aa6a37d4666c597cbb7d9e11734716b9a6a3c928141d45822f252abec3e0d674f57fbac383d6c5
|
7
|
+
data.tar.gz: 8bd76b57acd3dd580325d3c64ee38b2275b64584a6561960b82e83b8173dd558bbcd540e3dd6b841eecb1b8f4b041ecebc96b25346e963931d93c6aab798fbb5
|
@@ -11,12 +11,14 @@
|
|
11
11
|
text: {
|
12
12
|
all: this.$element.data('text-all') || Choicepicker.DEFAULTS.text.all,
|
13
13
|
choiceless: this.$element.data('text-choiceless') || Choicepicker.DEFAULTS.text.choiceless,
|
14
|
-
none: this.$element.data('text-none') || Choicepicker.DEFAULTS.text.none
|
14
|
+
none: this.$element.data('text-none') || Choicepicker.DEFAULTS.text.none,
|
15
|
+
selectAll: this.$element.data('text-select-all') || Choicepicker.DEFAULTS.text.selectAll
|
15
16
|
},
|
16
17
|
type: this.$element.data('type')
|
17
18
|
};
|
18
19
|
this.options = $.extend({}, Choicepicker.DEFAULTS, this.settings, options);
|
19
20
|
|
21
|
+
this.$checkAll = false;
|
20
22
|
this.$selector = 'bsChoicepicker-label-' + this.randomNumber() + '-';
|
21
23
|
this.$widget = $(this.initWidget()).on('click', $.proxy(this.clickWidget, this));
|
22
24
|
|
@@ -35,7 +37,8 @@
|
|
35
37
|
text: {
|
36
38
|
all: 'All',
|
37
39
|
choiceless: 'No choices available',
|
38
|
-
none: 'None'
|
40
|
+
none: 'None',
|
41
|
+
selectAll: 'Select all'
|
39
42
|
},
|
40
43
|
type: 'checkbox'
|
41
44
|
};
|
@@ -48,6 +51,7 @@
|
|
48
51
|
this.elementReadOnly();
|
49
52
|
this.setWidget();
|
50
53
|
this.setVal();
|
54
|
+
this.clickCheckAll();
|
51
55
|
|
52
56
|
this.$element.on({
|
53
57
|
'focus.bs.choicepicker': $.proxy(this.showWidget, this),
|
@@ -68,13 +72,19 @@
|
|
68
72
|
var _self = this;
|
69
73
|
var menu = $(this.options.menu);
|
70
74
|
|
75
|
+
if (this.options.type === 'checkbox') {
|
76
|
+
menu.find('span')
|
77
|
+
.append(this.titleTemplate());
|
78
|
+
}
|
79
|
+
|
71
80
|
$.each(this.options.choices, function (index, hash) {
|
72
81
|
var item = $(_self.options.item);
|
73
82
|
|
74
83
|
item.append(_self.optionTemplate(hash))
|
75
84
|
.append(_self.labelTemplate(hash).text(hash.label));
|
76
85
|
|
77
|
-
menu.find('span')
|
86
|
+
menu.find('span')
|
87
|
+
.append(item);
|
78
88
|
});
|
79
89
|
|
80
90
|
return menu;
|
@@ -134,12 +144,59 @@
|
|
134
144
|
return selector;
|
135
145
|
};
|
136
146
|
|
147
|
+
Choicepicker.prototype.checkAllSelector = function () {
|
148
|
+
var selector = this.$selector + 'checkall';
|
149
|
+
|
150
|
+
return selector;
|
151
|
+
};
|
152
|
+
|
153
|
+
Choicepicker.prototype.clickCheckAll = function () {
|
154
|
+
var _self = this;
|
155
|
+
var checkAll = $('#' + this.checkAllSelector());
|
156
|
+
|
157
|
+
checkAll.on('change', function () {
|
158
|
+
$.each(_self.options.choices, function (index, hash) {
|
159
|
+
var selector = $('#' + _self.selector(hash));
|
160
|
+
|
161
|
+
if (selector) selector.prop('checked', checkAll.is(':checked'));
|
162
|
+
});
|
163
|
+
});
|
164
|
+
};
|
165
|
+
|
166
|
+
Choicepicker.prototype.setCheckAll = function (checked) {
|
167
|
+
var checkbox = $('#' + this.checkAllSelector());
|
168
|
+
|
169
|
+
this.$checkAll = checked;
|
170
|
+
checkbox.prop('checked', checked);
|
171
|
+
};
|
172
|
+
|
137
173
|
Choicepicker.prototype.labelTemplate = function (hash) {
|
138
174
|
var selector = this.selector(hash);
|
139
175
|
|
140
176
|
return $('<label for="' + selector + '">');
|
141
177
|
};
|
142
178
|
|
179
|
+
Choicepicker.prototype.titleTemplate = function () {
|
180
|
+
var selector = this.checkAllSelector();
|
181
|
+
var boxLabel = $('<label for="' + selector + '">');
|
182
|
+
var textLabel = boxLabel.clone();
|
183
|
+
|
184
|
+
boxLabel.append('<i class="icon-checkmark"></i>');
|
185
|
+
|
186
|
+
var checkbox = $('<input type="checkbox" id="' + selector + '">');
|
187
|
+
checkbox.prop('checked', this.$checkAll);
|
188
|
+
|
189
|
+
var container = $('<div class="form-checkbox ' + this.options.choiceClass + '">');
|
190
|
+
container.append(checkbox);
|
191
|
+
container.append(boxLabel);
|
192
|
+
|
193
|
+
var item = $(this.options.item);
|
194
|
+
item.append(container)
|
195
|
+
.append(textLabel.text(this.options.text.selectAll));
|
196
|
+
|
197
|
+
return item;
|
198
|
+
};
|
199
|
+
|
143
200
|
Choicepicker.prototype.optionTemplate = function (hash) {
|
144
201
|
var type = this.type();
|
145
202
|
var selector = this.selector(hash);
|
@@ -214,9 +271,17 @@
|
|
214
271
|
}
|
215
272
|
});
|
216
273
|
|
217
|
-
if (count === total)
|
218
|
-
|
274
|
+
if (count === total) {
|
275
|
+
this.setCheckAll(true);
|
276
|
+
return this.options.text.all;
|
277
|
+
}
|
278
|
+
|
279
|
+
if (count === 0) {
|
280
|
+
this.setCheckAll(false);
|
281
|
+
return this.options.text.none;
|
282
|
+
}
|
219
283
|
|
284
|
+
this.setCheckAll(false);
|
220
285
|
return this.selectionLabel(label, count);
|
221
286
|
};
|
222
287
|
|
@@ -19,9 +19,9 @@
|
|
19
19
|
|
20
20
|
Header.VERSION = '1.0.0';
|
21
21
|
Header.DEFAULTS = {
|
22
|
-
addClass: '
|
22
|
+
addClass: '',
|
23
23
|
offset: 10,
|
24
|
-
removeClass: 'background-color-transparent'
|
24
|
+
removeClass: 'background-color-transparent border-color-bottom-transparent'
|
25
25
|
};
|
26
26
|
|
27
27
|
Header.prototype.constructor = Header;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_frontend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 14.0.
|
4
|
+
version: 14.0.63
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|