/
home.clj
90 lines (81 loc) · 3.36 KB
/
home.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
(ns tryclojure.views.home
(:require [noir.core :refer [defpartial defpage]]
[hiccup.element :refer [javascript-tag link-to unordered-list]]
[hiccup.page :refer [include-css include-js html5]]))
(defpartial links []
(unordered-list
[(link-to "http://clojure.org" "The official Clojure website")
(link-to "http://dev.clojure.org/display/doc/Getting+Started" "Getting started with Clojure")
(link-to "http://groups.google.com/group/clojure" "Clojure mailing list")
(link-to "http://java.ociweb.com/mark/clojure/article.html" "A comprehensive Clojure tutorial")
(link-to "http://joyofclojure.com/" "The Joy of Clojure: a book by Michael Fogus and Chris Houser")
(link-to "http://disclojure.org" "Disclojure")
(link-to "http://planet.clojure.in" "Planet Clojure")]))
(defpartial about-html []
[:p.bottom
"Welcome to Try Clojure - a quick tour of Clojure for absolute beginners."
]
[:p.bottom
"Here is our only disclaimer: this site is an introduction to Clojure, not a generic Clojure REPL. "
"You won't be able to do everything in it that you could do in your local interpreter. "
"Also, the interpreter deletes the data that you enter if you define too many things, or after 15 minutes."]
[:p.bottom
"You can find the site's source and such on its "
(link-to "http://github.com/Raynes/tryclojure" "github")
" page."]
[:p.bottom
"TryClojure is written in Clojure and JavaScript with "
(link-to "http://webnoir.org" "Noir") ", "
(link-to "https://github.com/flatland/clojail" "clojail") ", and Chris Done's "
(link-to "https://github.com/chrisdone/jquery-console" "jquery-console") ". "
" The design is by " (link-to "http://apgwoz.com" "Andrew Gwozdziewycz") "."
])
(defpartial home-html []
[:p.bottom
"Welcome to Clojure! "
"You can see a Clojure interpreter above - we call it a <em>REPL</em>."
]
[:p.bottom
"Type \"tutorial\" in the REPL to begin."
])
(defn root-html []
(html5
[:head
(include-css "/resources/public/css/tryclojure.css")
(include-js "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"
"/resources/public/javascript/jquery-console/jquery.console.js"
"/resources/public/javascript/tryclojure.js")
[:title "Try Clojure"]]
[:body
[:div#wrapper
[:div#content
[:div#header
[:h1
[:span.logo-try "Try"] " "
[:span.logo-clojure "Clo" [:em "j"] "ure"]]]
[:div#container
[:div#console.console]
[:div#buttons
[:a#home.buttons "home"]
[:a#links.buttons "links"]
[:a#about.buttons.last "about"]]
[:div#changer (home-html)]]
[:div.footer
[:p.bottom "©2011-2012 Anthony Grimes and numerous contributors."]]
(javascript-tag
"var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-27340918-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();")]]]))
(defpage "/" []
(root-html))
(defpage "/home" []
(home-html))
(defpage "/about" []
(about-html))
(defpage "/links" []
(links))