async_futurize 0.1.13 → 0.1.18

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: 0ead6f3cbbd3c014a6be85440801baffc0b1679103cfadcdd5661b8ddd850774
4
+ data.tar.gz: c95e275b8ef981f4f5a7b77c1758e95139163e83bac94d65a304b2486a96c37e
5
5
  SHA512:
6
- metadata.gz: 61a490a1fa29b11b56637e76dd55849921aacbedc40ae2c9daa596b28146fb00c10ca3428b0f6bde35a1da821492265c4f34d31d8391d304844ca5a518631367
7
- data.tar.gz: d557e4a8551d9fd42948e13f0490f35364dbb3efb708d1fe9988ec173145baf032b1b9630988925837f6381332cdcbb794cf3581596b4a3742b3e5bad2537c76
6
+ metadata.gz: 7818e1f267d900df7defb2938d63d933f6506389fc19f8419df0f36afe6809249d2c42124913cc128b0102053441b2775e04c1be33dd2fe0bb5db41ed71d018c
7
+ data.tar.gz: 6c12f477dfbd10edf4e1c6b243c31ee712d5b12452d68b30d3c866c02bc87379a6209a97520e7b4fdeee35d70e36856e0c1d0952edc2bf7cab48bb34aeff8c8c
@@ -0,0 +1,51 @@
1
+ console.log('Futurize loaded ..')
2
+ global.FuturizeComponent = {
3
+ init: function (css_selector) {
4
+ var obj = document.querySelectorAll(css_selector);
5
+ for (var i in obj) {
6
+ if (obj.hasOwnProperty(i)) {
7
+ //console.log(obj[i].getAttribute('data-futurize-component'));
8
+ this.load_component(obj[i])
9
+ }
10
+ }
11
+ },
12
+
13
+ reload: function(css_selector) {
14
+ document.querySelectorAll(css_selector).forEach(function(o) {
15
+ o.innerHTML = ""
16
+ })
17
+ },
18
+
19
+ load_component: function (obj) {
20
+ var component_name = obj.getAttribute('data-futurize-component'),
21
+ component_params = obj.getAttribute('data-futurize-params');
22
+
23
+ if (obj.innerHTML.trim().length <= 0) {
24
+ obj.innerHTML = 'Loading....';
25
+ }
26
+
27
+ var AUTH_TOKEN = document.querySelector('meta[name=csrf-token]').getAttribute('content');
28
+ fetch('/home/loadComponent', {
29
+ mode: 'same-origin',
30
+ method: 'POST',
31
+ dataType: 'json',
32
+ body : JSON.stringify({ component_to_load: component_name, component_params: component_params }),
33
+ headers: {
34
+ 'Content-Type': 'application/json',
35
+ 'X-CSRF-Token' : AUTH_TOKEN,
36
+ },
37
+ })
38
+ .then(response => response.json())
39
+ .then(data => {
40
+ obj.innerHTML = data.html
41
+ obj.querySelectorAll("script").forEach(function(o) {
42
+ eval(o.innerHTML)
43
+ })
44
+ }).catch((error) => {
45
+ console.error('Error:', error);
46
+ });
47
+ }
48
+ }
49
+ document.addEventListener('DOMContentLoaded', function () {
50
+ FuturizeComponent.init('[data-futurize-component]');
51
+ })
@@ -0,0 +1,6 @@
1
+ import { Controller } from "stimulus"
2
+ export default class extends Controller {
3
+ initialize() {
4
+ console.log("It's working...")
5
+ }
6
+ }
@@ -0,0 +1,58 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
+ typeof define === 'function' && define.amd ? define(factory) :
4
+ global.futurize= factory();
5
+ } (this,function() {
6
+
7
+ console.log('Futurize loaded ..')
8
+ // global.FuturizeComponent = {
9
+ // init: function (css_selector) {
10
+ // var obj = document.querySelectorAll(css_selector);
11
+ // for (var i in obj) {
12
+ // if (obj.hasOwnProperty(i)) {
13
+ // //console.log(obj[i].getAttribute('data-futurize-component'));
14
+ // this.load_component(obj[i])
15
+ // }
16
+ // }
17
+ // },
18
+
19
+ // reload: function(css_selector) {
20
+ // document.querySelectorAll(css_selector).forEach(function(o) {
21
+ // o.innerHTML = ""
22
+ // })
23
+ // },
24
+
25
+ // load_component: function (obj) {
26
+ // var component_name = obj.getAttribute('data-futurize-component'),
27
+ // component_params = obj.getAttribute('data-futurize-params');
28
+
29
+ // if (obj.innerHTML.trim().length <= 0) {
30
+ // obj.innerHTML = 'Loading....';
31
+ // }
32
+
33
+ // var AUTH_TOKEN = document.querySelector('meta[name=csrf-token]').getAttribute('content');
34
+ // fetch('/home/loadComponent', {
35
+ // mode: 'same-origin',
36
+ // method: 'POST',
37
+ // dataType: 'json',
38
+ // body : JSON.stringify({ component_to_load: component_name, component_params: component_params }),
39
+ // headers: {
40
+ // 'Content-Type': 'application/json',
41
+ // 'X-CSRF-Token' : AUTH_TOKEN,
42
+ // },
43
+ // })
44
+ // .then(response => response.json())
45
+ // .then(data => {
46
+ // obj.innerHTML = data.html
47
+ // obj.querySelectorAll("script").forEach(function(o) {
48
+ // eval(o.innerHTML)
49
+ // })
50
+ // }).catch((error) => {
51
+ // console.error('Error:', error);
52
+ // });
53
+ // }
54
+ // }
55
+ // document.addEventListener('DOMContentLoaded', function () {
56
+ // FuturizeComponent.init('[data-futurize-component]');
57
+ // })
58
+ }))
@@ -28,6 +28,9 @@ Gem::Specification.new do |spec|
28
28
  spec.bindir = "exe"
