implement noscript site pages

This commit is contained in:
j 2012-01-15 21:14:41 +05:30 committed by rolux
parent d0ef7a6c17
commit dabbc37252
2 changed files with 17 additions and 3 deletions

View file

@ -24,9 +24,23 @@ def intro(request):
return render_to_response('intro.html', context) return render_to_response('intro.html', context)
def index(request): def index(request):
title = settings.SITENAME
text = settings.CONFIG['site']['description']
page = request.path.split('/')
if len(page) == 2:
page = page[1]
else:
page = ''
for p in settings.CONFIG['sitePages']:
if p['id'] == page:
title += ' - ' + p['title']
text, created = models.Page.objects.get_or_create(name=page)
text = text.body
context = RequestContext(request, { context = RequestContext(request, {
'base_url': request.build_absolute_uri('/'), 'base_url': request.build_absolute_uri('/'),
'settings': settings, 'settings': settings,
'text': text,
'title': title,
}) })
return render_to_response('index.html', context) return render_to_response('index.html', context)

View file

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>{{settings.SITENAME}}</title> <title>{{title}}</title>
<link rel="shortcut icon" type="image/png" href="/static/png/icon16.png"/> <link rel="shortcut icon" type="image/png" href="/static/png/icon16.png"/>
<link rel="icon" href="/static/png/icon64.png" sizes="32x32"/> <link rel="icon" href="/static/png/icon64.png" sizes="32x32"/>
<link rel="icon" href="/static/png/icon64.png" sizes="48x48"/> <link rel="icon" href="/static/png/icon64.png" sizes="48x48"/>
@ -27,8 +27,8 @@
</head> </head>
<body> <body>
<noscript> <noscript>
<h1>{{settings.SITENAME}}</h1> <h1>{{title}}</h1>
<p>{{settings.CONFIG.site.description|safe}}</p> <p>{{text|safe}}</p>
<p>{{settings.SITENAME}} requires JavaScript</p> <p>{{settings.SITENAME}} requires JavaScript</p>
</noscript> </noscript>
</body> </body>