views/index.haml
!!! 5
%html
%head
%title GitHub Preview
%script{:type => "text/javascript", :src => "http://code.jquery.com/jquery-1.6.2.min.js"}
%script{:type => "text/javascript", :src => "http://underscorejs.org/underscore-min.js"}
%script{:type => "text/javascript", :src => "/scripts/app.js"}
%link{:href => "/stylesheets/github.css", :rel => "stylesheet", :type => "text/css" }
%body
%a{:href => "https://github.com/kei-s/github-preview"}
%img{:alt => "Fork me on GitHub", :src => "http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png", :style => "position: absolute; top: 0pt; right: 0pt; border: 0pt none;"}
#header
%h1 GitHub Preview
%p
Format:
- formats = %w[markdown textile rdoc org creole mediawiki]
%select#format{:name => "format"}
- formats.each do |format|
%option{:selected => ('selected' if format == params[:format])}= format
%a#showhelp{:href => "#"} Show Formatting Help
:javascript
function getText() {
GitHubPreview.changedForm = false;
return $('#text').val();
}
%object#clippy{classid: "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000", width: "110", height: "14"}
%param{name: "movie", value: "/flash/clippy.swf"}
%param{name: "allowScriptAccess", value: "always"}
%param{name: "quality", value: "high"}
%param{name: "scale", value: "noscale"}
%param{NAME: "FlashVars", value: "call=getText"}
%param{name: "bgcolor", value: "#FFF"}
%embed{src: "/flash/clippy.swf", width: "110", height: "14", name: "clippy", quality: "high", allowScriptAccess: "always", type: "application/x-shockwave-flash", pluginspage: "http://www.macromedia.com/go/getflashplayer", FlashVars: "call=getText", bgcolor: "#FFF" }
%table{:cellspacing => "0", :cellpadding => "0", :style => "margin: 0; padding: 6px 6px 0; width: 100%;"}
%tr
%td{:style => "vertical-align: top; width: 50%;"}
%textarea#text{:style => "width: 100%; height: 300px;"}&= params[:text]
%td#readme.announce{:style => "vertical-align: top; width: 50%; height: 300px"}
#preview.panel.wikistyle{:style => "margin: 1px 0 0 10px; padding: 0 10px 0 10px; overflow: auto;"}
#help.panel.wikistyle{:style => "margin: 1px 0 0 10px; padding: 0 10px 0 10px; overflow: auto;display: none;"}