Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadomir Dopieralski <hatta-dev@sheep.art.pl>2010-11-10 22:20:04 (GMT)
committer Radomir Dopieralski <hatta-dev@sheep.art.pl>2010-11-10 22:20:04 (GMT)
commitd8e2ac13847d1a1d20bef9db6709c22c40e25c94 (patch)
treea153d65605e9153406c125b4b840f606212e866e
parentbf5cd4a9b87ae8cc8e491b544c15faa02e4033a8 (diff)
split header blocks
-rw-r--r--hatta/page.py45
-rw-r--r--hatta/templates/layout.html15
-rw-r--r--hatta/templates/page.html17
-rw-r--r--hatta/wiki.py2
4 files changed, 50 insertions, 29 deletions
diff --git a/hatta/page.py b/hatta/page.py
index ecaab86..44e0b86 100644
--- a/hatta/page.py
+++ b/hatta/page.py
@@ -215,25 +215,13 @@ class WikiPage(object):
def footer_links(self, special_title, edit_url):
_ = self.wiki.gettext
- if special_title:
- footer_links = [
- (_(u'Changes'), 'changes',
- self.get_url(None, self.wiki.recent_changes)),
- (_(u'Index'), 'index',
- self.get_url(None, self.wiki.all_pages)),
- (_(u'Orphaned'), 'orphaned',
- self.get_url(None, self.wiki.orphaned)),
- (_(u'Wanted'), 'wanted',
- self.get_url(None, self.wiki.wanted)),
- ]
- else:
- footer_links = [
- (_(u'Edit'), 'edit', edit_url),
- (_(u'History'), 'history',
- self.get_url(self.title, self.wiki.history)),
- (_(u'Backlinks'), 'backlinks',
- self.get_url(self.title, self.wiki.backlinks))
- ]
+ footer_links = [
+ (_(u'Edit'), 'edit', edit_url),
+ (_(u'History'), 'history',
+ self.get_url(self.title, self.wiki.history)),
+ (_(u'Backlinks'), 'backlinks',
+ self.get_url(self.title, self.wiki.backlinks))
+ ]
return footer_links
def template(self, template_name, **kwargs):
@@ -327,6 +315,25 @@ class WikiPage(object):
dependencies.add(etag)
return dependencies
+
+class WikiPageSpecial(WikiPage):
+ """Special pages, like recent changes, index, etc."""
+
+ def footer_links(self, special_title, edit_url):
+ _ = self.wiki.gettext
+ footer_links = [
+ (_(u'Changes'), 'changes',
+ self.get_url(None, self.wiki.recent_changes)),
+ (_(u'Index'), 'index',
+ self.get_url(None, self.wiki.all_pages)),
+ (_(u'Orphaned'), 'orphaned',
+ self.get_url(None, self.wiki.orphaned)),
+ (_(u'Wanted'), 'wanted',
+ self.get_url(None, self.wiki.wanted)),
+ ]
+ return footer_links
+
+
class WikiPageText(WikiPage):
"""Pages of mime type text/* use this for display."""
diff --git a/hatta/templates/layout.html b/hatta/templates/layout.html
index cf30cc3..9754cdc 100644
--- a/hatta/templates/layout.html
+++ b/hatta/templates/layout.html
@@ -3,14 +3,17 @@
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>{% block title %}{% endblock %}</title>
-{% block links %}{% endblock %}
-{% block meta %}{% endblock %}
+ {% block links %}{% endblock %}
+ {% block meta %}{% endblock %}
</head><body><div id="hatta-header">
-{% block header %}{% endblock %}
+ {% block logo %}{% endblock %}
+ {% block search %}{% endblock %}
+ {% block menu %}{% endblock %}
+ {% block page_title %}{% endblock %}
</div><div id="hatta-content">
-{% block content %}{% endblock %}
+ {% block content %}{% endblock %}
<div id="hatta-footer">
-{% block footer %}{% endblock %}
+ {% block footer %}{% endblock %}
</div></div>
-{% block scripts %}{% endblock %}
+ {% block scripts %}{% endblock %}
</body></html>
diff --git a/hatta/templates/page.html b/hatta/templates/page.html
index 837b783..ee16486 100644
--- a/hatta/templates/page.html
+++ b/hatta/templates/page.html
@@ -31,7 +31,7 @@
{% endif %}
{% endblock %}
-{% block header %}
+{% block logo %}
{% if wiki.logo_page in page.storage %}
<a id="hatta-logo"
href="{{ url(wiki.front_page) }}"><img
@@ -39,15 +39,26 @@
alt="[{{ wiki.logo_page }}]"
></a>
{% endif %}
+{% endblock %}
+
+{% block search %}
<form action="/+search" id="hatta-search" method="GET"
><div><input
id="hatta-search" name="q"><input
class="button" type="submit" value="Search"
- ></div></form><div id="hatta-menu">
+ ></div></form>
+{% endblock %}
+
+{% block menu %}
+ <div id="hatta-menu">
{% for part in page.menu() %}
{{ part|safe }}
{% endfor %}
- </div><h1>{{ special_title or title }}</h1>
+ </div>
+{% endblock %}
+
+{% block page_title %}
+ <h1>{{ special_title or title }}</h1>
{% endblock %}
{% block content %}{% for part in content %}{{ part|safe }}{% endfor %}{% endblock %}
diff --git a/hatta/wiki.py b/hatta/wiki.py
index bfd7789..1e2dfa8 100644
--- a/hatta/wiki.py
+++ b/hatta/wiki.py
@@ -292,7 +292,7 @@ class Wiki(object):
except KeyError:
page_class = self.mime_map['']
else:
- page_class = page.WikiPage
+ page_class = page.WikiPageSpecial
mime = ''
return page_class(self, request, title, mime)