Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

14652 frontpage style #35

Merged
merged 8 commits into from
Jun 17, 2014
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ ul.laundry-list {
outline: none;
}

.fa-external-link {
position: relative;
float: right;
}

#result {
background-color: #E2EEF6;
margin-top: 10px;
Expand Down
13 changes: 7 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
title: The Rust Programming Language
---

<link href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the entire font-awesome CSS file? Can't we simply use an image or the relevant icon line? Also, can we have the image be closer in scale and color to the mockup I posted earlier?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you need a single icon, just use an online bundler to only get that single font from font awesome.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fontello.com

<div class="row install-row">
<div class="col-md-8">
<p class="pitch">
Expand Down Expand Up @@ -49,8 +50,8 @@ <h2>Featuring</h2>
<div id="editor">// This code is editable and runnable!
fn main() {
// A simple integer calculator:
// `+` or `-` means add/sub by 1
// `*` or `/` means mul/div by 2
// `+` or `-` means add or subtract by 1
// `*` or `/` means multiply or divide by 2

let program = "+ + * - /";
let mut accumulator = 0;
Expand All @@ -65,17 +66,17 @@ <h2>Featuring</h2>
}
}

println!("The program \"{}\" calculates the value {}",
program, accumulator);
println!("The program \"{}\" calculates the value {}",
program, accumulator);
}</div>
<div id="result"></div>
</div>
<div id="static-code">
<pre class='rust'>
<span class='kw'>fn</span> main() {
<span class='comment'>// A simple integer calculator:
// `+` or `-` means add/sub by 1
// `*` or `/` means mul/div by 2</span>
// `+` or `-` means add or subtract by 1
// `*` or `/` means multiply or divide by 2</span>

<span class='kw'>let</span> program = <span class='string'>"+ + * - /"</span>;
<span class='kw'>let</span> <span class='kw'>mut</span> accumulator = <span class='number'>0</span>;
Expand Down
8 changes: 6 additions & 2 deletions js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,14 @@ function handleResult(statusCode, message) {
}
}

// Called on successful program run
// Called on successful program run: take edit contents and run in playground
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"take edit contents and run in playground" isn't what's going on here. This piece of code is run after the user's code has run in the playground.

function handleSuccess(message) {
resultDiv.style.backgroundColor = successColor;
resultDiv.innerHTML = escapeHTML(message);
var program = encodeURIComponent(editor.getValue());
var output = "<a href=\"http://play.rust-lang.org/?code=" + program +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixing in HTML with JS isn't good style. Instead, place the HTML with the rest of the markup and simply change the HREF when the result is changed. Note: What do you do when there is an error, or when the result pane is open but the code in the editor has changed and hasn't been rerun?

"&run=1\"><i class=\"fa fa-external-link\"></i></a>"
// console.log(output);
resultDiv.innerHTML = output + escapeHTML(message);
}

// Called when program run results in warning(s)
Expand Down