Skip to content

Added in tutorial button #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2014
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 11 additions & 3 deletions resources/public/javascript/tryclojure.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var pages;

var currentPage = -1;
var currentPage = 0;

function pageExitCondition(pageNumber) {
if (pageNumber >= 0 && pageNumber < pages.length && pages[pageNumber].exitexpr) {
Expand Down Expand Up @@ -37,8 +37,8 @@ function goToTag(tag) {
return;
}

function setupLink(url) {
return function(e) { $("#changer").load(url, function(data) { $("#changer").html(data); }); }
function setupLink(url, opts) {
return function(e) { $("#changer").load(url, function(data) { $("#changer").html(data);changerUpdated() }); }
}

function setupExamples(controller) {
Expand Down Expand Up @@ -149,6 +149,13 @@ function changerUpdated() {

var controller;

function setCurrentPage(){
return function(){
$.post("/tutorial?page="+currentPage, function(data){
$("#changer").html(data);
})}
}

$(document).ready(function() {
$.getJSON("/metadata.json", function (data) { pages = data; } );

Expand All @@ -164,6 +171,7 @@ $(document).ready(function() {

$("#about").click(setupLink("about"));
$("#links").click(setupLink("links"));
$("#tutorial").click( setCurrentPage() );
$("#home").click(setupLink("home"));

changerUpdated();
Expand Down
5 changes: 5 additions & 0 deletions resources/public/tutorial.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<div id="tutorial">
<div class="page">
<p>Welcome to Clojure!</p>
<p>You can see a Clojure interpreter above - we call it a <em>REPL</em>.</p>
<p>Type <code>next</code> in the REPL to begin.</p>
</div>
<div class="page" data-tag="start">
<p>
I'll take you on a 5-minutes tour of Clojure, but feel free to experiment on your own along the road!
Expand Down
1 change: 1 addition & 0 deletions src/tryclojure/views/home.clj
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
[:div#container
[:div#console.console]
[:div#buttons
[:a#tutorial.buttons "tutorial"]
[:a#links.buttons "links"]
[:a#about.buttons.last "about"]]
[:div#changer (home-html)]]
Expand Down