roda-component 0.1.30 → 0.1.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/roda/component/dom.rb +28 -10
- data/lib/roda/component/events.rb +2 -3
- data/lib/roda/component/form.rb +4 -3
- data/lib/roda/component/version.rb +1 -1
- data/lib/roda/plugins/component.rb +5 -4
- data/roda-component.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5dc17d663e86a3bdad3b5e764c7f12c954d76d7
|
4
|
+
data.tar.gz: 61ae7a1789403fd3921446a95f4578dc0ddb5a23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80ff779b9b98eefee690bfde2d748db6f8f447c5a4bc9244c3c86e2e06f90bac8b7705f87456ea19f7de6cc0ea8517adc0a684a07372f87378bc83f4d740363b
|
7
|
+
data.tar.gz: 0e8b2f991133cb85091da56996c93ca7b8d3e8a09988fbddd0e8fd867bc27db443f0577604247f216e048a437eafa7bc3182ea786c808db0b05b5a61f7abaa84
|
data/lib/roda/component/dom.rb
CHANGED
@@ -2,7 +2,7 @@ require 'delegate'
|
|
2
2
|
|
3
3
|
class Roda
|
4
4
|
class Component
|
5
|
-
class DOM
|
5
|
+
class DOM
|
6
6
|
attr_accessor :dom, :raw_html
|
7
7
|
|
8
8
|
def initialize html
|
@@ -14,7 +14,7 @@ class Roda
|
|
14
14
|
@dom = raw_html.is_a?(String) ? Element[raw_html.dup] : raw_html
|
15
15
|
end
|
16
16
|
|
17
|
-
super @dom
|
17
|
+
# super @dom
|
18
18
|
end
|
19
19
|
|
20
20
|
def find string, &block
|
@@ -59,12 +59,30 @@ class Roda
|
|
59
59
|
if server?
|
60
60
|
node.inner_html = content
|
61
61
|
else
|
62
|
+
content = content.dom if content.is_a? Roda::Component::DOM
|
62
63
|
node.html content
|
63
64
|
end
|
64
65
|
|
65
66
|
node
|
66
67
|
end
|
67
68
|
|
69
|
+
if RUBY_ENGINE == 'opal'
|
70
|
+
def append obj
|
71
|
+
obj = obj.dom if obj.is_a? Roda::Component::DOM
|
72
|
+
super obj
|
73
|
+
end
|
74
|
+
|
75
|
+
def prepend obj
|
76
|
+
obj = obj.dom if obj.is_a? Roda::Component::DOM
|
77
|
+
super obj
|
78
|
+
end
|
79
|
+
|
80
|
+
def replace_with obj
|
81
|
+
obj = obj.dom if obj.is_a? Roda::Component::DOM
|
82
|
+
super obj
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
68
86
|
def html content = false
|
69
87
|
if !content
|
70
88
|
if server?
|
@@ -83,14 +101,14 @@ class Roda
|
|
83
101
|
|
84
102
|
# This allows you to use all the nokogiri or opal jquery methods if a
|
85
103
|
# global one isn't set
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
104
|
+
def method_missing method, *args, &block
|
105
|
+
# respond_to?(symbol, include_all=false)
|
106
|
+
if dom.respond_to? method, true
|
107
|
+
dom.send method, *args, &block
|
108
|
+
else
|
109
|
+
super
|
110
|
+
end
|
111
|
+
end
|
94
112
|
|
95
113
|
private
|
96
114
|
|
data/lib/roda/component/form.rb
CHANGED
@@ -178,7 +178,8 @@ class Roda
|
|
178
178
|
def slice(*keys)
|
179
179
|
Hash.new.tap do |atts|
|
180
180
|
keys.each do |att|
|
181
|
-
atts[att] =
|
181
|
+
atts[att] = send(att)
|
182
|
+
# atts[att] = _attributes.send(att)
|
182
183
|
end
|
183
184
|
end
|
184
185
|
end
|
@@ -276,11 +277,11 @@ class Roda
|
|
276
277
|
end
|
277
278
|
|
278
279
|
def self._attr_accessors
|
279
|
-
@_attr_accessors
|
280
|
+
@_attr_accessors ||= []
|
280
281
|
end
|
281
282
|
|
282
283
|
def self._form
|
283
|
-
@_form
|
284
|
+
@_form || {}
|
284
285
|
end
|
285
286
|
|
286
287
|
def _form
|
@@ -115,10 +115,10 @@ class Roda
|
|
115
115
|
def component name, options = {}, &block
|
116
116
|
comp = load_component name
|
117
117
|
|
118
|
-
action
|
119
|
-
trigger
|
120
|
-
js
|
121
|
-
args
|
118
|
+
action = options.delete(:call) || :display
|
119
|
+
trigger = options.delete(:trigger) || false
|
120
|
+
js = options.delete(:js)
|
121
|
+
args = options.delete(:args)
|
122
122
|
|
123
123
|
# call action
|
124
124
|
# TODO: make sure the single method parameter isn't a block
|
@@ -213,6 +213,7 @@ class Roda
|
|
213
213
|
s.prefix = "/#{scope.component_opts[:assets_route]}"
|
214
214
|
|
215
215
|
s.append_path Gem::Specification.find_by_name("roda-component").gem_dir + '/lib'
|
216
|
+
s.append_path Gem::Specification.find_by_name("ability_list").gem_dir + '/lib'
|
216
217
|
|
217
218
|
# Append the path to the components folder
|
218
219
|
s.append_path scope.component_opts[:path]
|
data/roda-component.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_runtime_dependency "redis-rack"
|
24
24
|
spec.add_runtime_dependency "rest-client"
|
25
25
|
spec.add_runtime_dependency "faye", '~> 1.1.0'
|
26
|
+
spec.add_runtime_dependency "ability_list", '~> 0.0.3'
|
26
27
|
spec.add_runtime_dependency "faye-redis"
|
27
28
|
spec.add_runtime_dependency "redic", "~> 1.1.1"
|
28
29
|
spec.add_development_dependency "bundler", "~> 1.7"
|
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.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.1.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: ability_list
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.0.3
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.0.3
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: faye-redis
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|