fortitude 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18462239455549b7d5cb928e800d12039ee251d5
4
- data.tar.gz: 36098bcd9321189387d6321c9211e335adb4d530
3
+ metadata.gz: 88845b81038d6b4a3d41b56c84e701006030b928
4
+ data.tar.gz: fc4e1b77e485646708cf7f68575a085023909550
5
5
  SHA512:
6
- metadata.gz: f2ccd3ba05b45c281a0d5919ab747c8a2afcaec9c06c7b303e45a757502c6201f58968279af65077a358cd8d92662cb93e9b59cb03b5a45de7db014e2a9fe112
7
- data.tar.gz: db8657d85913dfa462056ca3965bcf41120cc64bd3fca78976a228eee205a552f78f354877f4c7ce5896b9cfba5b121da5516cabac05b572fc0d4272cffd32a3
6
+ metadata.gz: 8297fce44cc771521a2ff0ac537ef65ef9f71cd2f0df2b150dedc2b8574287e2bfa97c976479c2b829c581b7a92ed268ebfd3a0b7cd77bb80b4f8482efcb1f53
7
+ data.tar.gz: c9332675c8e1c4a7e0309b8a7b078d6ab62e9acd14f9c2defd4a0aee17e1aaf29b74ecdecc61c5172164b6d256ee3009e2adf0a1e25d9ed4906bdaa2df85eb9e
data/CHANGES.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Fortitude Releases
2
2
 
3
+ ## 0.0.3, 23 June 2014
4
+
5
+ * Changed `Fortitude::Widget#to_html` to return the generated HTML. If you pass a `Fortitude::RenderingContext` into
6
+ this method that has previously been used to render other HTML, you'll get all HTML (old and new) both, because
7
+ we always append to a single output buffer — but that should be a corner case at most.
8
+
3
9
  ## 0.0.2, 21 June 2014
4
10
 
5
11
  * Void tags (those that can't take content, ever, like `<hr>` or `<br>`) are now never closed in HTML4 doctypes
@@ -209,7 +209,7 @@ module Fortitude
209
209
  if (options = args[0]).kind_of?(Hash)
210
210
  if (widget = options[:widget])
211
211
  rendering_context = fortitude_rendering_context(:delegate_object => self)
212
- widget.to_html(rendering_context)
212
+ widget.render_to(rendering_context)
213
213
 
214
214
  options = options.dup
215
215
  options[:text] = rendering_context.output_buffer_holder.output_buffer.html_safe
@@ -234,7 +234,7 @@ module Fortitude
234
234
  assigns = assigns.merge(options[:locals] || { })
235
235
 
236
236
  widget = widget_class.new(assigns)
237
- widget.to_html(rendering_context)
237
+ widget.render_to(rendering_context)
238
238
 
239
239
  options = options.dup
240
240
  options[:text] = rendering_context.output_buffer_holder.output_buffer.html_safe
@@ -32,7 +32,7 @@ module Fortitude
32
32
  # RC for both the initial view rendering and for the partial layout, but they need different yield blocks.
33
33
  # Yuck, but this does the job.
34
34
  rendering_context.with_yield_block(block) do
35
- widget.to_html(rendering_context)
35
+ widget.render_to(rendering_context)
36
36
  end
37
37
  rendering_context.flush!
38
38
  end
@@ -69,7 +69,7 @@ which is not a Class that inherits from Fortitude::Widget.}
69
69
  widget_assigns = fortitude_class.extract_needed_assigns_from(widget_assigns) unless fortitude_class.extra_assigns == :use
70
70
 
71
71
  widget = fortitude_class.new(widget_assigns)
72
- widget.to_html(rendering_context)
72
+ widget.render_to(rendering_context)
73
73
  rendering_context.output_buffer_holder.output_buffer
74
74
  end
75
75
 
@@ -1,3 +1,3 @@
1
1
  module Fortitude
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -23,8 +23,7 @@ module Fortitude
23
23
  end
24
24
  end
25
25
 
26
- # PUBLIC API
27
- def to_html(rendering_context)
26
+ def render_to(rendering_context)
28
27
  @_fortitude_rendering_context = rendering_context
29
28
  @_fortitude_output_buffer_holder = rendering_context.output_buffer_holder
30
29
 
@@ -39,6 +38,12 @@ module Fortitude
39
38
  end
40
39
  end
41
40
 
41
+ # PUBLIC API
42
+ def to_html(rendering_context = ::Fortitude::RenderingContext.new({ }))
43
+ render_to(rendering_context)
44
+ rendering_context.output_buffer_holder.output_buffer
45
+ end
46
+
42
47
  # PUBLIC API
43
48
  def rendering_context
44
49
  @_fortitude_rendering_context
@@ -46,7 +51,7 @@ module Fortitude
46
51
 
47
52
  # PUBLIC API
48
53
  def widget(w)
49
- w.to_html(@_fortitude_rendering_context)
54
+ w.render_to(@_fortitude_rendering_context)
50
55
  end
51
56
 
52
57
  # PUBLIC API
@@ -86,7 +86,7 @@ module SystemHelpers
86
86
  widget_or_class
87
87
  end
88
88
  rendering_context = options[:rendering_context] || rc
89
- widget.to_html(rendering_context)
89
+ widget.render_to(rendering_context)
90
90
  html_from(rendering_context)
91
91
  end
92
92
 
@@ -1,4 +1,22 @@
1
1
  describe "Fortitude widget return values", :type => :system do
2
+ describe "#to_html" do
3
+ it "should return the rendered text" do
4
+ wc = widget_class do
5
+ needs :name
6
+
7
+ def content
8
+ h1 "hello, #{name}"
9
+ div {
10
+ p "you are awesome, #{name}"
11
+ }
12
+ end
13
+ end
14
+
15
+ expect(wc.new(:name => 'wendy').to_html).to eq(
16
+ %{<h1>hello, wendy</h1><div><p>you are awesome, wendy</p></div>})
17
+ end
18
+ end
19
+
2
20
  describe "#widget" do
3
21
  it "should return whatever the widget returns" do
4
22
  inner = widget_class_with_content do
@@ -52,7 +70,7 @@ describe "Fortitude widget return values", :type => :system do
52
70
  end
53
71
  end
54
72
 
55
- describe "#to_html" do
73
+ describe "#render_to" do
56
74
  it "should return whatever #content returns" do
57
75
  wc = widget_class_with_content do
58
76
  text "foo"
@@ -61,7 +79,7 @@ describe "Fortitude widget return values", :type => :system do
61
79
 
62
80
  widget = wc.new
63
81
  rendering_context = rc
64
- actual_rv = widget.to_html(rendering_context)
82
+ actual_rv = widget.render_to(rendering_context)
65
83
  expect(actual_rv).to eq(:widget_rv)
66
84
  end
67
85
 
@@ -82,7 +100,7 @@ describe "Fortitude widget return values", :type => :system do
82
100
 
83
101
  widget = wc.new
84
102
  rendering_context = rc
85
- actual_rv = widget.to_html(rendering_context)
103
+ actual_rv = widget.render_to(rendering_context)
86
104
  expect(actual_rv).to eq(:widget_rv)
87
105
  end
88
106
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fortitude
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Geweke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-21 00:00:00.000000000 Z
11
+ date: 2014-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport