merb_viewfu 0.2 → 0.3

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.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'merb-core'
5
5
  require 'merb-core/tasks/merb'
6
6
 
7
7
  GEM_NAME = "merb_viewfu"
8
- GEM_VERSION = "0.2"
8
+ GEM_VERSION = "0.3"
9
9
  AUTHOR = "Jacques Crocker"
10
10
  EMAIL = "merbjedi@gmail.com"
11
11
  HOMEPAGE = "http://merbjedi.com/"
@@ -1,6 +1,52 @@
1
1
  module ViewFu
2
2
  module TagHelper
3
-
3
+ # Calls a Merb Partial with a block,
4
+ # which you can catch content from
5
+ #
6
+ # Usage Example:
7
+ # <%= partial_block :fieldset, :legend => "Login" do %>
8
+ # .. inner partial content
9
+ # <% end =%>
10
+ #
11
+ # Associated Partial (_fieldset.html.erb)
12
+ # <fieldset>
13
+ # <legend><%= locals[:legend] %></legend>
14
+ # <%= catch_content %>
15
+ # </fieldset>
16
+ def partial_block(template, options={}, &block)
17
+ throw_content(:for_layout, block_given? ? capture(&block) : "")
18
+ partial(template, options)
19
+ end
20
+
21
+ # Allows Easy Nested Layouts in Merb
22
+ #
23
+ # Usage Example:
24
+ #
25
+ # Parent Layout: layout/application.html.erb
26
+ # -------
27
+ # <html>
28
+ # <head>
29
+ # <title>Title</title>
30
+ # </head>
31
+ # <body>
32
+ # <%= catch_content %>
33
+ # </body>
34
+ # </html>
35
+ #
36
+ # SubLayout: layout/alternate.html.erb
37
+ # --------
38
+ # <%= parent_layout "application" do %>
39
+ # <div class="inner_layout">
40
+ # <%= catch_content %>
41
+ # </div>
42
+ # <% end =%>
43
+ #
44
+ # Now you can use the alternate layout in any of your views as normal
45
+ # and it will reuse the wrapping html on application.html.erb
46
+ def parent_layout
47
+ render capture(&block), :layout => layout
48
+ end
49
+
4
50
  # Writes a br tag
5
51
  def br
6
52
  "<br />"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb_viewfu
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.2"
4
+ version: "0.3"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacques Crocker
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-22 00:00:00 -08:00
12
+ date: 2008-11-28 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -44,8 +44,6 @@ files:
44
44
  - lib/view_fu
45
45
  - lib/view_fu/meta_helper.rb
46
46
  - lib/view_fu/tag_helper.rb
47
- - spec/spec_helper.rb
48
- - spec/viewfu_spec.rb
49
47
  has_rdoc: true
50
48
  homepage: http://merbjedi.com/
51
49
  post_install_message:
data/spec/spec_helper.rb DELETED
@@ -1 +0,0 @@
1
- $:.push File.join(File.dirname(__FILE__), '..', 'lib')
data/spec/viewfu_spec.rb DELETED
@@ -1,7 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
2
-
3
- describe "viewfu" do
4
- it "should do nothing" do
5
- true.should == true
6
- end
7
- end