wedge 0.1.60 → 0.1.61

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac9c83a40a505d47fcfec4880169c62d043e9ace
4
- data.tar.gz: 0211a33e497adbf26a328bc09e99db88b91b5f4f
3
+ metadata.gz: c4869274b6cd54fb81a4d24d1fa38478c854d956
4
+ data.tar.gz: b427ed6802dc94e440bcc7c204aec1db959a24a7
5
5
  SHA512:
6
- metadata.gz: 636d58f314f0da762a0a986b769217db7b9dac3337e887a7dbdb9a09f8ff7b384e880534ea136ae78a2369f523250ea1ad2dd8c7fbd8398a8bf00837b4c7e5c2
7
- data.tar.gz: bc7ba2b5fe45dc0a00299a61c8626b22c879d5e906d936d689b33e6a7b02cd9c41a011d335a45e1ab15d26b9faee44a2b9662e43d2f878a80270be7fd02305ef
6
+ metadata.gz: 3b792e83d2861ac16002959d670caea41886b6c340a05c1e0473328cc4e479025ab5ba8d097fcce358fcf40e505bd85ba64c5b49465f571f30d7d2e4201fc559
7
+ data.tar.gz: 84451e24da193e80d52ed4e0d178af46cafe7e3ff7fbc469206c88f5c120aa6a7ac85a04ec4970e82ceee9b5b5e4b594d6afaf45369ca88948a29f4f1b3ecf08
@@ -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
 
@@ -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).attributes, att_options)
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
 
@@ -1,3 +1,3 @@
1
1
  class Wedge
2
- VERSION = '0.1.60'
2
+ VERSION = '0.1.61'
3
3
  end
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.60
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-08-27 00:00:00.000000000 Z
11
+ date: 2015-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal-wedge