Skip to content

Commit dab0dd0

Browse files
committedSep 10, 2010
first commit
0 parents  commit dab0dd0

38 files changed

+986
-0
lines changed
 

‎.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pom.xml
2+
*jar
3+
lib
4+
classes

‎README

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# clojspace
2+
3+
FIXME: write description
4+
5+
## Usage
6+
7+
FIXME: write
8+
9+
## Installation
10+
11+
FIXME: write
12+
13+
## License
14+
15+
FIXME: write

‎model/model.clj

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
(ns model.model
2+
(:require [clojure.contrib.sql :as sql]))
3+
4+
(def db {:classname "com.mysql.jdbc.Driver"
5+
:subprotocol "mysql"
6+
:subname "//localhost:3306/cloj_space_development"
7+
:user "deuser"
8+
:password "depass"})
9+
10+
(defn drop-users []
11+
(sql/drop-table :users))
12+
13+
(defn create-users []
14+
(drop-users)
15+
(sql/create-table
16+
:users
17+
[:id :integer "PRIMARY KEY" "AUTO_INCREMENT"]
18+
[:screen_name "varchar(25)"]
19+
[:email "varchar(35)"]
20+
[:password "varchar(30)"]
21+
[:created_at "timestamp"]
22+
[:updated_at "timestamp"]))
23+
24+
(def screen-name-min-length 4)
25+
(def screen-name-max-length 20)
26+
(def password-min-length 4)
27+
(def password-max-length 40)
28+
29+
30+
(defn insert-user [screen_name email password]
31+
(let [sql "insert into users (screen_name,email,password) values (? ,?, ?)"]
32+
(sql/with-connection db
33+
(sql/do-prepared sql [screen_name email password] ))))
34+
35+
36+
(defn find-by-screen-name [screen_name]
37+
(sql/with-connection db
38+
(sql/with-query-results rs [ "select * from users where screen_name=?" screen_name ]
39+
(apply :screen-name rs))))
40+
41+
(defn find-by-email [email]
42+
(sql/with-connection db
43+
(sql/with-query-results rs [ "select * from users where email=?" email ]
44+
(apply :email rs))))
45+
46+
(defn uniqueness? [email screen-name]
47+
(and (nil? (find-by-screen-name screen-name))(nil? (find-by-email email))))
48+
49+
(defn screen-name-valid? [screen-name]
50+
(and (> (count screen-name ) screen-name-min-length) (< (count screen-name) screen-name-max-length)
51+
(re-find #"^[A-Z0-9_]*$/i" screen-name)))
52+
53+
(defn password-within? [password]
54+
(and (> (count password ) password-min-length) (< (count password) password-max-length)))
55+
56+
(defn email-valid? [email]
57+
(and (not (nil? email)) (re-find #"^[A-Z0-9_%-]+@([A-Z0-9-]+\.)+[A-Z]{2,4}$/i" email) ))
58+
59+
(defn add-user [[screen-name email password]]
60+
(and (uniqueness? email screen-name) (screen-name-within? screen-name)
61+
(password-within? password)(email-presence? email))
62+
(insert-user screen-name email password)
63+
)
64+
65+
66+
; (create-users)
67+
;; (create-posts)
68+
;; (create-comments))
69+
;;(doseq [doon [create-members create-posts create-comments]]
70+
;; (sql/with-connection db #(doon)))
71+
72+
73+
(add-user "me" "" "a")
74+
75+
76+
(sql/with-connection db
77+
(create-users))

‎src/clojspace/clo_template.clj

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
(ns clojspace.clo-template
2+
(:require [net.cgrand.enlive-html :as html]))
3+
4+
(def title-word { "index" "ClojSpace User Hub", "about" "About ClojSpace", "help" "ClojSpace Help" , "register" "Register" , "login" "ClojSpace"})
5+
(def uri-set #{"index" "about" "help" "register" "login"} )
6+
7+
8+
9+
(html/deftemplate t1 "static/site.html" [title contenti & extra]
10+
[:div#conten :p] (html/content title)
11+
[:div#error-message :p] (html/html-content (apply str extra))
12+
[:div#conten :div] (html/html-content (apply str (html/emit* (apply :content (apply :content (html/html-resource contenti)))))))
13+

‎src/clojspace/clotemplate.clj

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(def title-word { "index" "ClojSpace User Hub", "about" "About ClojSpace", "help" "ClojSpace Help" , "register" "Register" })
2+
(def uri-set #{"index" "about" "help" "register"} )
3+
4+
5+
6+
(html/deftemplate t1 "static/site.html" [title contenti & extra]
7+
[:div#header :p] (html/content title)
8+
[:div#error-register :p] (html/content (apply str extra))
9+
[:div#conten] (html/html-content (apply str (html/emit* (apply :content (apply :content (html/html-resource contenti)))))))
10+

‎src/clojspace/core.clj

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
(ns clojspace.core
2+
(:use compojure.core
3+
ring.adapter.jetty
4+
ring.util.response
5+
ring.middleware.session
6+
)
7+
(:require [compojure.route :as route])
8+
(:require [clojure.contrib.sql :as sql])
9+
(:require [clojspace.model :as model])
10+
(:require [clojspace.validation :as valid])
11+
(:require [clojspace.clo-template :as temp])
12+
(:require [net.cgrand.enlive-html :as html]))
13+
14+
15+
(defroutes example-routes
16+
17+
(GET ["/:uri" :uri #".*"] [uri]
18+
(if (temp/uri-set uri)
19+
(temp/t1 (temp/title-word uri) (str "static/" uri ".html"))))
20+
;{session :session, params :params}
21+
;; {:session (assoc session :email (params "email"))
22+
;; :body
23+
(POST "/login" {session :session, params :params}
24+
(if (valid/login-data params)
25+
{session (assoc session :id ((model/find-user-id params) 0) )
26+
:body (temp/t1 (str "Welcome " (params "screen_name") ) "static/index.html" )}
27+
28+
(temp/t1 "ClojSpace" "static/register.html" "<div id=errorExplanation ><p>Wrong password or user name</p></div>" )))
29+
30+
31+
32+
(POST "/register" {session :session,params :params}
33+
(if(valid/add-user params)
34+
{session (assoc session :id ((model/find-user-id params) 0) )
35+
:body (temp/t1 (str "User " (params "screen_name") " created") "static/index.html" )}
36+
37+
(temp/t1 "ClojSpace" "static/register.html" "<div id=errorExplanation ><p>Either your name or email is already taken</p><p> Or Name has leass than four characters</p><p> Or email not standard </p></div>" ))))
38+
39+
(defroutes handler
40+
(GET "/" [] "A normal route")
41+
(route/files "/" {:root "./static"})
42+
(route/not-found "Not found"))
43+
44+
(defroutes app example-routes handler )
45+
46+
47+
(run-jetty (var app) {:port 8085})
48+
49+
50+
51+

‎src/clojspace/done.clj

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
(ns done
3+
4+
(:use compojure.core
5+
ring.adapter.jetty)
6+
7+
(:require [net.cgrand.enlive-html :as html])
8+
(:require [compojure.route :as route])
9+
)
10+
11+
12+
(def title-word { "index" "ClojSpace User Hub", "about" "About ClojSpace", "help" "ClojSpace Help" , "register" "Register" })
13+
(def uri-set #{"index" "about" "help" "register"} )
14+
15+
16+
(html/deftemplate rend "clojspace/isite.html" [title cont]
17+
[:div#header :p] (html/content title)
18+
[:div#content :p] (html/content (apply str (html/emit* (apply :content (apply :content (html/html-resource cont)))))))
19+
20+
(defroutes hii
21+
22+
(GET ["/:uri" :uri #".*"] [uri]
23+
(if (string? uri)
24+
(rend (title-word uri) (str "clojspace/views/" uri ".html")))))
25+
26+
(run-jetty hii {:port 8080})

‎src/clojspace/index.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1>Welcome!</h1>
2+
<p>This page will serve as the hub for users of ClojSpace!</p>
3+

‎src/clojspace/model.clj

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
(ns clojspace.model
2+
(:require [clojure.contrib.sql :as sql]))
3+
4+
(def db {:classname "com.mysql.jdbc.Driver"
5+
:subprotocol "mysql"
6+
:subname "//localhost:3306/cloj_space_development"
7+
:user "deuser"
8+
:password "depass"})
9+
10+
(defn drop-users []
11+
(sql/drop-table :users))
12+
13+
(defn create-users []
14+
(drop-users)
15+
(sql/create-table
16+
:users
17+
[:id :integer "PRIMARY KEY" "AUTO_INCREMENT"]
18+
[:screen_name "varchar(25)"]
19+
[:email "varchar(35)"]
20+
[:password "varchar(30)"]
21+
[:created_at "timestamp"]
22+
[:updated_at "timestamp"]))
23+
24+
25+
26+
27+
(defn insert-user [screen_name email password]
28+
(let [created_at (java.util.Date.) updated_at (java.util.Date.) sql "insert into users (screen_name,email,password,created_at,updated_at) values (? ,?, ?,?,?)"]
29+
(sql/with-connection db
30+
(sql/do-prepared sql [screen_name email password created_at updated_at] ))))
31+
32+
33+
34+
(defn find-by-screen-name [screen_name]
35+
(sql/with-connection db
36+
(sql/with-query-results rs [ "select * from users where screen_name=?" screen_name ]
37+
(apply vector rs))))
38+
39+
(defn find-by-email [email]
40+
(sql/with-connection db
41+
(sql/with-query-results rs [ "select * from users where email=?" email ]
42+
(apply vector rs))))
43+
44+
(defn find-user-id [ params]
45+
(let [screen_name (params "screen_name") ]
46+
(sql/with-connection db
47+
(sql/with-query-results rs [ "select id from users where screen_name=? " screen_name]
48+
(apply vector rs)))))
49+
50+
(defn find-by-screen-name-password [ screen_name password]
51+
(sql/with-connection db
52+
(sql/with-query-results rs [ "select id from users where screen_name=? and password=?" screen_name password]
53+
(apply vector rs))))
54+
55+
;(pr-str (find-by-screen-name-password "Janus" "google"))
56+
;;(find-by-screen-name "EMEKA")
57+
;;(add-user "EMEKA" "emekamicro@gmail.com" "emekas")
58+
; (create-users)
59+
;; (create-posts)
60+
;; (create-comments))
61+
;;(doseq [doon [create-members create-posts create-comments]]
62+
;; (sql/with-connection db #(doon)))
63+
64+
65+
;;(add-user "me" "" "a")
66+
67+
68+
; (sql/with-connection db
69+
;;(create-users))

‎src/clojspace/site.html

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict //EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3+
<html>
4+
<head>
5+
<title>Kool</title>
6+
<link type="text/css" src="/views/clojspace/stylesheets/site.css">
7+
</head>
8+
<body>
9+
<div id="whole_page">
10+
<div id="header"><p>ClojSpace</p></div>
11+
<div id="error-register"><p></p></div>
12+
<div id="nav">
13+
<a href="/site/index">Home</a>|<a href="/site/about">About Us</a>|<a href="/site/help">help</a>|<a href="/site/register">Register</a>
14+
</div>
15+
<div id="conten"><p></p>
16+
</div>
17+
</div>
18+
</body>
19+
</html>

‎src/clojspace/static/isite.html

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3+
<html xmlns="http://www.w3.org/1999/xhtml">
4+
5+
<head>
6+
<title>My first website</title>
7+
<link href="reset.css" rel="stylesheet" type="text/css" />
8+
<link href="src/clojspace/styles.css" rel="stylesheet" type="text/css" />
9+
</head>
10+
11+
<body>
12+
13+
<div id="pagewrap">
14+
<div id="header">
15+
<h1>Welcome to my new website!</h1>
16+
</div>
17+
18+
<div id="navigation">
19+
<a href="#">Link 1</a> | <a href="#">Link 2</a> | <a href="#">Link 3</a>
20+
</div>
21+
22+
<div id="content">
23+
<p>This is the content section</p>
24+
</div>
25+
26+
<div id="footer">
27+
<p>This is the footer section</p>
28+
</div>
29+
</div>
30+
31+
</body>
32+
</html>

‎src/clojspace/static/styles.css

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
body { background-color: white; font-size: 12px; }
2+
a { color: red; font-size: 12px; text-decoration: none; }
3+
a:hover { color: blue; text-decoration: underline; }
4+
h1 { font-size: 20px; border-bottom: solid 2px orange; }
5+
#header { height: 30px; }
6+
#navigation { height: 20px; }
7+
#content { height: 50px; border-top: dotted 1px black;}
8+
#footer { height: 20px; border-top: dotted 1px black; }

‎src/clojspace/styles.css

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
body { background-color: white; font-size: 12px; }
2+
a { color: red; font-size: 12px; text-decoration: none; }
3+
a:hover { color: blue; text-decoration: underline; }
4+
h1 { font-size: 20px; border-bottom: solid 2px orange; }
5+
#header { height: 30px; }
6+
#navigation { height: 20px; }
7+
#conten { height: 50px; border-top: dotted 1px black;}
8+
#footer { height: 20px; border-top: dotted 1px black; }

‎src/clojspace/validation.clj

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
(ns clojspace.validation
2+
3+
(:use form-dot-clj.core)
4+
(:use form-dot-clj.jquery-tools)
5+
(:require [clojspace.model :as model]))
6+
7+
8+
(def screen-name-min-length 4)
9+
(def screen-name-max-length 20)
10+
(def password-min-length 4)
11+
(def password-max-length 40)
12+
13+
(defn uniqueness? [email screen-name]
14+
(and (nil? (seq (model/find-by-screen-name screen-name)))(nil? (seq (model/find-by-email email)))))
15+
16+
(defn screen-name-valid? [screen-name]
17+
(and (> (count screen-name ) screen-name-min-length) (< (count screen-name) screen-name-max-length)
18+
(re-find #"^[A-Z0-9_]*$/i" screen-name)))
19+
20+
(defn password-within? [password]
21+
(and (> (count password ) password-min-length) (< (count password) password-max-length)))
22+
23+
(defn email-valid? [email]
24+
(and (not (nil? email)) (re-find #"^[A-Z0-9_%-]+@([A-Z0-9-]+\.)+[A-Z]{2,4}$/i" email) ))
25+
26+
(defn add-user [params]
27+
(let [email (params "email") screen-name (params "screen_name") password (params "password")]
28+
(if (and (uniqueness? email screen-name) (screen-name-valid? screen-name)
29+
(password-within? password)(email-valid? email))
30+
(model/insert-user screen-name email password)
31+
)))
32+
33+
(defn login-data [params]
34+
(let [screen-name (params "screen_name") password (params "password")]
35+
(not (nil? (seq (model/find-by-screen-name-password screen-name password))))))
36+

‎src/clojspace/views/about.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
<h1>About Us</h1>
3+
<p>ClojSpace is a social networking website for Compojure/Clojure enthusiasts (and whoever else shows up)</p>

‎src/clojspace/views/help.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
<h1>Help</h1>
4+
<p>This page will contain instructions and a frequently asked questions list. </p>
5+

‎src/clojspace/views/index.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1>Welcome!</h1>
2+
<p>This page will serve as the hub for users of ClojSpace!</p>
3+

‎src/clojspace/views/register.html

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<h2>Register</h2>
2+
<fieldset>
3+
<legend>Enter Your Details</legend>
4+
<div class="form_row">
5+
<form action="/register" method="post">
6+
<label for="screen_name">Screen name:</label>
7+
<input type="textfield" name="screen_name"><br />
8+
</div>
9+
<div class="form_now">
10+
<label for="email">Email:</label>
11+
<input type="textfield" name="email"><br />
12+
</div>
13+
<div class="form_now">
14+
<label for="password">Password:</label>
15+
<input type="password" name="password">
16+
</div>
17+
<div class="form_now">
18+
<input type="submit" value="Register">
19+
</div>
20+
</fieldset>
21+

‎src/clojspace/views/site.css

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
body {
2+
font-family: sans-serif;
3+
background: gray;
4+
margin: 0;
5+
text-align: center;
6+
}
7+
#whole_page {
8+
width: 50em;
9+
margin: auto;
10+
padding: 0;
11+
text-align: left;
12+
border-width: 0 1px 1px 1px;
13+
border-color: black;
14+
border-style: solid;
15+
}
16+
#header {
17+
color: white;
18+
background: maroon;
19+
font-size: 24pt;
20+
padding: 0.25em;
21+
margin-bottom: 0;
22+
}
23+
#nav {
24+
color: black;
25+
font-size: 12pt;
26+
font-weight: bold;
27+
background: #ccc;
28+
padding: 0.5em;
29+
}
30+
#nav a, #nav a:visited {
31+
color: maroon;
32+
text-decoration: none;
33+
}
34+
#nav a:hover {
35+
border-bottom: 2px dotted maroon;
36+
}
37+
#conten {
38+
height: 100%;
39+
background: white;
40+
padding: 1em;
41+
}
42+
#conten h1 {
43+
font-size: 18pt;
44+
}
45+
46+
.fieldWithErrors {
47+
margin: 2px;
48+
padding: 2px;
49+
background-color: red;
50+
display: table;
51+
}
52+
#errorExplanation {
53+
border: 2px solid red;
54+
padding: 7px;
55+
padding-bottom: 12px;
56+
margin-bottom: 20px;
57+
background-color: #f0f0f0;
58+
}
59+
#errorExplanation h2 {
60+
text-align: left;
61+
font-weight: bold;
62+
padding: 5px 5px 5px 15px;
63+
font-size: 12pt;
64+
margin: -7px;
65+
background-color: #c00;
66+
color: #fff;
67+
}
68+
#errorExplanation p {
69+
color: #333;
70+
margin-bottom: 0;
71+
padding: 5px;
72+
}
73+
#errorExplanation ul li {
74+
font-size: 11pt;
75+
list-style: square;
76+
}
77+
#notice {
78+
border: 1px solid green;
79+
padding: 1em;
80+
margin: 1em;
81+
margin-bottom: 2em;
82+
background-color: lightgray;
83+
font: bold smaller sans-serif;
84+
}
85+
86+

‎src/clojspace/views/site.html

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3+
<html xmlns="http://www.w3.org/1999/xhtml">
4+
<html>
5+
<head>
6+
<title>Kool</title>
7+
<link href="site.css" rel="stylesheet" type="text/css" />
8+
</head>
9+
<body>
10+
<div id="whole_page">
11+
<div id="header"><p>ClojSpace</p></div>
12+
<div id="error-register"><p></p></div>
13+
<div id="nav">
14+
<a href="/index">Home</a>|<a href="/about">About Us</a>|<a href="/help">help</a>|<a href="/register">Register</a>
15+
</div>
16+
<div id="conten">
17+
</div>
18+
</div>
19+
</body>
20+
</html>
21+
22+
+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
body {
2+
font-family: sans-serif;
3+
background: gray;
4+
margin: 0;
5+
text-align: center;
6+
}
7+
#whole_page {
8+
width: 50em;
9+
margin: auto;
10+
padding: 0;
11+
text-align: left;
12+
border-width: 0 1px 1px 1px;
13+
border-color: black;
14+
border-style: solid;
15+
}
16+
#header {
17+
color: white;
18+
background: maroon;
19+
font-size: 24pt;
20+
padding: 0.25em;
21+
margin-bottom: 0;
22+
}
23+
#nav {
24+
color: black;
25+
font-size: 12pt;
26+
font-weight: bold;
27+
background: #ccc;
28+
padding: 0.5em;
29+
}
30+
#nav a, #nav a:visited {
31+
color: maroon;
32+
text-decoration: none;
33+
}
34+
#nav a:hover {
35+
border-bottom: 2px dotted maroon;
36+
}
37+
#conten {
38+
height: 100%;
39+
background: white;
40+
padding: 1em;
41+
}
42+
#conten h1 {
43+
font-size: 18pt;
44+
}
45+
46+
.fieldWithErrors {
47+
margin: 2px;
48+
padding: 2px;
49+
background-color: red;
50+
display: table;
51+
}
52+
#errorExplanation {
53+
border: 2px solid red;
54+
padding: 7px;
55+
padding-bottom: 12px;
56+
margin-bottom: 20px;
57+
background-color: #f0f0f0;
58+
}
59+
#errorExplanation h2 {
60+
text-align: left;
61+
font-weight: bold;
62+
padding: 5px 5px 5px 15px;
63+
font-size: 12pt;
64+
margin: -7px;
65+
background-color: #c00;
66+
color: #fff;
67+
}
68+
#errorExplanation p {
69+
color: #333;
70+
margin-bottom: 0;
71+
padding: 5px;
72+
}
73+
#errorExplanation ul li {
74+
font-size: 11pt;
75+
list-style: square;
76+
}
77+
#notice {
78+
border: 1px solid green;
79+
padding: 1em;
80+
margin: 1em;
81+
margin-bottom: 2em;
82+
background-color: lightgray;
83+
font: bold smaller sans-serif;
84+
}
85+
86+

‎static/about.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
<h1>About Us</h1>
3+
<p>ClojSpace is a social networking website for Compojure/Clojure enthusiasts (and whoever else shows up)</p>

‎static/fit.clj

Whitespace-only changes.

‎static/help.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
<h1>Help</h1>
4+
<p>This page will contain instructions and a frequently asked questions list. </p>
5+

‎static/index.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1>Welcome!</h1>
2+
<p>This page will serve as the hub for users of ClojSpace!</p>
3+

‎static/isite.html

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3+
<html xmlns="http://www.w3.org/1999/xhtml">
4+
5+
<head>
6+
<title>My first website</title>
7+
<link href="reset.css" rel="stylesheet" type="text/css" />
8+
<link href="src/clojspace/styles.css" rel="stylesheet" type="text/css" />
9+
</head>
10+
11+
<body>
12+
13+
<div id="pagewrap">
14+
<div id="header">
15+
<h1>Welcome to my new website!</h1>
16+
</div>
17+
18+
<div id="navigation">
19+
<a href="#">Link 1</a> | <a href="#">Link 2</a> | <a href="#">Link 3</a>
20+
</div>
21+
22+
<div id="content">
23+
<p>This is the content section</p>
24+
</div>
25+
26+
<div id="footer">
27+
<p>This is the footer section</p>
28+
</div>
29+
</div>
30+
31+
</body>
32+
</html>

‎static/login.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<h2>Log in</h2>
2+
<fieldset>
3+
<legend>Enter Your Details</legend>
4+
<div class="form_row">
5+
<label for="screen_name">Screen name:</label>
6+
<form action="/login" method="post">
7+
<input type="textfield" name="screen_name"><br />
8+
</div>
9+
<div class="form_row">
10+
<label for="password">Password:</label>
11+
<input type="password" name="password"><br />
12+
</div>
13+
<div class="form_row">
14+
<input type="submit" value="Login">
15+
</div>
16+
</fieldset>
17+
<p>Not a member? <a href="/register">Register now!</a> </p>

‎static/register.html

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<h2>Register</h2>
2+
<fieldset>
3+
<legend>Enter Your Details</legend>
4+
<div class="form_row">
5+
<form action="/register" method="post">
6+
<label for="screen_name">Screen name:</label>
7+
<input type="textfield" name="screen_name"><br />
8+
</div>
9+
<div class="form_now">
10+
<label for="email">Email:</label>
11+
<input type="textfield" name="email"><br />
12+
</div>
13+
<div class="form_now">
14+
<label for="password">Password:</label>
15+
<input type="password" name="password">
16+
</div>
17+
<div class="form_now">
18+
<input type="submit" value="Register">
19+
</div>
20+
</fieldset>
21+

‎static/site.css

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
body {
2+
font-family: sans-serif;
3+
background: gray;
4+
margin: 0;
5+
text-align: center;
6+
}
7+
#whole_page {
8+
width: 50em;
9+
margin: auto;
10+
padding: 0;
11+
text-align: left;
12+
border-width: 0 1px 1px 1px;
13+
border-color: black;
14+
border-style: solid;
15+
}
16+
#header {
17+
color: white;
18+
background: maroon;
19+
font-size: 24pt;
20+
padding: 0.25em;
21+
margin-bottom: 0;
22+
}
23+
#nav {
24+
color: black;
25+
font-size: 12pt;
26+
font-weight: bold;
27+
background: #ccc;
28+
padding: 0.5em;
29+
margin: 0px;
30+
}
31+
#nav a, #nav a:visited {
32+
color: maroon;
33+
text-decoration: none;
34+
}
35+
#nav a:hover {
36+
border-bottom: 2px dotted maroon;
37+
}
38+
#conten {
39+
height: 100%;
40+
background: white;
41+
padding: 1em;;
42+
}
43+
#conten h1 {
44+
font-size: 18pt;
45+
}
46+
47+
.fieldWithErrors {
48+
margin: 2px;
49+
padding: 2px;
50+
background-color: red;
51+
display: table;
52+
}
53+
#errorExplanation {
54+
border: 1px solid red;
55+
padding: 0px;
56+
padding-bottom: 0px;
57+
margin-bottom: 1px;
58+
background-color: #f0f0f0;
59+
}
60+
#errorExplanation h2 {
61+
text-align: left;
62+
font-weight: bold;
63+
padding: 5px 5px 5px 15px;
64+
font-size: 12pt;
65+
margin: -7px;
66+
background-color: #c00;
67+
color: #fff;
68+
}
69+
#errorExplanation p {
70+
color: #333;
71+
margin-bottom: 0;
72+
padding: 5px;
73+
}
74+
#errorExplanation ul li {
75+
font-size: 11pt;
76+
list-style: square;
77+
}
78+
#notice {
79+
border: 1px solid green;
80+
padding: 1em;
81+
margin: 1em;
82+
margin-bottom: 2em;
83+
background-color: lightgray;
84+
font: bold smaller sans-serif;
85+
}
86+
87+
html fieldset {
88+
position: relative;
89+
}
90+
html legend {
91+
position: absolute
92+
top: -1em;
93+
left: .5em
94+
}
95+
96+
fieldset {
97+
background: #ddd;
98+
}
99+
legend {
100+
color: white;
101+
background: maroon;
102+
padding: .4em 1em;
103+
}
104+
label {
105+
width: 10em;
106+
float: left;
107+
text-align: right;
108+
margin-right: 0.2em;
109+
display: block;
110+
}
111+
.form_row {
112+
white-space: nowrap;
113+
padding-bottom: .5em;
114+
}
115+
.submit {
116+
margin-left: 15em;
117+
}
118+
119+
#debug {
120+
margin-top: 1em;
121+
margin-left: auto;
122+
}
123+
#debug a, #debug a.visited {
124+
text-decoration: none;
125+
color: maroon;
126+
}
127+
fieldset.debug_info {
128+
text-align: left;
129+
background: #eee;
130+
}
131+
#fright {
132+
float: right;
133+
}