29
29
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ["lib"]
31
+ spec.add_dependency "rails"
32
+ spec.add_dependency "sass"
33
+ spec.add_dependency "sass-rails"
31
34
 
32
35
  # Uncomment to register a new dependency of your gem
33
36
  # spec.add_dependency "example-gem", "~> 1.0"
@@ -1,4 +1,7 @@
1
+ require "async_futurize/version"
2
+
1
3
  module AsyncFuturize
2
4
  class Engine < Rails::Engine
5
+ config.assets.precompile += %w(futurize.js)
3
6
  end
4
7
  end
@@ -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.18"
5
5
  end
@@ -1,50 +1,51 @@
1
+ console.log('Futurize loaded ..')
1
2
  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
- }
3
+ init: function (css_selector) {
4
+ var obj = document.querySelectorAll(css_selector);
5
+ for (var i in obj) {
6
+ if (obj.hasOwnProperty(i)) {
7
+ //console.log(obj[i].getAttribute('data-futurize-component'));
8
+ this.load_component(obj[i])
9
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
10
  }
11
+ },
12
+
13
+ reload: function(css_selector) {
14
+ document.querySelectorAll(css_selector).forEach(function(o) {
15
+ o.innerHTML = ""
16
+ })
17
+ },
18
+
19
+ load_component: function (obj) {
20
+ var component_name = obj.getAttribute('data-futurize-component'),
21
+ component_params = obj.getAttribute('data-futurize-params');
22
+
23
+ if (obj.innerHTML.trim().length <= 0) {
24
+ obj.innerHTML = 'Loading....';
25
+ }
26
+
27
+ var AUTH_TOKEN = document.querySelector('meta[name=csrf-token]').getAttribute('content');
28
+ fetch('/home/loadComponent', {
29
+ mode: 'same-origin',
30
+ method: 'POST',
31
+ dataType: 'json',
32
+ body : JSON.stringify({ component_to_load: component_name, component_params: component_params }),
33
+ headers: {
34
+ 'Content-Type': 'application/json',
35
+ 'X-CSRF-Token' : AUTH_TOKEN,
36
+ },
37
+ })
38
+ .then(response => response.json())
39
+ .then(data => {
40
+ obj.innerHTML = data.html
41
+ obj.querySelectorAll("script").forEach(function(o) {
42
+ eval(o.innerHTML)
43
+ })
44
+ }).catch((error) => {
45
+ console.error('Error:', error);
46
+ });
47
47
  }
48
- document.addEventListener('DOMContentLoaded', function () {
49
- FuturizeComponent.init('[data-futurize-component]');
50
- })
48
+ }
49
+ document.addEventListener('DOMContentLoaded', function () {
50
+ FuturizeComponent.init('[data-futurize-component]');
51
+ })
metadata CHANGED
@@ -1,15 +1,57 @@
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.18
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
12
- dependencies: []
11
+ date: 2021-02-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sass
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sass-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
13
55
  description: Asynchronously load view components.
14
56
  email:
15
57
  - tuladhar.ashesh10@gmail.com
@@ -24,8 +66,11 @@ files:
24
66
  - LICENSE.txt
25
67
  - README.md
26
68
  - Rakefile
69
+ - app/assets/javascripts/futurize.js
27
70
  - app/controllers/async_futurize/futurize_controller.rb
28
71
  - app/helpers/futurize_helper.rb
72
+ - app/javascript/controllers/hello_controller.js
73
+ - app/javascript/packs/futurize.js
29
74
  - app/views/_futurize_component_ajax.html.erb
30
75
  - app/views/_futurize_partial_ajax.html.erb
31
76
  - async_futurize.gemspec