apotomo 1.2.4 → 1.2.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/CHANGES.textile +4 -0
- data/apotomo.gemspec +1 -0
- data/lib/apotomo/rails/view_helper.rb +22 -14
- data/lib/apotomo/version.rb +1 -1
- data/test/rails/view_helper_test.rb +9 -5
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 017a9d6267b6b8cf91a80513607f24cd2f0edcd0
|
4
|
+
data.tar.gz: 2cfe2319182b4536f6c20d5dddf7cbb02224a5e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c39ad60a4f9fc2a4d93b3a928b3ff46ce583443aa25b3a3ade4663221bd639717c3b26d35b4f3b27dfd1456503ca039e70740bb0a2d97b998103eea2789944b4
|
7
|
+
data.tar.gz: e0b7f965287f2d42ba136dfec5816c90b7514904dbb111bd4dc6654a8cd57a50e9a6214a357b077fbf2075ae415853b3635c37f5dc243c64aa109ceec70aff6d
|
data/CHANGES.textile
CHANGED
data/apotomo.gemspec
CHANGED
@@ -13,6 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.homepage = "http://github.com/apotonick/apotomo"
|
14
14
|
s.summary = %q{Web components for Rails.}
|
15
15
|
s.description = %q{Web component framework for Rails providing widgets that trigger events and know when and how to update themselves with AJAX.}
|
16
|
+
s.license = 'MIT'
|
16
17
|
|
17
18
|
s.files = `git ls-files`.split("\n")
|
18
19
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -16,12 +16,12 @@ module Apotomo
|
|
16
16
|
# = render_widget kid
|
17
17
|
module ViewHelper
|
18
18
|
delegate :children, :url_for_event, :widget_id, :to => :controller
|
19
|
-
|
19
|
+
|
20
20
|
# Returns the app JavaScript generator.
|
21
21
|
def js_generator
|
22
22
|
Apotomo.js_generator
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
# Creates a form that submits itself via an iFrame and executes the response
|
26
26
|
# in the parent window. This is needed to upload files via AJAX.
|
27
27
|
#
|
@@ -29,27 +29,35 @@ module Apotomo
|
|
29
29
|
def multipart_form_to_event(type, options={}, html_options={}, &block)
|
30
30
|
options.reverse_merge! :apotomo_iframe => true
|
31
31
|
html_options.reverse_merge! :target => :apotomo_iframe, :multipart => true
|
32
|
-
|
32
|
+
|
33
33
|
# i hate rails:
|
34
34
|
concat('<iframe id="apotomo_iframe" name="apotomo_iframe" style="display: none;"></iframe>'.html_safe) << form_tag(url_for_event(type, options), html_options, &block)
|
35
35
|
end
|
36
|
-
|
37
|
-
# Wraps your content in a +div
|
38
|
-
|
39
|
-
|
36
|
+
|
37
|
+
# Wraps your widget content in a +div+. See #widget_tag.
|
38
|
+
def widget_div(*args, &block)
|
39
|
+
widget_tag(:div, *args, &block)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Wraps your widget content in a +tag+ tag and sets the id. Feel free to pass additional html options.
|
40
43
|
#
|
41
|
-
# -
|
44
|
+
# - widget_tag :span do
|
42
45
|
# %p I'm wrapped
|
43
46
|
#
|
44
47
|
# will render
|
45
48
|
#
|
46
|
-
# <
|
49
|
+
# <span id="mouse">
|
47
50
|
# <p>I'm wrapped</p>
|
48
|
-
# </
|
49
|
-
|
50
|
-
|
51
|
-
|
51
|
+
# </span>
|
52
|
+
#
|
53
|
+
# Note that you can set the +id+ and other options manually.
|
54
|
+
#
|
55
|
+
# - widget_tag :div, id: "comments", class: "yellow"
|
56
|
+
def widget_tag(tag, options={}, &block)
|
57
|
+
options.reverse_merge!(:id => widget_id)
|
58
|
+
|
59
|
+
content_tag(tag, options, &block)
|
52
60
|
end
|
53
|
-
end
|
61
|
+
end
|
54
62
|
end
|
55
63
|
end
|
data/lib/apotomo/version.rb
CHANGED
@@ -48,16 +48,20 @@ class ViewHelperTest < Apotomo::TestCase
|
|
48
48
|
end)
|
49
49
|
end
|
50
50
|
|
51
|
-
test "respond to #
|
52
|
-
assert_equal('<
|
51
|
+
test "respond to #widget_tag" do
|
52
|
+
assert_equal('<span id="mum">squeak!</span>', in_view(MouseWidget) do widget_tag(:span) { "squeak!" } end)
|
53
53
|
end
|
54
54
|
|
55
|
-
test "respond to #
|
56
|
-
assert_equal('<
|
57
|
-
|
55
|
+
test "respond to #widget_tag with options" do
|
56
|
+
assert_equal('<span class="mouse" id="kid">squeak!</span>', in_view(MouseWidget) do
|
57
|
+
widget_tag(:span, :id => 'kid', :class => "mouse") { "squeak!" }
|
58
58
|
end)
|
59
59
|
end
|
60
60
|
|
61
|
+
test "respond to #widget_div" do
|
62
|
+
assert_equal('<div id="mum">squeak!</div>', in_view(MouseWidget) do widget_div { "squeak!" } end)
|
63
|
+
end
|
64
|
+
|
61
65
|
test "respond to #widget_id" do
|
62
66
|
assert_equal('mum', in_view(MouseWidget){ widget_id })
|
63
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apotomo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cells
|
@@ -222,7 +222,8 @@ files:
|
|
222
222
|
- test/widgets/mouse/make_me_squeak.html.erb
|
223
223
|
- test/widgets/mouse/snuggle.html.erb
|
224
224
|
homepage: http://github.com/apotonick/apotomo
|
225
|
-
licenses:
|
225
|
+
licenses:
|
226
|
+
- MIT
|
226
227
|
metadata: {}
|
227
228
|
post_install_message:
|
228
229
|
rdoc_options: []
|