rails-js 0.0.5 → 0.0.6

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
  SHA1:
3
- metadata.gz: 6d815a1b42316a9f6972adbb5495a664c87be365
4
- data.tar.gz: ed2b356a934351689faa8cb7affac1ea9e2e27e8
3
+ metadata.gz: 40d367a9365cc097fe49241548e82f2954324cad
4
+ data.tar.gz: f474d9c3bdcb32b81eafb2dabf0e4cb50585d06f
5
5
  SHA512:
6
- metadata.gz: 7a25fad2cc667c25e3ebda03cc2ece77e331655f414aace1a9dce1c6888d2d6af84d12aacc1a2de2b9c987035c59524778bfa0ac9b7fdc7b64a83b79a20e0013
7
- data.tar.gz: 36e83a3b682ef05b3f0e0b06e51bfa36c570a543a4cda0cd8647b6791e74d909742158b6a0b1ed75c6d79d996dacf17e6ff6473b7d2cac21588c7785079ee707
6
+ metadata.gz: c4b26bd324915f9b66f8a3e235425b6bdbf8b397476d3da37acc76c52c5826f2d76b0b4551be0451c130fa3a025b1258fefd50ff02ad8c38895b762ca8d8e81f
7
+ data.tar.gz: 64eb74d182dcb1a9ecf6c2a2ba8ee8795a04ed16085de6ed3eb92d80b7205ed6b68ff3b30f6aeca1d6d103cca8b201c4a26518c6ef3b28dce1af94d1d19bab83
@@ -1,33 +1,33 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails-js (0.0.4)
4
+ rails-js (0.0.6)
5
5
  rails (~> 4)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionmailer (4.1.6)
11
- actionpack (= 4.1.6)
12
- actionview (= 4.1.6)
10
+ actionmailer (4.1.7)
11
+ actionpack (= 4.1.7)
12
+ actionview (= 4.1.7)
13
13
  mail (~> 2.5, >= 2.5.4)
14
- actionpack (4.1.6)
15
- actionview (= 4.1.6)
16
- activesupport (= 4.1.6)
14
+ actionpack (4.1.7)
15
+ actionview (= 4.1.7)
16
+ activesupport (= 4.1.7)
17
17
  rack (~> 1.5.2)
18
18
  rack-test (~> 0.6.2)
19
- actionview (4.1.6)
20
- activesupport (= 4.1.6)
19
+ actionview (4.1.7)
20
+ activesupport (= 4.1.7)
21
21
  builder (~> 3.1)
22
22
  erubis (~> 2.7.0)
23
- activemodel (4.1.6)
24
- activesupport (= 4.1.6)
23
+ activemodel (4.1.7)
24
+ activesupport (= 4.1.7)
25
25
  builder (~> 3.1)
26
- activerecord (4.1.6)
27
- activemodel (= 4.1.6)
28
- activesupport (= 4.1.6)
26
+ activerecord (4.1.7)
27
+ activemodel (= 4.1.7)
28
+ activesupport (= 4.1.7)
29
29
  arel (~> 5.0.0)
30
- activesupport (4.1.6)
30
+ activesupport (4.1.7)
31
31
  i18n (~> 0.6, >= 0.6.9)
32
32
  json (~> 1.7, >= 1.7.7)
33
33
  minitest (~> 5.1)
@@ -35,7 +35,7 @@ GEM
35
35
  tzinfo (~> 1.1)
36
36
  arel (5.0.1.20140414130214)
37
37
  builder (3.2.2)
38
- capybara (2.4.3)
38
+ capybara (2.4.4)
39
39
  mime-types (>= 1.16)
40
40
  nokogiri (>= 1.3.3)
41
41
  rack (>= 1.0.0)
@@ -53,13 +53,13 @@ GEM
53
53
  hike (1.2.3)
54
54
  i18n (0.6.11)
55
55
  json (1.8.1)
56
- mail (2.6.1)
56
+ mail (2.6.3)
57
57
  mime-types (>= 1.16, < 3)
58
- mime-types (2.4.1)
58
+ mime-types (2.4.3)
59
59
  mini_portile (0.6.0)
60
60
  minitest (5.4.2)
61
61
  multi_json (1.10.1)
62
- netrc (0.7.7)
62
+ netrc (0.8.0)
63
63
  nokogiri (1.6.3.1)
64
64
  mini_portile (= 0.6.0)
65
65
  poltergeist (1.5.1)
@@ -70,19 +70,19 @@ GEM
70
70
  rack (1.5.2)
71
71
  rack-test (0.6.2)
72
72
  rack (>= 1.0)
