wedge 0.1.60 → 0.1.61
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wedge/dom.rb +46 -0
- data/lib/wedge/plugins/form.rb +4 -4
- data/lib/wedge/plugins/form/validations.rb +3 -3
- 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: c4869274b6cd54fb81a4d24d1fa38478c854d956
|
4
|
+
data.tar.gz: b427ed6802dc94e440bcc7c204aec1db959a24a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b792e83d2861ac16002959d670caea41886b6c340a05c1e0473328cc4e479025ab5ba8d097fcce358fcf40e505bd85ba64c5b49465f571f30d7d2e4201fc559
|
7
|
+
data.tar.gz: 84451e24da193e80d52ed4e0d178af46cafe7e3ff7fbc469206c88f5c120aa6a7ac85a04ec4970e82ceee9b5b5e4b594d6afaf45369ca88948a29f4f1b3ecf08
|
data/lib/wedge/dom.rb
CHANGED
@@ -47,6 +47,52 @@ class Wedge
|
|
47
47
|
end
|
48
48
|
|
49
49
|
unless RUBY_ENGINE == 'opal'
|
50
|
+
def prepend d
|
51
|
+
if n = node.children.first
|
52
|
+
n.add_previous_sibling d
|
53
|
+
else
|
54
|
+
node << d
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def append d
|
59
|
+
if n = node.children.first
|
60
|
+
def display el, options = {}, &block
|
61
|
+
d = d.dom if d.is_a? Wedge::DOM
|
62
|
+
|
63
|
+
return if el.data 'wedge-popover'
|
64
|
+
|
65
|
+
el.data 'wedge-popover', true
|
66
|
+
el = el.to_n
|
67
|
+
|
68
|
+
options = {
|
69
|
+
content: 'Loading...',
|
70
|
+
position: 'right middle',
|
71
|
+
openOn: 'hover'
|
72
|
+
}.merge(options)
|
73
|
+
|
74
|
+
options[:classes] = "drop-theme-arrows #{options[:classes]}"
|
75
|
+
|
76
|
+
options = options.to_n
|
77
|
+
|
78
|
+
opts = `$.extend(options, { target: el[0] })`
|
79
|
+
drop = Native(`new Drop(opts)`)
|
80
|
+
|
81
|
+
block.call(Native(opts)) if block_given?
|
82
|
+
|
83
|
+
drop
|
84
|
+
end
|
85
|
+
|
86
|
+
def ajax el, options = {}, &block
|
87
|
+
options = { content: 'loading' }.merge options
|
88
|
+
display el, options, &block
|
89
|
+
end
|
90
|
+
n.add_next_sibling d
|
91
|
+
else
|
92
|
+
node << d
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
50
96
|
def data key = false, value = false
|
51
97
|
d = Hash[node.xpath("@*[starts-with(name(), 'data-')]").map{|a| [a.name, a.value]}]
|
52
98
|
|
data/lib/wedge/plugins/form.rb
CHANGED
@@ -263,15 +263,15 @@ class Wedge
|
|
263
263
|
# post = Post.new(edit.attributes)
|
264
264
|
# post.save
|
265
265
|
def initialize(atts = {}, options = {})
|
266
|
+
_set_atts atts, options
|
267
|
+
end
|
268
|
+
|
269
|
+
def _set_atts atts, options = {}
|
266
270
|
atts = atts.deep_dup
|
267
271
|
@_options = options.indifferent
|
268
272
|
@_atts = Atts.new atts, _accessors, _aliases, _accessor_options
|
269
273
|
@_atts = @_atts.set_defaults self
|
270
274
|
|
271
|
-
_set_atts atts
|
272
|
-
end
|
273
|
-
|
274
|
-
def _set_atts atts
|
275
275
|
atts.each do |key, val|
|
276
276
|
# grab the original key if alias is given
|
277
277
|
_atts_keys << (key = _aliases.invert[key] || key)
|
@@ -75,8 +75,8 @@ class Wedge
|
|
75
75
|
_errors.empty?
|
76
76
|
end
|
77
77
|
|
78
|
-
def valid atts
|
79
|
-
_set_atts atts
|
78
|
+
def valid atts, options = {}
|
79
|
+
_set_atts atts, options
|
80
80
|
valid?
|
81
81
|
end
|
82
82
|
|
@@ -153,7 +153,7 @@ class Wedge
|
|
153
153
|
att_options = _accessor_options[att].deep_dup
|
154
154
|
form_name = att_options.delete :form
|
155
155
|
|
156
|
-
f = wedge("#{form_name}_form", _atts.send(att)
|
156
|
+
f = wedge("#{form_name}_form", _atts._atts.send(att), att_options)
|
157
157
|
assert(f.valid?, [att, f._errors])
|
158
158
|
end
|
159
159
|
|
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.1.
|
4
|
+
version: 0.1.61
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal-wedge
|