Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Recommend the Sinatra-Partials gem from myself (@lenary) and @yb66.

This supersedes my gist that has been used as the canonical partials implementation for ages, and has been copied and pasted around everywhere. We're now using a gem so we can support the project more easily.
  • Loading branch information...
commit 7e63e50e0603f6e16c2198a86dbd2eed96e10d1c 1 parent 5491159
Sam Elliott authored April 10, 2012

Showing 1 changed file with 20 additions and 7 deletions. Show diff stats Hide diff stats

  1. 27  faq.markdown
27  faq.markdown
Source Rendered
@@ -117,20 +117,33 @@ follows:
117 117
 
118 118
     <%= erb :mypartial, :layout => false %>
119 119
 
120  
-See [Sam Elliott](http://www.lenary.co.uk/)'s
121  
-[partials.rb](http://gist.github.com/119874)
122  
-for a more robust partials implementation. It even supports rendering
123  
-collections and partials in subdirectories. It was adapted from [Chris Schneider](http://www.gittr.com/)'s
124  
-[partials.rb](http://github.com/cschneid/irclogger/blob/master/lib/partials.rb) implementation to remove dependency on `#extract_options!` and add subdirectory support. 
  120
+See [Sam Elliott](http://www.lenary.co.uk/) and [Iain Barnett](http://iainbarnett.me.uk/)'s
  121
+[Sinatra-Partial extension](https://github.com/yb66/Sinatra-Partial)
  122
+for a more robust partials implementation. It also supports rendering
  123
+collections and partials in subdirectories.
125 124
 
126  
-Use it as follows to render the `_mypartial.erb`(1) or the `admin/_mypartial.erb`(2) partials, or with a collection (3) & (4):
  125
+The code used to live in a [gist](https://gist.github.com/119874),
  126
+but we have put it in a gem so we can maintain it properly and
  127
+provide an easier way for developers to include its behaviour.
  128
+It was adapted from [Chris Schneider](http://www.gittr.com/)'s
  129
+original [partials.rb](http://github.com/cschneid/irclogger/blob/master/lib/partials.rb)
  130
+implementation.
  131
+
  132
+Use it as follows to render the `mypartial.haml`(1) or the `admin/mypartial.haml`(2)
  133
+partials, or with a collection (3) & (4):
127 134
 
128 135
     <%= partial(:mypartial) %> <!--(1)-->
129 136
     <%= partial(:'admin/mypartial') %> <!--(2)-->
130 137
     <%= partial(:object, :collection => @objects) %> <!--(3)-->
131 138
     <%= partial(:'admin/object', :collection => @objects) %> <!--(4)-->
132 139
 
133  
-In (1) & (2), the partial will be rendered plain from their files, with no local variables (specify them with a hash passed into `:locals`). In (3) & (4), the partials will be rendered, populating the local variable `object` with each of the objects from the collection. 
  140
+In (1) & (2), the partial will be rendered plain from their files, with no
  141
+local variables (specify them with a hash passed into `:locals`).
  142
+In (3) & (4), the partials will be rendered, populating the local
  143
+variable `object` with each of the objects from the collection.
  144
+
  145
+It is also possible to enable using underscores, a la Rails, and
  146
+to choose a different rendering engine from haml.
134 147
 
135 148
 
136 149
 Can I have multiple URLs trigger the same route/handler? {#multiroute}

0 notes on commit 7e63e50

Please sign in to comment.
Something went wrong with that request. Please try again.