Skip to content

Commit 60ce0b1

Browse files
MrJabajimdowning
authored andcommitted
Added in tutorial button
1 parent 38f2bb5 commit 60ce0b1

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

resources/public/javascript/tryclojure.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var pages;
22

3-
var currentPage = -1;
3+
var currentPage = 0;
44

55
function pageExitCondition(pageNumber) {
66
if (pageNumber >= 0 && pageNumber < pages.length && pages[pageNumber].exitexpr) {
@@ -37,8 +37,8 @@ function goToTag(tag) {
3737
return;
3838
}
3939

40-
function setupLink(url) {
41-
return function(e) { $("#changer").load(url, function(data) { $("#changer").html(data); }); }
40+
function setupLink(url, opts) {
41+
return function(e) { $("#changer").load(url, function(data) { $("#changer").html(data);changerUpdated() }); }
4242
}
4343

4444
function setupExamples(controller) {
@@ -149,6 +149,13 @@ function changerUpdated() {
149149

150150
var controller;
151151

152+
function setCurrentPage(){
153+
return function(){
154+
$.post("/tutorial?page="+currentPage, function(data){
155+
$("#changer").html(data);
156+
})}
157+
}
158+
152159
$(document).ready(function() {
153160
$.getJSON("/metadata.json", function (data) { pages = data; } );
154161

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

165172
$("#about").click(setupLink("about"));
166173
$("#links").click(setupLink("links"));
174+
$("#tutorial").click( setCurrentPage() );
167175
$("#home").click(setupLink("home"));
168176

169177
changerUpdated();

resources/public/tutorial.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<div id="tutorial">
2+
<div class="page">
3+
<p>Welcome to Clojure!</p>
4+
<p>You can see a Clojure interpreter above - we call it a <em>REPL</em>.</p>
5+
<p>Type <code>next</code> in the REPL to begin.</p>
6+
</div>
27
<div class="page" data-tag="start">
38
<p>
49
I'll take you on a 5-minutes tour of Clojure, but feel free to experiment on your own along the road!

src/tryclojure/views/home.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
[:div#console.console]
6262
[:div#changer (home-html)]
6363
[:div#buttons
64+
[:a#tutorial.buttons "tutorial"]
6465
[:a#links.buttons "links"]
6566
[:a#about.buttons.last "about"]]]
6667
[:div.footer

0 commit comments

Comments
 (0)