73
- rails (4.1.6)
74
- actionmailer (= 4.1.6)
75
- actionpack (= 4.1.6)
76
- actionview (= 4.1.6)
77
- activemodel (= 4.1.6)
78
- activerecord (= 4.1.6)
79
- activesupport (= 4.1.6)
73
+ rails (4.1.7)
74
+ actionmailer (= 4.1.7)
75
+ actionpack (= 4.1.7)
76
+ actionview (= 4.1.7)
77
+ activemodel (= 4.1.7)
78
+ activerecord (= 4.1.7)
79
+ activesupport (= 4.1.7)
80
80
  bundler (>= 1.3.0, < 2.0)
81
- railties (= 4.1.6)
81
+ railties (= 4.1.7)
82
82
  sprockets-rails (~> 2.0)
83
- railties (4.1.6)
84
- actionpack (= 4.1.6)
85
- activesupport (= 4.1.6)
83
+ railties (4.1.7)
84
+ actionpack (= 4.1.7)
85
+ activesupport (= 4.1.7)
86
86
  rake (>= 0.8.7)
87
87
  thor (>= 0.18.1, < 2.0)
88
88
  rake (10.3.2)
@@ -94,7 +94,7 @@ GEM
94
94
  multi_json (~> 1.0)
95
95
  simplecov-html (~> 0.8.0)
96
96
  simplecov-html (0.8.0)
97
- sprockets (2.12.2)
97
+ sprockets (2.12.3)
98
98
  hike (~> 1.2)
99
99
  multi_json (~> 1.0)
100
100
  rack (~> 1.0)
@@ -103,7 +103,7 @@ GEM
103
103
  actionpack (>= 3.0)
104
104
  activesupport (>= 3.0)
105
105
  sprockets (>= 2.8, < 4.0)
106
- sqlite3 (1.3.9)
106
+ sqlite3 (1.3.10)
107
107
  teaspoon (0.8.0)
108
108
  railties (>= 3.2.5, < 5)
109
109
  term-ansicolor (1.3.0)
data/README.md CHANGED
@@ -5,6 +5,10 @@ rails-js
5
5
  [![Gem Version](http://img.shields.io/gem/v/rails-js.svg)](https://rubygems.org/gems/rails-js)
6
6
  [![License](http://img.shields.io/:license-mit-blue.svg)](http://tonekk.mit-license.org)
7
7
 
8
+
9
+ [Check out the blog post!](http://finn.heemeyer.net/2014/10/18/rails-js/)
10
+
11
+
8
12
  I worked on several Rails projects and there were many cases when it felt overkill to use a framework like ``Angular`` or ``Ember``, because javascript was only needed in some parts of the application.
9
13
  But by not using these frameworks I had to think of a way to *structure* the code by myself.
10
14
  I came up with the conclusion to organize the javascript code like the ruby code is organized, that means: __Split up in controllers, which are split up in actions.__
@@ -18,7 +22,7 @@ I came up with the conclusion to organize the javascript code like the ruby code
18
22
  #### You start by creating an app.
19
23
 
20
24
  ```js
21
- //= rails
25
+ //= require rails
22
26
 
23
27
  /*
24
28
  * app/assets/javascripts/application.js
@@ -29,7 +33,7 @@ Rails.app({
29
33
  helper: function() {
30
34
  }
31
35
  },
32
- // Put in initial data
36
+ // Put in initial data
33
37
  {
34
38
  foo: 'bar'
35
39
  },
@@ -61,7 +65,7 @@ Rails.controller('users', {
61
65
  },
62
66
  {
63
67
  // helpers here
64
- function awesomeHelper() {
68
+ awesomeHelper: function() {
65
69
  }
66
70
  });
67
71
 
@@ -135,7 +139,7 @@ In your layouts, put this line into the ``head``:
135
139
  ```erb
136
140
  <%= rails_js %>
137
141
  ```
138
- Also make sure to include ``rails`` in your ``application.js``.
142
+ Also make sure to include ``rails`` in your ``application.js``. If you are using [Turbolinks](https://github.com/rails/turbolinks), make sure to include ``rails`` after ``turbolinks``.
139
143
 
140
144
  Testing
141
145
  =======
@@ -47,14 +47,23 @@
47
47
  * DOM-related js (e.g. javascript unit-tests).
48
48
  * Set Rails.config.test to disable action execution.
49
49
  */
50
- document.addEventListener("DOMContentLoaded", function(event) {
50
+ listener = function(event) {
51
51
 
52
52
  if(Rails.config && Rails.config.test) {
53
53
  return;
54
54
  }
55
55
 
56
56
  Rails.execute();
57
- });
57
+ };
58
+
59
+ document.addEventListener("DOMContentLoaded", listener);
60
+
61
+ /*
62
+ * Add support to Turbolinks page changes
63
+ */
64
+ if(typeof Turbolinks !== 'undefined') {
65
+ document.addEventListener("page:load", listener);
66
+ }
58
67
  };
59
68
 
60
69
  /*
@@ -1,5 +1,5 @@
1
1
  module Rails
2
2
  module JS
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Finn-Lenanrt Heemeyer