tao_on_rails 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/tao/component.coffee +27 -12
- data/lib/tao_on_rails/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1aec7845926da7ba72c3a2adc0375801cc91465b
|
4
|
+
data.tar.gz: dc8dffdd444cf419667b54731aab0c59bfbe3144
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6e2dc63d51c677dee8eacc042b725b45f91a286ee350115c6e8cd9dab83c293b113341f682b4715c7e7a4a36b78b1dbd7d38a507c031e0c8bc74c05e850e3c2
|
7
|
+
data.tar.gz: f1b51e8276c9b98dd1df1ac5f95f1f98419bfac31e888da57515b00b7b453451364b54ddadea364d202b9aa1f6927f03a94310ee6ceb6f37d1429e827baaef19
|
@@ -102,16 +102,16 @@ TaoComponentBasedOn = (superClassName = 'HTMLElement') ->
|
|
102
102
|
@taoId = ++count
|
103
103
|
@_init()
|
104
104
|
@initialized = true
|
105
|
-
@
|
105
|
+
@namespacedTrigger 'initialized'
|
106
106
|
|
107
107
|
@_connected()
|
108
|
-
@
|
108
|
+
@namespacedTrigger 'connected'
|
109
109
|
|
110
110
|
disconnectedCallback: ->
|
111
111
|
$ =>
|
112
112
|
@connected = false
|
113
113
|
@_disconnected()
|
114
|
-
@
|
114
|
+
@namespacedTrigger 'disconnected'
|
115
115
|
|
116
116
|
attributeChangedCallback: (name) ->
|
117
117
|
return unless @connected
|
@@ -142,15 +142,26 @@ TaoComponentBasedOn = (superClassName = 'HTMLElement') ->
|
|
142
142
|
beforeCache: ->
|
143
143
|
# called before turbolinks cache pages
|
144
144
|
|
145
|
-
findComponent: (
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
145
|
+
findComponent: (selectors...) ->
|
146
|
+
readyCallback = selectors.pop() if _.isFunction(_.last(selectors))
|
147
|
+
components = selectors.map (s) =>
|
148
|
+
deferred = $.Deferred()
|
149
|
+
element = @jq.find(s).get(0)
|
150
|
+
if element.connected
|
151
|
+
# make sure element is returned before callback
|
152
|
+
setTimeout -> deferred.resolve()
|
153
|
+
else
|
154
|
+
@on 'tao:connected', s, (e) ->
|
155
|
+
return unless e.target == e.currentTarget
|
156
|
+
deferred.resolve()
|
157
|
+
@off 'tao:connected', s
|
158
|
+
[element, deferred.promise()]
|
159
|
+
|
160
|
+
elements = components.map (c) -> c[0]
|
161
|
+
promises = components.map (c) -> c[1]
|
162
|
+
$.when(promises...).then -> readyCallback?(elements...)
|
163
|
+
|
164
|
+
if elements.length > 1 then elements else elements[0]
|
154
165
|
|
155
166
|
on: (name, args...) ->
|
156
167
|
if name && name.indexOf('.') < 0
|
@@ -168,6 +179,10 @@ TaoComponentBasedOn = (superClassName = 'HTMLElement') ->
|
|
168
179
|
triggerHandler: (args...) ->
|
169
180
|
@jq.triggerHandler(args...)
|
170
181
|
|
182
|
+
namespacedTrigger: (name, params) ->
|
183
|
+
@trigger "tao:#{name}", params
|
184
|
+
@trigger "#{@constructor._tag}:#{name}", params
|
185
|
+
|
171
186
|
one: (args...) ->
|
172
187
|
@jq.one args...
|
173
188
|
|
data/lib/tao_on_rails/version.rb
CHANGED
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.
|
4
|
+
version: 0.9.3
|
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-07-
|
12
|
+
date: 2017-07-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: turbolinks
|
@@ -115,6 +115,20 @@ dependencies:
|
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 0.7.1
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: selenium-webdriver
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 3.2.0
|
125
|
+
type: :development
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 3.2.0
|
118
132
|
- !ruby/object:Gem::Dependency
|
119
133
|
name: mocha
|
120
134
|
requirement: !ruby/object:Gem::Requirement
|