wedge 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wedge.rb +9 -3
- data/lib/wedge/events.rb +4 -1
- data/lib/wedge/plugins/form.rb +8 -6
- data/lib/wedge/plugins/validations.rb +1 -1
- data/lib/wedge/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: b2dbd8ba00a1f62c5d52845b31d490a2556c87ed
|
4
|
+
data.tar.gz: ee88de101b63dd804501fc94c69aec3301d3b29b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bab16e31b80b81dd7d394f183c3d7e5f4eb4f96e4274acc9c3df9035d978ac89cc831dc71d79d86c3bee22b0b42994b119287d8a74897457c792ed5987564202
|
7
|
+
data.tar.gz: d5920870feab5097fcbf6a57483da43fd2408836b5ea77cf95605c40bc9322ba922645f183f09ceed26b8d6ac2d19159cf7c9478542b8b996c76b17fdb57668f
|
data/lib/wedge.rb
CHANGED
@@ -22,7 +22,7 @@ module Wedge
|
|
22
22
|
|
23
23
|
class << self
|
24
24
|
attr_accessor :requires, :loaded_requires, :loaded_requires_events, :javascript_cache,
|
25
|
-
:wedge_javascript_loaded
|
25
|
+
:wedge_javascript_loaded, :object_events, :browser_events
|
26
26
|
|
27
27
|
def compile_opal
|
28
28
|
javascript
|
@@ -86,16 +86,22 @@ module Wedge
|
|
86
86
|
if path_name == 'wedge'
|
87
87
|
@wedge_javascript ||= begin
|
88
88
|
@wedge_javascript_loaded = true
|
89
|
-
requires
|
89
|
+
requires = {}
|
90
|
+
@object_events = {}
|
91
|
+
@browser_events = {}
|
90
92
|
|
91
93
|
@javascript_cache ||= {}
|
92
94
|
|
93
95
|
components.to_h.each do |k, v|
|
94
|
-
requires[k]
|
96
|
+
requires[k] = v.klass.wedge_config.get_requires
|
97
|
+
# events = Wedge[v.name].wedge_opts.events
|
98
|
+
# @object_events[v.name] = events.object_events
|
99
|
+
# @browser_events[v.name] = events.browser_events
|
95
100
|
javascript(v.klass.wedge_opts[:path_name])
|
96
101
|
end
|
97
102
|
|
98
103
|
compiled_requires = Base64.encode64 requires.to_json
|
104
|
+
# compiled_object_events = Base64.encode64 object_events.to_json
|
99
105
|
assets_key = opts.assets_key
|
100
106
|
cache_assets = opts.cache_assets
|
101
107
|
|
data/lib/wedge/events.rb
CHANGED
@@ -55,7 +55,10 @@ module Wedge
|
|
55
55
|
trigger_browser_event event
|
56
56
|
end
|
57
57
|
else
|
58
|
-
|
58
|
+
# fix: we need to change the way events are stored
|
59
|
+
wedge_events = (Wedge.components[scope.wedge_opts.name].klass.wedge_opts.object_events[name] || [])
|
60
|
+
events = wedge_events.concat(object_events[name] || [])
|
61
|
+
##################################################
|
59
62
|
events.each do |event|
|
60
63
|
Wedge[event[:component]].instance_exec options, &event[:block]
|
61
64
|
end
|
data/lib/wedge/plugins/form.rb
CHANGED
@@ -102,9 +102,11 @@ module Wedge
|
|
102
102
|
send("#{key}=", val)
|
103
103
|
end
|
104
104
|
|
105
|
-
_form.each do |key,
|
105
|
+
_form.each do |key, form_name|
|
106
106
|
opts = {}
|
107
|
-
|
107
|
+
if _data.respond_to?(key)
|
108
|
+
opts[key] = wedge(form_name, init: _data.send(key))
|
109
|
+
end
|
108
110
|
@_attributes.set_values opts
|
109
111
|
|
110
112
|
send("#{key}=", opts[key])
|
@@ -152,8 +154,8 @@ module Wedge
|
|
152
154
|
att = ivar[1..-1].to_sym
|
153
155
|
atts[att] = _attributes.send(att)
|
154
156
|
|
155
|
-
if
|
156
|
-
atts[att] =
|
157
|
+
if form_name = _form[att.to_s.to_sym]
|
158
|
+
atts[att] = wedge(form_name, init: atts[att]).attributes
|
157
159
|
end
|
158
160
|
end
|
159
161
|
end
|
@@ -163,11 +165,11 @@ module Wedge
|
|
163
165
|
hash = {}
|
164
166
|
|
165
167
|
data.each do |k, v|
|
166
|
-
if
|
168
|
+
if form_name = _form[k.to_s.to_sym]
|
167
169
|
d = data[k]
|
168
170
|
d = d.attributes if d.is_a?(Form)
|
169
171
|
|
170
|
-
f =
|
172
|
+
f = wedge(form_name, init: d)
|
171
173
|
k = "#{k}_attributes"
|
172
174
|
dt = f.model_attributes
|
173
175
|
|
@@ -134,7 +134,7 @@ module Wedge
|
|
134
134
|
options = {}
|
135
135
|
options[:key] = _options[:key] if _options.key? :key
|
136
136
|
|
137
|
-
f = wedge(form_name, _attributes.send(att).attributes,
|
137
|
+
f = wedge(form_name, init: [_attributes.send(att).attributes, options])
|
138
138
|
assert(f.valid?, [att, f.errors])
|
139
139
|
else
|
140
140
|
assert(!_attributes.send(att).to_s.empty?, error)
|
data/lib/wedge/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wedge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|