Skip to content

Commit

Permalink
[2375] Switched page.html template to use py:replace
Browse files Browse the repository at this point in the history
This still might not be quite right but at least seems a lot simpler
than using multiple match statements. Also updated tokens to use
semantic elements and class names. Oh, there's a toolbar in there
too now.
  • Loading branch information
aron committed May 15, 2012
1 parent b7d865a commit 8cb1b0d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
18 changes: 14 additions & 4 deletions ckan/templates/package/read.html
Expand Up @@ -9,7 +9,16 @@
<title>${c.pkg_dict.get('title', c.pkg_dict['name'])} - Datasets</title>
</head>
<body>
<primary>
<nav class="toolbar">
<ol class="breadcrumb">
<li>${h.nav_link(_('Datasets'), controller='package', action='search', highlight_actions = 'new index')}</li>
<li class="active"><a href="">${c.pkg_dict.get('title', c.pkg_dict.get('name'))}</a></li>
</ol>
<ul class="actions">
</ul>
</nav>

<div class="primary test" data-cake="test">
<div py:if="c.pkg_revision_id" class="widget info">
<p py:if="c.pkg_revision_not_latest" class="content">This is an old revision of this dataset, as edited at ${h.render_datetime(c.pkg_revision_timestamp, with_hours=True)}. It may differ significantly from the <a href="${h.url(controller='package', action='read', id=c.pkg.name)}">current revision</a>.</p>
<p py:if="not c.pkg_revision_not_latest" class="content">This is the current revision of this dataset, as edited at ${h.render_datetime(c.pkg_revision_timestamp, with_hours=True)}.</p>
Expand All @@ -24,8 +33,9 @@ <h1>${c.pkg_dict.get('title', c.pkg_dict.get('name'))}</h1>
<span class="insert-comment-thread"></span>
</section>
</article>
</primary>
<secondary>
</div>

<aside class="secondary">
<section class="module subscribe">
<h2 class="heading">Subscribe</h2>
<ul class="nav nav-simple">
Expand Down Expand Up @@ -65,6 +75,6 @@ <h2 class="heading">License</h2>
<h2 class="heading">Trackback URL</h2>
<input type="text" value="" />
</section>
</secondary>
</aside>
</body>
</html>
20 changes: 8 additions & 12 deletions ckan/templates/page.html
Expand Up @@ -5,27 +5,23 @@
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip="">
<xi:include href="base.html" />
<body py:match="body">
<!--! TODO: Work out what the py:attrs isn't excluding the class -->
<body py:match="body" py:attrs="select('@*[name()!=\'class\']')">
<!--! Import the header -->
<xi:include href="header.html" />

<div role="main">
<div class="container">
<div class="primary" py:attrs="select('primary/@*')">
${select('primary')}
</div>
<!--! Need an py:if here to exclude if empty. -->
<div class="secondary" py:attrs="select('secondary/@*')">
${select('secondary')}
</div>
<!--! Pulls in <div class="toolbar"></div> -->
<py:replace value="select('*[contains(@class, \'toolbar\')]')" />
<!--! Pulls in <div class="primary"></div> -->
<py:replace value="select('*[contains(@class, \'primary\')]')" />
<!--! Pulls in <div class="secondary"></div> -->
<py:replace value="select('*[contains(@class, \'secondary\')]')" />
</div>
</div>

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

<!--! Ensure the content tags are never included in the page. -->
<div py:match="primary" py:strip="" py:content="select('*|text()')" />
<div py:match="secondary" py:strip="" py:content="select('*|text()')" />
</html>

0 comments on commit 8cb1b0d

Please sign in to comment.