‎static/site.html

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3+
<html xmlns="http://www.w3.org/1999/xhtml">
4+
<html>
5+
<head>
6+
<title>Kool</title>
7+
<link href="site.css" rel="stylesheet" type="text/css" />
8+
</head>
9+
<body>
10+
<div id="whole_page">
11+
<div id="header"><p>ClojSpace</p></div>
12+
<div id="nav">
13+
<span id="fright"><a href="/register">Register</a>|<a href="/login">Login</a></span><a href="/index">Home</a>|<a href="/about">About Us</a>|<a href="/help">help</a>
14+
</div>
15+
<div id="error-message"><p></p></div>
16+
<div id="conten">
17+
<p></p>
18+
<div></div>
19+
</div>
20+
</div>
21+
</body>
22+
</html>
23+
24+

‎static/styles.css

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
body { background-color: white; font-size: 12px; }
2+
a { color: red; font-size: 12px; text-decoration: none; }
3+
a:hover { color: blue; text-decoration: underline; }
4+
h1 { font-size: 20px; border-bottom: solid 2px orange; }
5+
#header { height: 30px; }
6+
#navigation { height: 20px; }
7+
#content { height: 50px; border-top: dotted 1px black;}
8+
#footer { height: 20px; border-top: dotted 1px black; }

‎test/clojspace/core_test.clj

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(ns clojspace.core-test
2+
(:use [clojspace.core] :reload-all)
3+
(:use [clojure.test]))
4+
5+
(deftest replace-me ;; FIXME: write
6+
(is false))

‎views/clojspace/about.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
<h1>About Us</h1>
3+
<p>ClojSpace is a social networking website for Compojure/Clojure enthusiasts (and whoever else shows up)</p>

‎views/clojspace/help.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
<h1>Help</h1>
4+
<p>This page will contain instructions and a frequently asked questions list. </p>
5+

‎views/clojspace/index.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1>Welcome!</h1>
2+
<p>This page will serve as the hub for users of ClojSpace!</p>
3+

‎views/clojspace/register.html

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<h2>Register</h2>
2+
<fieldset>
3+
<legend>Enter Your Details</legend>
4+
<div class="form_row">
5+
<form action="/register" method="post">
6+
<label for="screen_name">Screen name:</label>
7+
<input type="textfield" name="screen_name"><br />
8+
</div>
9+
<div class="form_now">
10+
<label for="email">Email:</label>
11+
<input type="textfield" name="email"><br />
12+
</div>
13+
<div class="form_now">
14+
<label for="password">Password:</label>
15+
<input type="password" name="password">
16+
</div>
17+
<div class="form_now" class="submit">
18+
<input type="submit" value="Register!" >
19+
</div>
20+
</fieldset>
21+

