Skip to content

Commit

Permalink
fix handling of alternate layout
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlogic committed Apr 15, 2009
1 parent a9d42d4 commit 00461fe
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ you embed a "mini app" inside of your main app.

== How do I use it?

Just throw your mockups into app/views/mockups, then navigate to /mockups in your app.
Just throw your mockups into app/views/mockups, then navigate to /mockups in your app. Just like any other
Rails view, you can use partials, helpers, etc. If you want to use a layout other than your application
default, tack it on as an additional file extension (example.html.erb.alternate).

== Can I see an example?

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/mockups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def extract_layout(template_path)
if filename_components.length < 4
true
else
filename_components[1]
filename_components.last
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/mockups/frameset.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>Mockups</title>
</head>

<frameset cols="150,*" frameborder="1" border="1" bordercolor="#666666" framespacing="1">
<frameset cols="170,*" frameborder="1" border="1" bordercolor="#666666" framespacing="1">
<frame src="/mockups_index" title="List" name="list" />
<frame name="content" />
</frameset>
Expand Down
2 changes: 1 addition & 1 deletion generators/showoff/showoff_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def manifest
record do |m|
m.directory 'app/views/mockups/sample_section'
m.file 'sample_mockup.html.erb', 'app/views/mockups/sample_mockup.html.erb'
m.file 'alternate_layout.alternate.html.erb', 'app/views/mockups/alternate_layout.alternate.html.erb'
m.file 'alternate_layout.html.erb.alternate', 'app/views/mockups/alternate_layout.html.erb.alternate'
m.file 'sample_nested.html.erb', 'app/views/mockups/sample_section/sample_nested.html.erb'
m.file 'showoff.css', 'public/stylesheets/showoff.css'
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1>Alternate Layout Example</h1>

<p>
If a template has an additinal file extension, such as <code>alternate_layout.alternate.html.erb</code>,
If a template has an additinal file extension, such as <code>alternate_layout.html.erb.alternate</code>,
the first extension will be used as the layout. In this case, Rails is expecting a layout named
'alternate' to be defined.
</p>
1 change: 1 addition & 0 deletions generators/showoff/templates/showoff.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ body { background-color: #eee; font: 13px/1.5 Helvetica, Arial, 'Liberation Sans

#showoff_tree { padding: 10px; }
#showoff_tree ul { padding: 0 10px 20px; }
#showoff_tree li { white-space: nowrap; }
#showoff_tree h2 { padding-bottom: 3px; font-weight: bold; }

0 comments on commit 00461fe

Please sign in to comment.