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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab4ff5d6b948831051158089f36e5d1fcc51a6dc
4
- data.tar.gz: e9a1e8f5307939371bb65eec32838fdfc2c959fd
3
+ metadata.gz: 017a9d6267b6b8cf91a80513607f24cd2f0edcd0
4
+ data.tar.gz: 2cfe2319182b4536f6c20d5dddf7cbb02224a5e0
5
5
  SHA512:
6
- metadata.gz: bbba581bafc616e601e27064061147b369cd510b6842ff0c2bd4612288a1f57bcaddf11947eb5264da482b5324f0233a9a718c60c490080ea4f114081ba70d36
7
- data.tar.gz: a44b757bb6f0a490f08826680e08ec747a01db2abe95004acf4781188e5f564ee9fa7cb6a557bb348374a824b779f2e19a98ddef682c227cff381199434d3f26
6
+ metadata.gz: c39ad60a4f9fc2a4d93b3a928b3ff46ce583443aa25b3a3ade4663221bd639717c3b26d35b4f3b27dfd1456503ca039e70740bb0a2d97b998103eea2789944b4
7
+ data.tar.gz: e0b7f965287f2d42ba136dfec5816c90b7514904dbb111bd4dc6654a8cd57a50e9a6214a357b077fbf2075ae415853b3635c37f5dc243c64aa109ceec70aff6d
@@ -1,3 +1,7 @@
1
+ h2. 1.2.5
2
+
3
+ * Introduce @#widget_tag@ helper allowing you to wrap widget content in an arbitrary tag. Extends @#widget_div@.
4
+
1
5
  h2. 1.2.4
2
6
 
3
7
  * Make it work with Rails 4.
@@ -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+ and sets the id. Feel free to pass additional html options.
38
- #
39
- # Example:
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
- # - widget_div do
44
+ # - widget_tag :span do
42
45
  # %p I'm wrapped
43
46
  #
44
47
  # will render
45
48
  #
46
- # <div id="mouse">
49
+ # <span id="mouse">
47
50
  # <p>I'm wrapped</p>
48
- # </div>
49
- def widget_div(options={}, &block)
50
- options.reverse_merge!(:id => widget_id)
51
- content_tag(:div, options, &block)
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
@@ -1,3 +1,3 @@
1
1
  module Apotomo
2
- VERSION = '1.2.4'
2
+ VERSION = '1.2.5'
3
3
  end
@@ -48,16 +48,20 @@ class ViewHelperTest < Apotomo::TestCase
48
48
  end)
49
49
  end
50
50
 
51
- test "respond to #widget_div" do
52
- assert_equal('<div id="mum">squeak!</div>', in_view(MouseWidget) do widget_div { "squeak!" } end)
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 #widget_div with options" do
56
- assert_equal('<div class="mouse" id="kid">squeak!</div>', in_view(MouseWidget) do
57
- widget_div(:id => 'kid', :class => "mouse") { "squeak!" }
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
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-10-01 00:00:00.000000000 Z
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: []