Skip to content

Commit

Permalink
[2375] Update the templates to something that nearly works
Browse files Browse the repository at this point in the history
  • Loading branch information
aron committed May 11, 2012
1 parent d8f9e36 commit 044072d
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 48 deletions.
29 changes: 12 additions & 17 deletions ckan/templates/base.html
@@ -1,24 +1,19 @@
<!DOCTYPE html>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:i18n="http://genshi.edgewall.org/i18n"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip="">
<py:match path="head" once="true">
<head py:attrs="select('@*')">
<meta charset="utf-8" />
<title py:with="title = list(select('title/text()'))">
<py:if test="title">: ${title}</py:if>
</title>
<link rel="stylesheet/less" href="/base/less/main.less" />
<script src="/base/test/vendor/less.js"></script>
${select('*[local-name()!="title"]')}
</head>
</py:match>
<py:match path="body">
<body py:attrs="select('@*')">
${select("*|text()")}
</body>
</py:match>

<!--! Append all the base head elements -->
<head py:match="head">
<meta charset="utf-8" />
<!--! Append CKAN to the title -->
<title py:with="title = list(select('title/text()'))">
<py:if test="title">${title} - </py:if>CKAN
</title>
<link rel="stylesheet/less" href="/base/less/main.less" />
<script src="/base/test/vendor/less.js"></script>
${select('*[local-name()!="title"]')}
</head>
</html>
29 changes: 20 additions & 9 deletions ckan/templates/package/search.html
@@ -1,14 +1,25 @@
<!DOCTYPE html>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:i18n="http://genshi.edgewall.org/i18n"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip="">
<div py:match="content">
content
</div>
<div py:match="sidebar">
sidebar
</div>
<xi:include href="../page_sidebar.html" />
xmlns:xi="http://www.w3.org/2001/XInclude">
<!--! Include matchers nearest first -->
<xi:include href="../page.html" />
<xi:include href="sidebar.html" />

<!--! Now include the current page -->
<head>
<title>Search for a Dataset</title>
</head>
<body>
<main>
<content id="content" data-wah="">
<p>This is search content</p>
<p>Hmm</p>
</content>

</main>
</body>
</html>

12 changes: 12 additions & 0 deletions ckan/templates/package/sidebar.html
@@ -0,0 +1,12 @@
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:i18n="http://genshi.edgewall.org/i18n"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude">
<div py:match="sidebar">
${select('*|text()')}
<p>Extra Sidebar 1</p>
<p>Extra Sidebar 2</p>
<p>Extra Sidebar 3</p>
</div>
</html>
26 changes: 20 additions & 6 deletions ckan/templates/page.html
Expand Up @@ -4,10 +4,24 @@
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip="">
<body class="test">
<xi:include href="header.html" />
<main>
</main>
<xi:include href="footer.html" />
</body>
<xi:include href="base.html" />
<div py:match="main">
<!--! Import the header -->
<xi:include href="header.html" />

<!--! Wrap <content> and <sidebar> tags -->
<div class="content" py:attrs="select('content/@*')">
${select('content')}
</div>
<!--! Need an py:if here to exclude if empty. -->
<div class="sidebar" py:attrs="select('sidebar/@*')">
${select('sidebar')}
</div>

<!--! Import the footer -->
<xi:include href="footer.html" />
</div>

<div py:match="content" py:strip="" py:content="select('*|text()')" />
<div py:match="sidebar" py:strip="" py:content="select('*|text()')" />
</html>
16 changes: 0 additions & 16 deletions ckan/templates/page_sidebar.html

This file was deleted.

0 comments on commit 044072d

Please sign in to comment.