Created
March 15, 2010 02:08
-
-
Save adriand/332418 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!!! | |
%html{ :lang => "en" } | |
%head | |
%meta{ :content => "text/html; charset=utf-8", "http-equiv" => "Content-Type" }/ | |
%title | |
= "#{@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 | |
%body | |
#container | |
#header | |
%a{:href => "/"} | |
%h1 99 Bottles | |
#main | |
/ 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 | |
.spacer/ | |
#footer | |
%p | |
© 2010 Adrian Duyzer. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment