seed_tray 0.4.1 → 0.5.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 +51 -42
- data/lib/seed_tray/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f56a4c420147b921183ffff1d8359025cd89733
|
4
|
+
data.tar.gz: 6a7e5e62abc610bc05d58fa6cde0ce87b79cff13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 452da832854954839a13bbe43be5c5993e83e652792873639d50ade8ea325beb6153de1e4612cc056caa2ba60ec61081ddad7e01c8f61cd468028de6119063d9
|
7
|
+
data.tar.gz: de12900668c367ed2087e081e6de0659e17e0a169237c91fe5d85b062da0807ad16f603b7abe82bbd5f87765dcc170b593ea4d5480f34091109884455a600eb9
|
@@ -1,47 +1,56 @@
|
|
1
1
|
<% app_name = Rails.application.class.to_s.split('::').first %>
|
2
2
|
|
3
3
|
class SeedTray
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
4
|
+
constructor: () ->
|
5
|
+
if window.Turbolinks != undefined
|
6
|
+
if Turbolinks.EVENTS != undefined
|
7
|
+
$(window).on "page:change", => @render()
|
8
|
+
else
|
9
|
+
$(window).on "turbolinks:load", => @render()
|
10
|
+
else
|
11
|
+
$(@render)
|
12
|
+
@root = <%= app_name %>
|
13
|
+
|
14
|
+
# Dynamically delegate render to controller#action specific render methods
|
15
|
+
render: =>
|
16
|
+
# Run the code that should run on every page.
|
17
|
+
@delegate_sitewide_render()
|
18
|
+
|
19
|
+
# Run the page specific render code
|
20
|
+
@delegate_render()
|
21
|
+
|
22
|
+
delegate_render: =>
|
23
|
+
suppress_console = <%= SeedTray.configuration.suppress_console %>
|
24
|
+
controller = $("[data-controller]").data("controller")
|
25
|
+
action = $("[data-action]").data("action")
|
26
|
+
|
27
|
+
controllerLc = controller.toLowerCase();
|
28
|
+
actionLc = action.toLowerCase();
|
29
|
+
|
30
|
+
if @root[controller] && @render_defined(@root[controller])
|
31
|
+
@root[controller].render()
|
32
|
+
$(document).trigger("seedtray:#{controllerLc}:render")
|
33
|
+
else
|
34
|
+
unless suppress_console
|
35
|
+
console.info "Skipped #{@root.name}.#{controller}.render()."
|
36
|
+
|
37
|
+
if @root[controller] && @root[controller][action] && @render_defined(@root[controller][action])
|
38
|
+
@root[controller][action].render()
|
39
|
+
$(document).trigger("seedtray:#{controllerLc}:#{actionLc}:render")
|
40
|
+
unless suppress_console
|
41
|
+
console.info "Executed #{@root.name}.#{controller}.#{action}.render()."
|
42
|
+
|
43
|
+
else
|
44
|
+
unless suppress_console
|
45
|
+
console.info "Skipped #{@root.name}.#{controller}.#{action}.render()."
|
46
|
+
|
47
|
+
delegate_sitewide_render: =>
|
48
|
+
@site_wide_render()
|
49
|
+
$(document).trigger('seedtray:render')
|
50
|
+
|
51
|
+
render_defined: (object) ->
|
52
|
+
object.render != undefined
|
53
|
+
|
54
|
+
site_wide_render: ->
|
46
55
|
|
47
56
|
<%= app_name %>.delegator = new SeedTray()
|
data/lib/seed_tray/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seed_tray
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey Guenther
|
8
|
+
- Kieran Eglin
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
12
|
+
date: 2016-04-22 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rails
|
@@ -125,6 +126,7 @@ dependencies:
|
|
125
126
|
description: A small, convention-based library for implementing view specific javascript.
|
126
127
|
email:
|
127
128
|
- guenther.jeffrey@gmail.com
|
129
|
+
- kieran.eglin@gmail.com
|
128
130
|
executables: []
|
129
131
|
extensions: []
|
130
132
|
extra_rdoc_files: []
|