roda-component 0.1.54 → 0.1.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/roda/component/events.rb +14 -5
- data/lib/roda/component/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f0bd5b2f67beac13bc2f3aca5cf6b9730529bb2
|
|
4
|
+
data.tar.gz: 128bc04f62aedf156b4227bdcb7034ee771dbaa4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7b8812b8a409755d5a457946b56ca33d83d1b969d9d2383f72554d008432ce210c4fa83cd34fd7739edc226a761b4ac220a32b9664f947ac36b47a3a32327084
|
|
7
|
+
data.tar.gz: fec0b4c8cb970af6be49fde8df2b7f6a0703b198307d0b745900dcfb73d59bf68648602e9c2e61308e9039a9bea56a8f448ef26c889a52368cd9cda5edaf52c9
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
class Roda
|
|
2
2
|
class Component
|
|
3
3
|
class Events < Struct.new(:klass, :component_opts, :scope, :request)
|
|
4
|
-
def on name, options =
|
|
5
|
-
options = '' if options.empty? && (name.to_s == 'history_change' || name.to_s == 'ready')
|
|
4
|
+
def on name, options = false, form_klass = false, extra_opts = false, &block
|
|
6
5
|
|
|
7
|
-
if client? && options.is_a?(String)
|
|
6
|
+
if client? && (options.is_a?(String) || !options)
|
|
8
7
|
class_name = klass._name
|
|
9
8
|
class_events = (events[class_name] ||= {})
|
|
10
9
|
event = (class_events[:_jquery_events] ||= [])
|
|
11
10
|
event << [block, class_name, options, form_klass, extra_opts, name]
|
|
12
|
-
elsif options.is_a?(Hash)
|
|
11
|
+
elsif options.is_a?(Hash) || !options
|
|
12
|
+
options = {} unless options
|
|
13
|
+
|
|
13
14
|
limit_if = options.delete(:if) || []
|
|
14
15
|
limit_if = [limit_if] unless limit_if.is_a? Array
|
|
15
16
|
|
|
@@ -93,10 +94,18 @@ class Roda
|
|
|
93
94
|
Component::Instance.new(component(comp), scope).instance_exec form, evt.current_target, evt, &block
|
|
94
95
|
end
|
|
95
96
|
else
|
|
96
|
-
|
|
97
|
+
args = [name]
|
|
98
|
+
args << selector if selector
|
|
99
|
+
|
|
100
|
+
Document.on(*args) do |evt|
|
|
97
101
|
el = evt.current_target
|
|
98
102
|
Component::Instance.new(component(comp), scope).instance_exec el, evt, &block
|
|
99
103
|
end
|
|
104
|
+
|
|
105
|
+
if name =~ /ready/
|
|
106
|
+
el = Element.find(selector != '' ? selector : 'body')
|
|
107
|
+
Component::Instance.new(component(comp), scope).instance_exec el, &block
|
|
108
|
+
end
|
|
100
109
|
end
|
|
101
110
|
end
|
|
102
111
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: roda-component
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.55
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- cj
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-03-
|
|
11
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: opal
|