Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2375] Start work on the package search results page
Still very much a work in progress but the base templates are in there and facets have been moved into snippets.
- Loading branch information
Showing
5 changed files
with
154 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!--! | ||
Generate <li>s for facet items. The generated tags are not wrapped by any | ||
other tag, ie - it's up to the caller to wrap them in something suitable. | ||
item | ||
The facet item itself. | ||
label_function | ||
Renders the human-readable label for each facet value. | ||
If defined, this should be a callable that accepts a `facet_item`. | ||
eg. lambda facet_item: facet_item.display_name.upper() | ||
By default it displays the facet item's display name, which should | ||
usually be good enough. | ||
count_label | ||
A callable which accepts an integer, and returns a string. This controls | ||
how a facet-item's count is displayed. | ||
--> | ||
<li> | ||
<a href="${c.drill_down_url(**{name: item.name})}"> | ||
${label_function(item) if vars().has_key('label_function') else item.display_name} | ||
${count_label(item['count']) if vars().has_key('count_label') else ('(%d)' % item['count'])} | ||
</a> | ||
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!--! | ||
Construct a facet module populated with links to filtered results. | ||
name | ||
The field name identifying the facet field, eg. "tags" | ||
title | ||
The title of the facet, eg. "Tags", or "Tag Cloud" | ||
label_function | ||
Renders the human-readable label for each facet value. | ||
If defined, this should be a callable that accepts a `facet_item`. | ||
eg. lambda facet_item: facet_item.display_name.upper() | ||
By default it displays the facet item's display name, which should | ||
usually be good enough | ||
if_empty | ||
A string, which if defined, and the list of possible facet items is empty, | ||
is displayed in lieu of an empty list. | ||
count_label | ||
A callable which accepts an integer, and returns a string. This controls | ||
how a facet-item's count is displayed. | ||
--> | ||
<section class="module" xmlns:py="http://genshi.edgewall.org/"> | ||
<h2 class="heading">${h.facet_title(title)}</h2> | ||
<nav> | ||
<ul class="unstyled nav nav-simple"> | ||
<py:for each="item in h.unselected_facet_items(name, 10)"> | ||
${h.snippet('snippets/facet_item.html', name=name, item=item)} | ||
</py:for> | ||
</ul> | ||
</nav> | ||
<p class="footer">View all</p> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<ul class="dataset-list unstyled" xmlns:py="http://genshi.edgewall.org/"> | ||
<li py:for="package in packages" class="dataset-item"> | ||
<h3 class="heading"> | ||
${h.link_to(package.get('title') or package.get('name'), h.url_for(controller='package', action='read', id=package.get('name')))} | ||
</h3> | ||
<py:if test="package.resources"> | ||
<ul class="dataset-resources unstyled"> | ||
<py:for each="resource in package.resources"> | ||
<li py:if="resource.get('format')"> | ||
<a href="${resource.get('url')}" class="label resource-url-analytics" title="${resource.get('description')}">${resource.get('format')}</a> | ||
</li> | ||
</py:for> | ||
</ul> | ||
</py:if> | ||
<div class="content"> | ||
${h.markdown_extract(package.notes)} | ||
</div> | ||
</li> | ||
</ul> |
@tobes I need this span with the facet group to only display once for each group.
At the moment
c.fields
is a tuple of fields and keys eg.Perhaps this should be reformatted to be.