dom-rb 0.1.4 → 0.1.5
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/csr/dom/builder/helpers.rb +10 -7
- data/csr/dom/table/base.rb +1 -0
- data/csr/dom/util.rb +19 -0
- data/lib/dom/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: 506d56aaaa6c084470621a2b06ede1564a619014
|
4
|
+
data.tar.gz: 41005f31a9cda1c1106ce501307f3bbab5a47735
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63ec0c8fe718cc6e45a8acea70f090b334cd442f2d8e58ae17eec03dbe7ee4fc256c05ed2e016fb5d7c8c0fd5090ef8fcadb84297d318439d76cd6a9bc622348
|
7
|
+
data.tar.gz: 9eea6f3341e0a9421748e0a2b7c995930b5595be4071b77db2572e41cdb2eeff52d9ae2da86fd63aa7f465bf4ce5be4aaaeff6c103935dc5ac817acd220016ef
|
data/csr/dom/builder/helpers.rb
CHANGED
@@ -51,7 +51,7 @@ module CSR
|
|
51
51
|
def icon_with_anchor(icon_name, href, icon_attributes: nil, anchor_attributes: nil, tooltip: nil, popover: nil)
|
52
52
|
attributes = { href: href }
|
53
53
|
if anchor_attributes
|
54
|
-
attributes = anchor_attributes
|
54
|
+
attributes = merge_attributes(anchor_attributes, attributes)
|
55
55
|
end
|
56
56
|
tag(
|
57
57
|
:a,
|
@@ -68,7 +68,7 @@ module CSR
|
|
68
68
|
}
|
69
69
|
if icon_attributes
|
70
70
|
# argument takes precedence
|
71
|
-
_icon_attributes = _icon_attributes
|
71
|
+
_icon_attributes = merge_attributes(_icon_attributes, icon_attributes)
|
72
72
|
end
|
73
73
|
icon_with_anchor(
|
74
74
|
:plus_sign,
|
@@ -132,7 +132,7 @@ module CSR
|
|
132
132
|
class: "dropdown-menu#{menu_right ? ' dropdown-menu-right' : nil}"
|
133
133
|
}
|
134
134
|
if menu_attributes
|
135
|
-
_menu_attributes = _menu_attributes
|
135
|
+
_menu_attributes = merge_attributes(_menu_attributes, menu_attributes)
|
136
136
|
end
|
137
137
|
tag(
|
138
138
|
:div,
|
@@ -191,7 +191,9 @@ module CSR
|
|
191
191
|
}
|
192
192
|
if icon_attributes
|
193
193
|
# argument attributes take precedence
|
194
|
-
|
194
|
+
debug 0, ->{[__FILE__, __LINE__, __method__, "_icon_attributes=#{_icon_attributes} icon_attributes=#{icon_attributes}"]}
|
195
|
+
_icon_attributes = merge_attributes(_icon_attributes, icon_attributes)
|
196
|
+
debug 0, ->{[__FILE__, __LINE__, __method__, "_icon_attributes=#{_icon_attributes}"]}
|
195
197
|
end
|
196
198
|
drop_down_icon(
|
197
199
|
icon: 'plus-sign',
|
@@ -242,9 +244,10 @@ module CSR
|
|
242
244
|
end
|
243
245
|
tag(
|
244
246
|
:div,
|
245
|
-
attributes:
|
246
|
-
style: { cursor: 'pointer' }
|
247
|
-
|
247
|
+
attributes: merge_attributes(
|
248
|
+
{ style: { cursor: 'pointer' } },
|
249
|
+
attributes
|
250
|
+
),
|
248
251
|
content: arrify(content, icon)
|
249
252
|
)
|
250
253
|
end
|
data/csr/dom/table/base.rb
CHANGED
data/csr/dom/util.rb
CHANGED
@@ -49,6 +49,25 @@ module CSR
|
|
49
49
|
result
|
50
50
|
end
|
51
51
|
|
52
|
+
# args are hashes, lowest to highest precedence
|
53
|
+
# TODO: only handles two levels deep (style, onclick, ...)
|
54
|
+
def merge_attributes(*args)
|
55
|
+
result = args[0] || {}
|
56
|
+
args.each do |arg|
|
57
|
+
if arg
|
58
|
+
arg.each_pair do |k,v|
|
59
|
+
prev = result[k]
|
60
|
+
if Hash == v && Hash === prev
|
61
|
+
result[k] = v.merge(prev)
|
62
|
+
else
|
63
|
+
result[k] = v
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
result
|
69
|
+
end
|
70
|
+
|
52
71
|
# make a single array from args
|
53
72
|
# args may be mix of non-enumerables and enumerables
|
54
73
|
# nils will not be included
|
data/lib/dom/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dom-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin Gunn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal-browser
|