tao_on_rails 0.9.1 → 0.9.2

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: c247207c24de176eb4272620d8659a3bcb99a2b5
4
- data.tar.gz: 30f82785a91cc806ba4e5c7f166ed12a3431f76f
3
+ metadata.gz: b5cd10cf94e1abe75c759862792a084a403dd9fe
4
+ data.tar.gz: 2987b6c9ec002b7fad6a568c0a47029a079e78be
5
5
  SHA512:
6
- metadata.gz: 8b2ed7aef76372c0aa0e23a64349579827aa79d508ca0852dcfa96f9756cf128e21b8b4c76e83a3df91592c1cdf6718e2fad066fdb68441ba4e961c090da1e35
7
- data.tar.gz: '069a4fd4ad5a22c4de03544b44b94b976dad281e1502baf690dabb4b02ef731745f82b4c8075a20ab1888b6d4efdd25f942b7aa27261820700f24aaa484355ef'
6
+ metadata.gz: b7e6023f2c0336c9adadfb79349ffe1ff6b2275a163a08a5c7820d9792cb64ad1577aa7b5fbaa44c29fe6a1a4b01c2cf91dc6cc19ab89b8958d4c835839d9101
7
+ data.tar.gz: cdc4059cf58af554318ccd4a0b101ff731c9b1bc96402fa1abded551f90b8721d1bc61ef7dec665e72e1520fb215a7f5fc32b54eb8abd3395cd558a4ad89de87
@@ -39,7 +39,7 @@ class TaoApplication extends TaoModule
39
39
 
40
40
  _initTurbolinks: ->
41
41
  $(document).on 'turbolinks:before-visit', (e) =>
42
- if @currentPage?.trigger('before-leave') == false
42
+ if @currentPage?.trigger?('before-leave') == false
43
43
  e.preventDefault()
44
44
  return
45
45
 
@@ -53,6 +53,9 @@ class TaoApplication extends TaoModule
53
53
 
54
54
  .on 'turbolinks:before-cache', (e) =>
55
55
  @trigger 'before-page-cache', [@currentPage]
56
+ $(@currentPage).find('[tao-id]').each (i, el) ->
57
+ el.beforeCache?()
58
+ null
56
59
  @currentPage?.beforeCache?()
57
60
  window.currentPage = @currentPage = null
58
61
 
@@ -153,11 +153,13 @@ TaoComponentBasedOn = (superClassName = 'HTMLElement') ->
153
153
  component
154
154
 
155
155
  on: (name, args...) ->
156
- name = "#{name}.#{@constructor._tag}-#{@taoId}" if name && name.indexOf('.') < 0
156
+ if name && name.indexOf('.') < 0
157
+ name = "#{name}.#{@constructor._tag}-#{@taoId}"
157
158
  @jq.on name, args...
158
159
 
159
160
  off: (name = '', args...) ->
160
- name = "#{name}.#{@constructor._tag}-#{@taoId}" if name.indexOf('.') < 0
161
+ if name.indexOf('.') < 0
162
+ name = "#{name}.#{@constructor._tag}-#{@taoId}"
161
163
  @jq.off name, args...
162
164
 
163
165
  trigger: (args...) ->
@@ -5,8 +5,5 @@ class TaoPage extends TaoComponent
5
5
  @attribute 'layout', default: 'default'
6
6
 
7
7
  beforeCache: ->
8
- @jq.find('[tao-id]').each (i, el) =>
9
- el.beforeCache?()
10
- null
11
8
 
12
9
  Tao.Page = window.TaoPage = TaoPage
@@ -11,12 +11,8 @@ module TaoOnRails
11
11
  # Define the dynamic view helpers for components
12
12
  # This method should be called in action_view context
13
13
  def self.define_component_helpers
14
- Dir.glob([
15
- Rails.root.join('lib/components/**/*.rb'),
16
- Rails.root.join('app/components/**/*.rb')
17
- ]).each do |component|
18
- require component
19
- end
14
+ load_tao_components
15
+ ::ActiveSupport.run_load_hooks(:tao_components, self)
20
16
 
21
17
  TaoOnRails::Components::Base.descendants.each do |klass|
22
18
  module_eval %Q{
@@ -27,6 +23,15 @@ module TaoOnRails
27
23
  end
28
24
  end
29
25
 
26
+ def self.load_tao_components(root = Rails.root)
27
+ Dir.glob([
28
+ root.join('lib/components/**/*.rb'),
29
+ root.join('app/components/**/*.rb')
30
+ ]).each do |component|
31
+ require_dependency component
32
+ end
33
+ end
34
+
30
35
  end
31
36
  end
32
37
  end
@@ -116,7 +116,7 @@ module TaoOnRails
116
116
  end
117
117
 
118
118
  def template_keys
119
- [:component, :block_given]
119
+ @template_keys ||= [:component, :block_given]
120
120
  end
121
121
 
122
122
  end
@@ -1,6 +1 @@
1
1
  require 'tao_on_rails/components/page_component'
2
-
3
- module TaoOnRails
4
- module Components
5
- end
6
- end
@@ -1,3 +1,3 @@
1
1
  module TaoOnRails
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tao_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siyuan Liu
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-06-15 00:00:00.000000000 Z
12
+ date: 2017-07-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: turbolinks
@@ -107,14 +107,14 @@ dependencies:
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 0.7.0
110
+ version: 0.7.1
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.7.0
117
+ version: 0.7.1
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: mocha
120
120
  requirement: !ruby/object:Gem::Requirement