New Download page for compass docs

This commit is contained in:
Chris Eppstein 2011-01-09 22:18:05 -08:00
parent 5bc36855bc
commit cb7ac80330
7 changed files with 154 additions and 9 deletions

View File

@ -0,0 +1,79 @@
function showInstallCommand() {
var cmd = $("#existence").val();
var commands = [];
var notes = [];
var project_name = "<myproject>";
var can_be_bare = true;
commands.push("$ gem install compass");
if (cmd == "init") {
commands.push("$ cd " + project_name);
project_name = ".";
}
if ($("#app-type").val() == "rails") {
if (cmd == "create") {
commands.push("$ rails new " + project_name);
}
cmd = "init rails";
can_be_bare = false;
} else if ($("#app-type").val() == "other") {
if (cmd == "init") {
cmd = "create";
}
} else if ($("#app-type").val() == "stand-alone") {
if (cmd == "init") {
cmd = "install";
can_be_bare = false;
}
}
var framework = $("#framework").val();
var create_command;
if (cmd == "install") {
create_command = "$ compass install " + framework + " " + project_name;
} else {
create_command = "$ compass " + cmd + " " + project_name;
}
if (framework != "compass" && framework != "bare" && cmd != "install") {
create_command = create_command + " --using " + framework;
} else if (framework == "bare") {
if (can_be_bare) {
create_command = create_command + " --bare";
} else {
notes.push("<p class='note warning'>You cannot create a bare project in this configuration. Feel free to remove any stylesheets that you don't want.</p>");
}
}
if ($("#syntax").val() == "sass") {
create_command = create_command + " --syntax sass";
}
if ($("#options").val() == "customized") {
create_command = create_command + " --sass-dir &lt;sassdir> --css-dir &lt;cssdir> --javascripts-dir &lt;jsdir> --images-dir &lt;imgsdir>";
}
commands.push(create_command);
var instructions = "<pre><code>" + commands.join("\n") + "</code></pre>";
if (instructions.match(/&lt;/)) {
notes.push("<p class='note'>Note: Values indicated by &lt;&gt; are placeholders. Change them to suit your needs.</em>");
}
$("#steps").html(instructions + notes.join(""));
}
function attachMadlibBehaviors() {
$("#app-type").change(function(event) {
var val = $(event.target).val();
if (val == "other") {
$("#options").val("customized");
$(".madlib").addClass("customizable");
} else if (val == "rails") {
$("#options").val("default");
$(".madlib").removeClass("customizable");
} else {
$(".madlib").addClass("customizable");
}
});
$("#existence, #app-type, #framework, #syntax, #options").change(showInstallCommand);
}
function setupMadlib() {
attachMadlibBehaviors();
showInstallCommand();
}
$(setupMadlib);

View File

@ -0,0 +1,48 @@
---
title: Download | Compass Documentation
crumb: Download
body_id: download
---
- content_for :javascripts do
%script(src="/javascripts/download.js")
%p
Compass runs on any computer that has
<a href="http://www.ruby-lang.org/en/downloads/">ruby installed</a>.
%h2 Tell us about your project and we'll help you get it set up:
%blockquote.madlib.customizable<
I would like to set up my
%select#existence
%option{:value => "create"} new
%option{:value => "init"} existing
%select#app-type
%option{:value => "stand-alone"} compass
%option{:value => "rails"} rails
%option{:value => "other"} other
project
with
%select#framework
%option{:value => "compass"} compass's
%option{:value => "blueprint"} blueprint's
%option{:value => "bare"} no
starter stylesheets.
%br
I prefer the
%select#syntax
%option{:value => "scss"} CSS based (SCSS)
%option{:value => "sass"} Indent based (Sass)
syntax<span class="customization">
= succeed "." do
and would like to
%select#options
%option{:value => "default"} use compass's recommended
%option{:value => "customized"} customize my project's
directory structure</span>
%h4 Thanks. Now run the following steps in your terminal:
#steps
Loading...
%p.note Note: <code>$</code> is a placeholder for your terminal's prompt. You don't type it.
%h4 Then follow the instructions that compass provides in the output.
%h2 Or you can buy a <a href="http://compass.handlino.com/">GUI for Compass</a> from Handlino.

View File

@ -0,0 +1,8 @@
body#download {
#steps, p.madlib, p.note, h4 { margin-top: 1em; }
p.note { font-size: smaller; font-style: italic; }
p.warning { color: #c00; }
.customization { display: none; }
.customizable .customization { display: inline; }
blockquote { border-left: 2px solid #ccc; text-indent: 0; padding-left: 0.5em; }
}

View File

@ -16,6 +16,7 @@
@import "partials/main"; @import "partials/main";
@import "partials/code"; @import "partials/code";
@import "partials/example"; @import "partials/example";
@import "partials/download";
@import "syntax/syntax-theme"; @import "syntax/syntax-theme";

View File

@ -9,6 +9,8 @@
%li %li
%a{:href => "/reference/compass/", :rel => "documentation"} Reference %a{:href => "/reference/compass/", :rel => "documentation"} Reference
%li %li
%a{:href => "/help", :rel=> "help"} Help %a{:href => "/help/", :rel=> "help"} Help
%li %li
%a{:href => "/get-involved", :rel=> "get-involved"} Get Involved %a{:href => "/get-involved/", :rel=> "get-involved"} Get Involved
%li
%a{:href => "/download/", :rel=> "download"} Download

View File

@ -132,3 +132,7 @@ def compass_version
"#{v[:major]}.#{v[:minor]}#{"."+v[:state] if v[:state]}.#{v[:build]}" "#{v[:major]}.#{v[:minor]}#{"."+v[:state] if v[:state]}.#{v[:build]}"
end end
def long_compass_version
require 'compass/commands'
Compass::Commands::PrintVersion.long_output_string
end

View File

@ -54,6 +54,15 @@ Options:
parser.parse! parser.parse!
parser.options parser.options
end end
def long_output_string
lines = []
lines << "Compass #{::Compass.version[:string]}"
lines << "Copyright (c) 2008-#{Time.now.year} Chris Eppstein"
lines << "Released under the MIT License."
lines << "Compass is charityware."
lines << "Please make a tax deductable donation for a worthy cause: http://umdf.org/compass"
lines.join("\n")
end
end end
attr_accessor :options attr_accessor :options
@ -79,13 +88,7 @@ Options:
elsif options[:quiet] elsif options[:quiet]
puts ::Compass.version[:string] puts ::Compass.version[:string]
else else
lines = [] puts self.class.long_output_string
lines << "Compass #{::Compass.version[:string]}"
lines << "Copyright (c) 2008-#{Time.now.year} Chris Eppstein"
lines << "Released under the MIT License."
lines << "Compass is charityware."
lines << "Please make a tax deductable donation: http://umdf.org/compass"
puts lines.join("\n")
end end
end end
end end