beyond-rails 0.0.238 → 0.0.239
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/src/js/jquery/bindBtnFn.js +26 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5909cd5877a32b19eab6147bd2b240bd910832d9b7138073b0ecd439a0282be8
|
4
|
+
data.tar.gz: 857fa2f0909a69fec32b1bbe6a5a02348dc3bc00b191ef0bcf26c9038025594e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1222887fa75efd27100d2f3e45462c7b7655d50dbef27bd6e4408c249580614c8eaddad80b40e4bc760b40522c84153b7bc527063031ecc1e4ff2fb4994c849
|
7
|
+
data.tar.gz: f7704ffaf4a75dd6bb4372f4969772f621e2d91ac8ce45074545af24f6388c823133cbced360ccad789cc0c0fa624e354d9d3bf80bf0a0e6364f7e3884b7ace6
|
data/src/js/jquery/bindBtnFn.js
CHANGED
@@ -1,17 +1,32 @@
|
|
1
1
|
export default function bindBtnFn(beyond, $) {
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
$.fn.btn = function() {
|
6
|
-
|
7
|
-
const btns = this.map((i, dom) => new Btn(dom))
|
8
|
-
|
9
|
-
this.showLoader = btns.each((i, a) => a.showLoader())
|
10
|
-
|
11
|
-
this.hideLoader = btns.each((i, a) => a.hideLoader())
|
12
|
-
|
13
|
-
this.destroy = () => btns.each((i, a) => a.destroy())
|
3
|
+
$.fn.btn = function(type) {
|
14
4
|
|
5
|
+
if (type === 'loading') {
|
6
|
+
initBtns(this)
|
7
|
+
this.each((i, dom) => dom._btn.showLoader())
|
8
|
+
}
|
9
|
+
else if (type === 'reset') {
|
10
|
+
initBtns(this)
|
11
|
+
this.each((i, dom) => dom._btn.hideLoader())
|
12
|
+
}
|
13
|
+
else if (type === 'destroy') {
|
14
|
+
this.each((i, dom) => {
|
15
|
+
if (dom._btn) {
|
16
|
+
dom._btn.destroy()
|
17
|
+
delete dom._btn
|
18
|
+
}
|
19
|
+
})
|
20
|
+
}
|
15
21
|
return this
|
16
22
|
}
|
17
23
|
}
|
24
|
+
|
25
|
+
function initBtns(self, options) {
|
26
|
+
const { Btn } = beyond
|
27
|
+
self.each((i, dom) => {
|
28
|
+
if (! dom._btn) {
|
29
|
+
dom._btn = new Btn(dom)
|
30
|
+
}
|
31
|
+
})
|
32
|
+
}
|