mirror of
https://github.com/postgres/pgweb.git
synced 2025-07-25 16:02:27 +00:00
Add a template context processor that sets link_root on all secure requests,
so that we can generate proper linkbacks to the non-secure version of the site for all static content.
This commit is contained in:
@ -70,6 +70,12 @@ TEMPLATE_DIRS = (
|
||||
'../templates/',
|
||||
)
|
||||
|
||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
'django.core.context_processors.auth',
|
||||
'django.core.context_processors.media',
|
||||
'util.contexts.RootLinkContextProcessor',
|
||||
)
|
||||
|
||||
LOGIN_URL='/account/login/'
|
||||
LOGIN_REDIRECT_URL='/account/'
|
||||
LOGOUT_URL='/account/logout/'
|
||||
@ -95,6 +101,8 @@ INSTALLED_APPS = [
|
||||
]
|
||||
|
||||
|
||||
SITE_ROOT="http://www.postgresql.org"
|
||||
|
||||
# Load local settings overrides
|
||||
from settings_local import *
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
from django.template import RequestContext
|
||||
from django.conf import settings
|
||||
|
||||
# This is the whole site navigation structure. Stick in a smarter file?
|
||||
sitenav = {
|
||||
@ -88,3 +89,13 @@ class NavContext(RequestContext):
|
||||
navsection = {}
|
||||
self.update({'navmenu': navsection})
|
||||
|
||||
|
||||
# Template context processor to add information about the root link
|
||||
def RootLinkContextProcessor(request):
|
||||
if request.is_secure():
|
||||
return {
|
||||
'link_root': settings.SITE_ROOT,
|
||||
}
|
||||
else:
|
||||
return {}
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
<link rel="shortcut icon" href="/favicon.ico" />
|
||||
<style type="text/css" media="screen" title="Normal Text">@import url("/media/css/base.css");</style>
|
||||
<style type="text/css" media="screen" title="Normal Text">@import url("/media/css/geckofixes.css");</style>
|
||||
<link rel="alternate" type="application/rss+xml" title="PostgreSQL News" href="/feeds/news/" />
|
||||
<link rel="alternate" type="application/rss+xml" title="PostgreSQL Events" href="/feeds/events/" />
|
||||
<link rel="alternate" type="application/rss+xml" title="PostgreSQL News" href="{{link_root}}/feeds/news/" />
|
||||
<link rel="alternate" type="application/rss+xml" title="PostgreSQL Events" href="{{link_root}}/feeds/events/" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="pgContainerWrap">
|
||||
@ -27,14 +27,14 @@
|
||||
<div id="pgTopNavLeft"><img width="7" height="23" alt="" src="/media/img/layout/nav_lft.png" /></div>
|
||||
<div id="pgTopNavRight"><img width="7" height="23" alt="" src="/media/img/layout/nav_rgt.png" /></div>
|
||||
<ul id="pgTopNavList">
|
||||
<li><a href="/" title="Home">Home</a></li>
|
||||
<li><a href="/about" title="About">About</a></li>
|
||||
<li><a href="/download" title="Download">Download</a></li>
|
||||
<li><a href="/docs" title="Documentation">Documentation</a></li>
|
||||
<li><a href="/community" title="Community">Community</a></li>
|
||||
<li><a href="/developer" title="Developers">Developers</a></li>
|
||||
<li><a href="/support" title="Support">Support</a></li>
|
||||
<li><a href="/account" title="Your account">Your account</a></li>
|
||||
<li><a href="{{link_root}}/" title="Home">Home</a></li>
|
||||
<li><a href="{{link_root}}/about" title="About">About</a></li>
|
||||
<li><a href="{{link_root}}/download" title="Download">Download</a></li>
|
||||
<li><a href="{{link_root}}/docs" title="Documentation">Documentation</a></li>
|
||||
<li><a href="{{link_root}}/community" title="Community">Community</a></li>
|
||||
<li><a href="{{link_root}}/developer" title="Developers">Developers</a></li>
|
||||
<li><a href="{{link_root}}/support" title="Support">Support</a></li>
|
||||
<li><a href="{{link_root}}/account" title="Your account">Your account</a></li>
|
||||
</ul>
|
||||
</div> <!-- pgTopNav -->
|
||||
</div> <!-- pgHeaderContainer -->
|
||||
@ -43,8 +43,8 @@
|
||||
<br class="pgClearBoth" />
|
||||
</div> <!-- pgContent -->
|
||||
<div id="pgFooter">
|
||||
<a class="navFooter" href="/about/privacypolicy">Privacy Policy</a> |
|
||||
<a class="navFooter" href="/about/website">About the website</a><br/>
|
||||
<a class="navFooter" href="{{link_root}}/about/privacypolicy">Privacy Policy</a> |
|
||||
<a class="navFooter" href="{{link_root}}/about/website">About the website</a><br/>
|
||||
Copyright © 1996-2009 PostgreSQL Global Development Group
|
||||
</div> <!-- pgFooter -->
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user