seed_tray 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/seed_tray.js.coffee.erb +19 -19
- data/lib/seed_tray/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac3be306c998f05111f32601b7aca15fa6730e72
|
4
|
+
data.tar.gz: ffce0ca76a0027e36b3232b3a157b490a41aecee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff28957dafc6dbb40853f0b3d33deeaea9107e3595a8054708c193245e8d29178b91042361a5d8b97bd0c809797a4b6081c770dd1ee70a48ab190ebd0a0e6743
|
7
|
+
data.tar.gz: e27892161895450b6ee9ec29087846cbaea6250a0c0a82a1b07cf3e0cbd54908227f45ad7958c7104a3968e425ed8502395a51dcc999d4e90b053d0dbbb09173
|
@@ -4,39 +4,39 @@ class SeedTray
|
|
4
4
|
constructor: () ->
|
5
5
|
if window.Turbolinks != undefined
|
6
6
|
if Turbolinks.EVENTS != undefined
|
7
|
-
$(window).on "page:change", => @
|
7
|
+
$(window).on "page:change", => @render()
|
8
8
|
else
|
9
|
-
$(window).on "turbolinks:load", => @
|
9
|
+
$(window).on "turbolinks:load", => @render()
|
10
10
|
else
|
11
|
-
$(@
|
11
|
+
$(@render)
|
12
12
|
@root = <%= app_name %>
|
13
13
|
|
14
|
-
# Dynamically delegate
|
15
|
-
|
16
|
-
# Run the page specific
|
17
|
-
@
|
14
|
+
# Dynamically delegate render to controller#action specific render methods
|
15
|
+
render: =>
|
16
|
+
# Run the page specific render code
|
17
|
+
@delegate_render()
|
18
18
|
|
19
19
|
# Run the code that should run on every page.
|
20
|
-
@
|
20
|
+
@site_wide_render()
|
21
21
|
|
22
|
-
|
22
|
+
delegate_render: =>
|
23
23
|
controller = $("[data-controller]").data("controller")
|
24
24
|
action = $("[data-action]").data("action")
|
25
25
|
|
26
|
-
if @root[controller] && @
|
27
|
-
@root[controller].
|
26
|
+
if @root[controller] && @render_defined(@root[controller])
|
27
|
+
@root[controller].render()
|
28
28
|
else
|
29
|
-
console.info "Skipped #{@root.name}.#{controller}.
|
29
|
+
console.info "Skipped #{@root.name}.#{controller}.render()."
|
30
30
|
|
31
|
-
if @root[controller] && @root[controller][action] && @
|
32
|
-
@root[controller][action].
|
33
|
-
console.info "Executed #{@root.name}.#{controller}.#{action}.
|
31
|
+
if @root[controller] && @root[controller][action] && @render_defined(@root[controller][action])
|
32
|
+
@root[controller][action].render()
|
33
|
+
console.info "Executed #{@root.name}.#{controller}.#{action}.render()."
|
34
34
|
else
|
35
|
-
console.info "Skipped #{@root.name}.#{controller}.#{action}.
|
35
|
+
console.info "Skipped #{@root.name}.#{controller}.#{action}.render()."
|
36
36
|
|
37
|
-
|
38
|
-
object.
|
37
|
+
render_defined: (object) ->
|
38
|
+
object.render != undefined
|
39
39
|
|
40
|
-
|
40
|
+
site_wide_render: ->
|
41
41
|
|
42
42
|
<%= app_name %>.delegator = new SeedTray()
|
data/lib/seed_tray/version.rb
CHANGED