Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix handling of alternate layout

  • Loading branch information...
commit 00461fe5c199bccbb8673a2464ec39cd5f4d6352 1 parent a9d42d4
@adamlogic authored
View
4 README.rdoc
@@ -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?
View
2  app/controllers/mockups_controller.rb
@@ -40,7 +40,7 @@ def extract_layout(template_path)
if filename_components.length < 4
true
else
- filename_components[1]
+ filename_components.last
end
end
View
2  app/views/mockups/frameset.html.erb
@@ -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>
View
2  generators/showoff/showoff_generator.rb
@@ -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
View
2  ...lates/alternate_layout.alternate.html.erb → ...lates/alternate_layout.html.erb.alternate
@@ -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>
View
1  generators/showoff/templates/showoff.css
@@ -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; }
Please sign in to comment.
Something went wrong with that request. Please try again.