coffee_controllers-rails 0.1.0 → 1.0.0
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/README.md +1 -1
- data/app/assets/javascripts/coffee_controllers/all.js +2 -0
- data/app/assets/javascripts/coffee_controllers/{main.js.coffee → core.js.coffee} +1 -14
- data/app/assets/javascripts/coffee_controllers/loader.js.coffee +12 -0
- data/lib/coffee_controllers/rails/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20cff1742f76502e27deb389e261ac0d57c2bb42
|
4
|
+
data.tar.gz: c423f32d9217ac2eff47bee6d4198314fa7cb835
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: faab6c7797857d865c99ced441019cf079bbb610902c5946b3d06ed5cee74847af2edea547fb39263251275225bdba48cba327b65daab2393a93c278fd0077ce
|
7
|
+
data.tar.gz: 1ca87eef6c348e3a26890b18f057f015f2cbef7e83382062667334f1fabb7b37c0281641cf4538c6a22b98012cce994e1c9df239648b20af1cbdccc08fc9483e
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ It depends of [coffee-rails](https://github.com/rails/coffee-rails) that is also
|
|
28
28
|
In your `application.js` file, add:
|
29
29
|
|
30
30
|
```javascript
|
31
|
-
//= require coffee_controllers/
|
31
|
+
//= require coffee_controllers/all
|
32
32
|
```
|
33
33
|
|
34
34
|
In your views layout file, say `application.html.erb`, add this to the `body` tag:
|
@@ -2,21 +2,8 @@
|
|
2
2
|
@Controllers ?= {}
|
3
3
|
@ActiveController = null
|
4
4
|
|
5
|
-
# Attach a function to be executed when the DOM is loaded
|
6
|
-
ready = (fn) ->
|
7
|
-
unless document.readyState is "loading"
|
8
|
-
fn()
|
9
|
-
else
|
10
|
-
document.addEventListener "DOMContentLoaded", fn
|
11
|
-
return
|
12
|
-
|
13
|
-
ready ->
|
14
|
-
# Run the specific scripts that have to be run after the DOM is loaded
|
15
|
-
runSpecificActionScript()
|
16
|
-
return
|
17
|
-
|
18
5
|
# Call the script function related to the current action of the current controller
|
19
|
-
@
|
6
|
+
@runCoffeeController = ->
|
20
7
|
body = document.querySelectorAll('body')[0]
|
21
8
|
currentController = body.getAttribute 'data-controller'
|
22
9
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Attach a function to be executed when the DOM is loaded
|
2
|
+
ready = (fn) ->
|
3
|
+
unless document.readyState is "loading"
|
4
|
+
fn()
|
5
|
+
else
|
6
|
+
document.addEventListener "DOMContentLoaded", fn
|
7
|
+
return
|
8
|
+
|
9
|
+
ready ->
|
10
|
+
# Run the specific scripts that have to be run after the DOM is loaded
|
11
|
+
runCoffeeController()
|
12
|
+
return
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coffee_controllers-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Ferraz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-rails
|
@@ -77,7 +77,9 @@ files:
|
|
77
77
|
- MIT-LICENSE
|
78
78
|
- README.md
|
79
79
|
- Rakefile
|
80
|
-
- app/assets/javascripts/coffee_controllers/
|
80
|
+
- app/assets/javascripts/coffee_controllers/all.js
|
81
|
+
- app/assets/javascripts/coffee_controllers/core.js.coffee
|
82
|
+
- app/assets/javascripts/coffee_controllers/loader.js.coffee
|
81
83
|
- lib/coffee_controllers-rails.rb
|
82
84
|
- lib/coffee_controllers/rails.rb
|
83
85
|
- lib/coffee_controllers/rails/engine.rb
|