‎views/clojspace/site.html

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict //EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3+
<html>
4+
<head>
5+
<title>Kool</title>
6+
<link type="text/css" src="/views/clojspace/stylesheets/site.css">
7+
</head>
8+
<body>
9+
<div id="whole_page">
10+
<div id="header"><p>ClojSpace</p></div>
11+
<div id="error-register"><p></p></div>
12+
<div id="nav">
13+
<a href="/site/index">Home</a>|<a href="/site/about">About Us</a>|<a href="/site/help">help</a>|<a href="/site/register">Register</a>
14+
</div>
15+
<div id="content"><p></p>
16+
</div>
17+
</div>
18+
</body>
19+
</html>

‎views/clojspace/stylesheets/site.css

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
body {
2+
font-family: sans-serif;
3+
background: gray;
4+
margin: 0;
5+
text-align: center;
6+
}
7+
#whole_page {
8+
width: 50em;
9+
margin: auto;
10+
padding: 0;
11+
text-align: left;
12+
border-width: 0 1px 1px 1px;
13+
border-color: black;
14+
border-style: solid;
15+
}
16+
#header {
17+
color: white;
18+
background: maroon;
19+
font-size: 24pt;
20+
padding: 0.25em;
21+
margin-bottom: 0;
22+
}
23+
#nav {
24+
color: black;
25+
font-size: 12pt;
26+
font-weight: bold;
27+
background: #ccc;
28+
padding: 0.5em;
29+
}
30+
#nav a, #nav a:visited {
31+
color: maroon;
32+
text-decoration: none;
33+
}
34+
#nav a:hover {
35+
border-bottom: 2px dotted maroon;
36+
}
37+
#content {
38+
height: 100%;
39+
background: white;
40+
padding: 1em;
41+
}
42+
#content h1 {
43+
font-size: 18pt;
44+
}
45+
46+
.fieldWithErrors {
47+
margin: 2px;
48+
padding: 2px;
49+
background-color: red;
50+
display: table;
51+
}
52+
#errorExplanation {
53+
border: 2px solid red;
54+
padding: 7px;
55+
padding-bottom: 12px;
56+
margin-bottom: 20px;
57+
background-color: #f0f0f0;
58+
}
59+
#errorExplanation h2 {
60+
text-align: left;
61+
font-weight: bold;
62+
padding: 5px 5px 5px 15px;
63+
font-size: 12pt;
64+
margin: -7px;
65+
background-color: #c00;
66+
color: #fff;
67+
}
68+
#errorExplanation p {
69+
color: #333;
70+
margin-bottom: 0;
71+
padding: 5px;
72+
}
73+
#errorExplanation ul li {
74+
font-size: 11pt;
75+
list-style: square;
76+
}
77+
#notice {
78+
border: 1px solid green;
79+
padding: 1em;
80+
margin: 1em;
81+
margin-bottom: 2em;
82+
background-color: lightgray;
83+
font: bold smaller sans-serif;
84+
}
85+
86+

0 commit comments

Comments
 (0)
Please sign in to comment.