async_futurize 0.1.9 → 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: 9f1891d7183ce37d2b64efd34549e6022eb8cea45786a547064cec97c7925a16
4
- data.tar.gz: 26b33f3cbe9960d1b2c0cfb668d5549ad88dbd893ef04457d430640944c60c30
3
+ metadata.gz: c63b2ef9df6d0dcc4efafe3bc8bccc3fd051860c8148a536236c4e71afcf98c5
4
+ data.tar.gz: c9993ee0111d0ecbee32135237f81bc97ae099ab34663917832d2f07d436f99d
5
5
  SHA512:
6
- metadata.gz: 49f4ed9cfc115a9f3f0ddece36c6d6227cb120e351a0efec98bd45b927294c0d3405a7505575520d8cec4e7d59d8588a03263f4f5d522b321d0a4793a90527fb
7
- data.tar.gz: ceedc2ca87a2dc6077847710ce2ec78080aa7e9237ade86d15b9072b5b44e6d30488ec8ae393a4bcda746192c4bfea3f96c1852e1da5e01dbb5b043478ab53d7
6
+ metadata.gz: 968ff7005a711e286d545036ac6a321a87b16b026ed7291f1725f673af81ce6f210f4f8ca7edf371a1c5490d048b012439799c51549afddc7d7f8b84abbc8114
7
+ data.tar.gz: 8fef187c24d73c1b74da4e1ea1907cef8db424b0ab40a36ec69360019ad39822e24cd68b1201258cf49f4bff010b43b41e63a6df94d7def1836d2c3a6dcb37ca
@@ -1,5 +1,5 @@
1
- module async_futurize
2
- class FuturizeController < ApplicationController
1
+ module AsyncFuturize
2
+ class FuturizeController
3
3
  def loadComponent
4
4
  locals = { component: params[:component_to_load], component_params: params[:component_params] }
5
5
  render json: { component: params[:component_to_load], html: render_to_string(partial: './futurize_component_ajax', locals: locals) }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AsyncFuturize
4
- VERSION = "0.1.9"
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.9
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:
@@ -26,7 +26,6 @@ files:
26
26
  - Rakefile
27
27
  - app/controllers/async_futurize/futurize_controller.rb
28
28
  - app/helpers/futurize_helper.rb
29
- - app/javascript/packs/futurize.js
30
29
  - app/views/_futurize_component_ajax.html.erb
31
30
  - app/views/_futurize_partial_ajax.html.erb
32
31
  - async_futurize.gemspec
@@ -1,50 +0,0 @@
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
- }
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
- });
46
- }
47
- }
48
- document.addEventListener('DOMContentLoaded', function () {
49
- FuturizeComponent.init('[data-futurize-component]');
50
- })