Skip to content

Instantly share code, notes, and snippets.

Created Mar 15, 2010
What would you like to do?
%html{ :lang => "en" }
%meta{ :content => "text/html; charset=utf-8", "http-equiv" => "Content-Type" }/
= "#{@page_title} ±" if @page_title
99 Bottles
%link{ :href => "/style.css", :title => "no title", :rel => "stylesheet", :media => "screen", :type => "text/css", :charset => "utf-8" }
%script{ :type => "text/javascript", :src => "/jquery.js" }
/ Drop in an erb file that just contains Javascript - that way, any Javascript we need is contained cleanly in a
/ separate file, and we can also wrap it in <script type="text/javascript"> tags: which in our editor of choice,
/ TextMate, is the best way to get syntax highlighting.
= erb :layout_js
= @js
%a{:href => "/"}
%h1 99 Bottles
/ Checking for these params means we can show messages to the user by tacking on a "failure" or "notice"
/ parameter. E.g. on localhost: http://localhost:4567/?notice=Your account was verified successfully.
/ That will display a notice with an account message in the layout. This is the quick and dirty version of
/ Rails' flash messages. In your application, use this as follows:
/ redirect "/new?failure=You failed to complete all required fields."
/ Note that since this is a redirect, the contents of unsaved instance variables will be lost: that's acceptable
/ for a simple application, but not for anything with more complex forms.
- if params[:notice]
.note.notice= params[:notice]
- if params[:failure]
.note.failure= params[:failure]
= yield
&copy; 2010 Adrian Duyzer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment