seed_tray 0.5.0 → 0.6.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: 5f56a4c420147b921183ffff1d8359025cd89733
4
- data.tar.gz: 6a7e5e62abc610bc05d58fa6cde0ce87b79cff13
3
+ metadata.gz: 7b94ffe73463efe37c5ac63138fba77f118ac354
4
+ data.tar.gz: 112019e93aa47bbeed7590a5efa2c1a5909d0a41
5
5
  SHA512:
6
- metadata.gz: 452da832854954839a13bbe43be5c5993e83e652792873639d50ade8ea325beb6153de1e4612cc056caa2ba60ec61081ddad7e01c8f61cd468028de6119063d9
7
- data.tar.gz: de12900668c367ed2087e081e6de0659e17e0a169237c91fe5d85b062da0807ad16f603b7abe82bbd5f87765dcc170b593ea4d5480f34091109884455a600eb9
6
+ metadata.gz: 52f3131936dbb0a52b35a0ddafe83d1a595447ec70e5acdd93def3b3ce9d53458b7d19d5fa4eb51206932d3b3504addf699057aaf822260436de098b5e2afced
7
+ data.tar.gz: d214712e4759bdabcfff71bf3290ab1fdf5abace79b55abe679a6e133874dd6f23508edfa57fa186495da207dc197409b87b69b4406121cd95df4b992d13fb43
@@ -2,13 +2,15 @@
2
2
 
3
3
  class SeedTray
4
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()
5
+ loadEvent = undefined
6
+ if window.Turbolinks
7
+ loadEvent = if Turbolinks.EVENTS then 'page:change' else 'turbolinks:load';
10
8
  else
11
- $(@render)
9
+ loadEvent = 'DOMContentLoaded'
10
+
11
+ document.addEventListener loadEvent, =>
12
+ @render()
13
+
12
14
  @root = <%= app_name %>
13
15
 
14
16
  # Dynamically delegate render to controller#action specific render methods
@@ -21,22 +23,22 @@ class SeedTray
21
23
 
22
24
  delegate_render: =>
23
25
  suppress_console = <%= SeedTray.configuration.suppress_console %>
24
- controller = $("[data-controller]").data("controller")
25
- action = $("[data-action]").data("action")
26
+ controller = document.body.getAttribute("data-controller")
27
+ action = document.body.getAttribute("data-action")
26
28
 
27
29
  controllerLc = controller.toLowerCase();
28
30
  actionLc = action.toLowerCase();
29
31
 
30
32
  if @root[controller] && @render_defined(@root[controller])
31
33
  @root[controller].render()
32
- $(document).trigger("seedtray:#{controllerLc}:render")
34
+ @trigger_event "seedtray:#{controllerLc}:render"
33
35
  else
34
36
  unless suppress_console
35
37
  console.info "Skipped #{@root.name}.#{controller}.render()."
36
38
 
37
39
  if @root[controller] && @root[controller][action] && @render_defined(@root[controller][action])
38
40
  @root[controller][action].render()
39
- $(document).trigger("seedtray:#{controllerLc}:#{actionLc}:render")
41
+ @trigger_event "seedtray:#{controllerLc}:#{actionLc}:render"
40
42
  unless suppress_console
41
43
  console.info "Executed #{@root.name}.#{controller}.#{action}.render()."
42
44
 
@@ -46,11 +48,14 @@ class SeedTray
46
48
 
47
49
  delegate_sitewide_render: =>
48
50
  @site_wide_render()
49
- $(document).trigger('seedtray:render')
51
+ @trigger_event 'seedtray:render'
50
52
 
51
53
  render_defined: (object) ->
52
54
  object.render != undefined
53
55
 
56
+ trigger_event: (evt) ->
57
+ document.dispatchEvent new Event(evt);
58
+
54
59
  site_wide_render: ->
55
60
 
56
61
  <%= app_name %>.delegator = new SeedTray()
@@ -1,3 +1,3 @@
1
1
  module SeedTray
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seed_tray
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeffrey Guenther
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-22 00:00:00.000000000 Z
12
+ date: 2017-06-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -25,20 +25,6 @@ dependencies:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '4.0'
28
- - !ruby/object:Gem::Dependency
29
- name: jquery-rails
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: sass-rails
44
30
  requirement: !ruby/object:Gem::Requirement
@@ -67,20 +53,6 @@ dependencies:
67
53
  - - "~>"
68
54
  - !ruby/object:Gem::Version
69
55
  version: 4.1.0
70
- - !ruby/object:Gem::Dependency
71
- name: jquery-rails
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
56
  - !ruby/object:Gem::Dependency
85
57
  name: turbolinks
86
58
  requirement: !ruby/object:Gem::Requirement
@@ -263,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
263
235
  version: '0'
264
236
  requirements: []
265
237
  rubyforge_project:
266
- rubygems_version: 2.5.1
238
+ rubygems_version: 2.5.2
267
239
  signing_key:
268
240
  specification_version: 4
269
241
  summary: Custom coffeescript for your views