async_futurize 0.1.12 → 0.1.17

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
  SHA256:
3
- metadata.gz: d7f5e15a17cef1b822e92f47ff954c16dbaa3dee334dc71f814d6106a31e6427
4
- data.tar.gz: 0e41f1295ce58e1545f26b8dbfd996cc2a1a51b585d763a6ee3665ed8045aec7
3
+ metadata.gz: d3b633a3db500a3127b51f76fdf54095a50240c5e246d5e5e6b7ee8b836e4fe0
4
+ data.tar.gz: c05e15e6221091d388a810e4bbd4b7dc00f6067bd382435048f3b51d44b4417a
5
5
  SHA512:
6
- metadata.gz: '054998df99628b7c151251a67b0d20f3a67eede2a7ca0e2445a5a16e735c829adc9fe34eefe5315e6f0bd49ab290985b574941bebf414a3f3ddb9527356d16a3'
7
- data.tar.gz: 1fc6880c905aa36665003d03196814a604eaab54bdf6f7708b857ec30a8c2bd95dc9624a68ca31b30573440a5b62b4b206dc68cad416eec94dc78d26afe72bf9
6
+ metadata.gz: 4d17bb5939f50aed4de8dbdb01ab8a0048953e24ece7bce8796839052c0da86e5feed4d6bdc44c4548073d3c22381945dd0d3d92330b69a12d319e26f613402f
7
+ data.tar.gz: aa1d0b68a397631f48f90c4ada8cf18a303ea159d606f0a0369e4210eb5be2a72d339df94c92cc68adfaeeca605fce0a71cfb097976810fcfc0d7eca11e6b216
@@ -1,5 +1,5 @@
1
1
  module AsyncFuturize
2
- class FuturizeController < ApplicationController
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,3 +1,4 @@
1
+ console.log('Futurize loaded ..')
1
2
  global.FuturizeComponent = {
2
3
  init: function (css_selector) {
3
4
  var obj = document.querySelectorAll(css_selector);
@@ -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,5 @@
1
1
  module AsyncFuturize
2
2
  class Engine < Rails::Engine
3
+ config.assets.precompile += %w(futurize.js)
3
4
  end
4
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AsyncFuturize
4
- VERSION = "0.1.12"
4
+ VERSION = "0.1.17"
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.12
4
+ version: 0.1.17
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,7 +66,6 @@ files:
24
66
  - LICENSE.txt
25
67
  - README.md
26
68
  - Rakefile
27
- - app/controllers/applicaton_controller.rb
28
69
  - app/controllers/async_futurize/futurize_controller.rb
29
70
  - app/helpers/futurize_helper.rb
30
71
  - app/javascript/packs/futurize.js
@@ -1,2 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- end