rails_script 0.1.3 → 0.1.4
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 +4 -4
- data/include_rails_script.js +37 -0
- data/lib/rails_script/loader_helper.rb +1 -11
- data/lib/rails_script/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5810a9506cef8d97deab52d83d8ffed35153aaa5
|
|
4
|
+
data.tar.gz: a5c4f0b4b66a766821236cc6e7b7037cb0d7af74
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c3c272f1d89997fade518d9f59000bab07be38ab9ab38c6cf6c1c39804b32893d372a7c53b14b4dd04e042fe76e9d05e4958de8e2a616cce978d6011a2c33355
|
|
7
|
+
data.tar.gz: 6838fba7c9d12ffe1ce8cf969da3435619233636c68476e6ddcf552645d3496fc42ce74ae98acbf832ae0e251cca7c2312c6a465a686b792b7f3d5e704e5efd7
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
jQuery(function() {
|
|
2
|
+
window.$this = new (App.#{ controller_path.split(/\/|_/).map(&:capitalize).join('') } || App.Base)();
|
|
3
|
+
if (typeof $this.#{ action_name } === 'function') {
|
|
4
|
+
return $this.#{ action_name }.call();
|
|
5
|
+
}
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
jQuery(document).on('page:before-change', function() {
|
|
9
|
+
var element, handler, handlers, type, _i, _len, _ref, _results;
|
|
10
|
+
_ref = [window, document];
|
|
11
|
+
_results = [];
|
|
12
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
13
|
+
element = _ref[_i];
|
|
14
|
+
_results.push((function() {
|
|
15
|
+
var _ref2, _results2;
|
|
16
|
+
_ref2 = jQuery._data(element, 'events');
|
|
17
|
+
_results2 = [];
|
|
18
|
+
for (type in _ref2) {
|
|
19
|
+
handlers = _ref2[type];
|
|
20
|
+
_results2.push((function() {
|
|
21
|
+
var _j, _len2, _results3;
|
|
22
|
+
_results3 = [];
|
|
23
|
+
for (_j = 0, _len2 = handlers.length; _j < _len2; _j++) {
|
|
24
|
+
handler = handlers[_j];
|
|
25
|
+
if (handler == null) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
_results3.push(handler.namespace === '' ? $(element).off(type, handler.handler) : void 0);
|
|
29
|
+
}
|
|
30
|
+
return _results3;
|
|
31
|
+
})());
|
|
32
|
+
}
|
|
33
|
+
return _results2;
|
|
34
|
+
})());
|
|
35
|
+
}
|
|
36
|
+
return _results;
|
|
37
|
+
});
|
|
@@ -3,17 +3,7 @@ module RailsScript
|
|
|
3
3
|
|
|
4
4
|
def include_rails_script
|
|
5
5
|
javascript_tag <<-RUBY
|
|
6
|
-
jQuery(function() {
|
|
7
|
-
window.$this = new (App.#{ controller_path.split(/\/|_/).map(&:capitalize).join('') } || App.Base)();
|
|
8
|
-
if (typeof $this.#{ action_name } === 'function') {
|
|
9
|
-
return $this.#{ action_name }.call();
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
jQuery(document).on('page:before-change', function() {
|
|
14
|
-
jQuery(document).off();
|
|
15
|
-
jQuery(window).off();
|
|
16
|
-
});
|
|
6
|
+
jQuery(function(){window.$this=new(App.#{controller_path.split(/\/|_/).map(&:capitalize).join('')}||App.Base);if(typeof $this.#{action_name}==="function"){return $this.#{action_name}.call()}});jQuery(document).on("page:before-change",function(){var e,t,n,r,i,s,o,u;o=[window,document];u=[];for(i=0,s=o.length;i<s;i++){e=o[i];u.push(function(){var i,s;i=jQuery._data(e,"events");s=[];for(r in i){n=i[r];s.push(function(){var i,s,o;o=[];for(i=0,s=n.length;i<s;i++){t=n[i];if(t==null){continue}o.push(t.namespace===""?$(e).off(r,t.handler):void 0)}return o}())}return s}())}return u})
|
|
17
7
|
RUBY
|
|
18
8
|
end
|
|
19
9
|
|
data/lib/rails_script/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_script
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kevin Pheasey
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-10-
|
|
11
|
+
date: 2014-10-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -73,6 +73,7 @@ files:
|
|
|
73
73
|
- LICENSE.txt
|
|
74
74
|
- README.md
|
|
75
75
|
- Rakefile
|
|
76
|
+
- include_rails_script.js
|
|
76
77
|
- lib/generators/rails_script/class/USAGE
|
|
77
78
|
- lib/generators/rails_script/class/class_generator.rb
|
|
78
79
|
- lib/generators/rails_script/class/templates/javascript.js.coffee
|