Skip to content

Commit

Permalink
Add an about page
Browse files Browse the repository at this point in the history
  • Loading branch information
Beat Bolli committed Nov 6, 2008
1 parent 8c3de2e commit 6b7b138
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 12 deletions.
43 changes: 43 additions & 0 deletions about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>about</title>
<style type="text/css"><!--
body {
background-color: white;
}
a {
text-decoration: none;
color: #336;
}
.n {
position: absolute;
top: 65px;
left: 10%;
color: #dcdcdc;
font-size: 120pt;
letter-spacing: -8px;
z-index: -1;
}
.t {
margin: 100px 16%;
color: #666;
font-size: 24pt;
}
.h {
text-align: center;
font-size: 175%;
}
--></style>
</head>
<body>
<p class="h"><a href="/1" title="home">/</a></p>
<div class="n">about</div>
<div class="t">
<p>original: <a href="http://cluetrain.com/">cluetrain.com</a></p>
<p>source code: <a href="http://github.com/bbolli/google-app-cluetrain/tree/master/">github.com/bbolli/google-app-cluetrain</a>
<p>blog: <a href="http://drbeat.li/">beating the one-way web</a></p>
</div>
</body>
</html>
19 changes: 16 additions & 3 deletions cluetrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,21 @@
from theses import theses


root_path = os.path.dirname(__file__)

class TemplatePage(webapp.RequestHandler):

def render(self, template_file, context={}):
self.response.out.write(template.render(
os.path.join(root_path, template_file), context
))

class RandomPage(webapp.RequestHandler):
def get(self):
n = random.randint(1, len(theses['en']))
self.redirect('/%d' % n)

class ThesisPage(webapp.RequestHandler):
index_path = os.path.join(os.path.dirname(__file__), 'index.html')
class ThesisPage(TemplatePage):
default_lang = 'en'

def get(self, n):
Expand All @@ -51,7 +59,7 @@ def get(self, n):
context['next'] = n + 1
else:
context = {'n': 404, 'thesis': 'Not found', 'prev': 1, 'next': len(th)}
self.response.out.write(template.render(self.index_path, context))
self.render('index.html', context)

def language(self):
lang = self.request.headers.get('accept-language')
Expand All @@ -68,10 +76,15 @@ def language(self):
accepted.sort(reverse=True)
return [a[1] for a in accepted]

class AboutPage(TemplatePage):
def get(self):
self.render('about.html')


application = webapp.WSGIApplication([
('/', RandomPage),
('/(\d+)', ThesisPage),
('/about', AboutPage),
], debug=False)


Expand Down
20 changes: 11 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,39 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Clue #{{ n }}</title>
<title>clue #{{ n }}</title>
<style type="text/css"><!--
body {
background-color: white;
}
a {
text-decoration: none;
color: #336;
}
.n {
position: absolute;
top: 50px;
top: 65px;
left: 10%;
color: #d8d8d8;
font-size: 120pt;
letter-spacing: -8px;
z-index: -1;
}
.t {
position: absolute;
margin: 40px 16%;
margin: 75px 16%;
color: #666;
font-size: 30pt;
}
.l {
.h {
text-align: center;
font-size: 175%;
}
.l a {
text-decoration: none;
}
--></style>
</head>
<body>
<p class="l">{% if prev %}<a href="/{{ prev }}" title="previous">«</a>
<p class="h">{% if prev %}<a href="/{{ prev }}" title="previous">«</a>
{% else %}&#x2002;{% endif %}<a href="/" title="random">*</a>
<a href="/about" title="about">?</a>
{% if next %}<a href="/{{ next }}" title="next">»</a>
{% else %}&#x2002;{% endif %}</p>
<div class="n">{{ n }}</div><div class="t">{{ thesis }}</div>
Expand Down

0 comments on commit 6b7b138

Please sign in to comment.