async_futurize 0.1.13 → 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 576f8c119fc7dad8942079ceee9fee9f499212e752bac16c7261ebc56ace7a0c
4
- data.tar.gz: 76cd8050599e2a4b90d75c5fc1ac7df9bd4830af6a758bba70a8f9894fcb65d1
3
+ metadata.gz: c63b2ef9df6d0dcc4efafe3bc8bccc3fd051860c8148a536236c4e71afcf98c5
4
+ data.tar.gz: c9993ee0111d0ecbee32135237f81bc97ae099ab34663917832d2f07d436f99d
5
5
  SHA512:
6
- metadata.gz: 61a490a1fa29b11b56637e76dd55849921aacbedc40ae2c9daa596b28146fb00c10ca3428b0f6bde35a1da821492265c4f34d31d8391d304844ca5a518631367
7
- data.tar.gz: d557e4a8551d9fd42948e13f0490f35364dbb3efb708d1fe9988ec173145baf032b1b9630988925837f6381332cdcbb794cf3581596b4a3742b3e5bad2537c76
6
+ metadata.gz: 968ff7005a711e286d545036ac6a321a87b16b026ed7291f1725f673af81ce6f210f4f8ca7edf371a1c5490d048b012439799c51549afddc7d7f8b84abbc8114
7
+ data.tar.gz: 8fef187c24d73c1b74da4e1ea1907cef8db424b0ab40a36ec69360019ad39822e24cd68b1201258cf49f4bff010b43b41e63a6df94d7def1836d2c3a6dcb37ca
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AsyncFuturize
4
- VERSION = "0.1.13"
4
+ VERSION = "0.1.14"
5
5
  end
@@ -1,50 +1,50 @@
1
1
  global.FuturizeComponent = {
2
- init: function (css_selector) {
3
- var obj = document.querySelectorAll(css_selector);
4
- for (var i in obj) {
5
- if (obj.hasOwnProperty(i)) {
6
- //console.log(obj[i].getAttribute('data-futurize-component'));
7
- this.load_component(obj[i])
8
- }
2
+ init: function (css_selector) {
3
+ var obj = document.querySelectorAll(css_selector);
4
+ for (var i in obj) {
5
+ if (obj.hasOwnProperty(i)) {
6
+ //console.log(obj[i].getAttribute('data-futurize-component'));
7
+ this.load_component(obj[i])
9
8
  }
10
- },
11
-
12
- reload: function(css_selector) {
13
- document.querySelectorAll(css_selector).forEach(function(o) {
14
- o.innerHTML = ""
15
- })
16
- },
17
-
18
- load_component: function (obj) {
19
- var component_name = obj.getAttribute('data-futurize-component'),
20
- component_params = obj.getAttribute('data-futurize-params');
21
-
22
- if (obj.innerHTML.trim().length <= 0) {
23
- obj.innerHTML = 'Loading....';
24
- }
25
-
26
- var AUTH_TOKEN = document.querySelector('meta[name=csrf-token]').getAttribute('content');
27
- fetch('/home/loadComponent', {
28
- mode: 'same-origin',
29
- method: 'POST',
30
- dataType: 'json',
31
- body : JSON.stringify({ component_to_load: component_name, component_params: component_params }),
32
- headers: {
33
- 'Content-Type': 'application/json',
34
- 'X-CSRF-Token' : AUTH_TOKEN,
35
- },
36
- })
37
- .then(response => response.json())
38
- .then(data => {
39
- obj.innerHTML = data.html
40
- obj.querySelectorAll("script").forEach(function(o) {
41
- eval(o.innerHTML)
42
- })
43
- }).catch((error) => {
44
- console.error('Error:', error);
45
- });
46
9
  }
10
+ },
11
+
12
+ reload: function(css_selector) {
13
+ document.querySelectorAll(css_selector).forEach(function(o) {
14
+ o.innerHTML = ""
15
+ })
16
+ },
17
+
18
+ load_component: function (obj) {
19
+ var component_name = obj.getAttribute('data-futurize-component'),
20
+ component_params = obj.getAttribute('data-futurize-params');
21
+
22
+ if (obj.innerHTML.trim().length <= 0) {
23
+ obj.innerHTML = 'Loading....';
24
+ }
25
+
26
+ var AUTH_TOKEN = document.querySelector('meta[name=csrf-token]').getAttribute('content');
27
+ fetch('/home/loadComponent', {
28
+ mode: 'same-origin',
29
+ method: 'POST',
30
+ dataType: 'json',
31
+ body : JSON.stringify({ component_to_load: component_name, component_params: component_params }),
32
+ headers: {
33
+ 'Content-Type': 'application/json',
34
+ 'X-CSRF-Token' : AUTH_TOKEN,
35
+ },
36
+ })
37
+ .then(response => response.json())
38
+ .then(data => {
39
+ obj.innerHTML = data.html
40
+ obj.querySelectorAll("script").forEach(function(o) {
41
+ eval(o.innerHTML)
42
+ })
43
+ }).catch((error) => {
44
+ console.error('Error:', error);
45
+ });
47
46
  }
48
- document.addEventListener('DOMContentLoaded', function () {
49
- FuturizeComponent.init('[data-futurize-component]');
50
- })
47
+ }
48
+ document.addEventListener('DOMContentLoaded', function () {
49
+ FuturizeComponent.init('[data-futurize-component]');
50
+ })
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async_futurize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ashesh Tuladhar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-09 00:00:00.000000000 Z
11
+ date: 2021-02-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Asynchronously load view components.
14
14
  email: