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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbe817d57146676d5669c84a0d18cb746caa8f93
4
- data.tar.gz: 0b438f917a2521ec2a81279ebae4a1d956d69396
3
+ metadata.gz: 5f56a4c420147b921183ffff1d8359025cd89733
4
+ data.tar.gz: 6a7e5e62abc610bc05d58fa6cde0ce87b79cff13
5
5
  SHA512:
6
- metadata.gz: 97ef7a8c03bc082cb61c41788bb963526349c627ba0235d49d61e8a512cd89b37b270dbf1ebf6314248fa2430bfe27c92dca6a23c9ccda2d8ed50b79f373faf2
7
- data.tar.gz: cf21df6cd3cb586ddeab8441351d8e51b378a998650d7615d844174e4dd89d30f9be7f24f38627e880ed27d9f78fab4dd1a552b7570e7c851c1445aebc4eaf62
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
- 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 page specific render code
17
- @delegate_render()
18
-
19
- # Run the code that should run on every page.
20
- @site_wide_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
- if @root[controller] && @render_defined(@root[controller])
28
- @root[controller].render()
29
- else
30
- unless suppress_console
31
- console.info "Skipped #{@root.name}.#{controller}.render()."
32
-
33
- if @root[controller] && @root[controller][action] && @render_defined(@root[controller][action])
34
- @root[controller][action].render()
35
- unless suppress_console
36
- console.info "Executed #{@root.name}.#{controller}.#{action}.render()."
37
-
38
- else
39
- unless suppress_console
40
- console.info "Skipped #{@root.name}.#{controller}.#{action}.render()."
41
-
42
- render_defined: (object) ->
43
- object.render != undefined
44
-
45
- site_wide_render: ->
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()
@@ -1,3 +1,3 @@
1
1
  module SeedTray
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
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.1
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-18 00:00:00.000000000 Z
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: []