Skip to content

Commit

Permalink
[2442] Add popular badge to resources
Browse files Browse the repository at this point in the history
  • Loading branch information
aron committed May 29, 2012
1 parent f28dfbe commit cebfd29
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ckan/public/base/less/ckan.less
Expand Up @@ -21,3 +21,7 @@ body {
[hidden] {
display: none;
}

.popular {
text-indent: -999em;
}
4 changes: 4 additions & 0 deletions ckan/public/base/less/dataset.less
Expand Up @@ -131,6 +131,10 @@
font-weight: bold;
}

.resource-item .heading .popular {
top: 0;
}

.resource-item .format-label {
position: absolute;
top: 0;
Expand Down
7 changes: 4 additions & 3 deletions ckan/templates/package/read.html
Expand Up @@ -40,9 +40,10 @@ <h1>${c.pkg_dict.title or c.pkg_dict.name}</h1>
<h3>Data and Resources</h3>
<ul class="resource-list" py:if="c.pkg_dict.resources">
<li class="resource-item" py:for="res in c.pkg_dict.resources" py:with="url=h.url_for(controller='package', action='resource_read', id=c.pkg_dict['name'], resource_id=res['id'])">
<a class="heading" href="${url}" title="${res.name or res.description}">
${h.resource_display_name(res)}
<span py:if="res.format" class="format-label" property="dc:format" data-format="${res.format.lower()}">${res.format}</span>
<a class="heading" href="${url}" title="${res.name or res.description}">
${h.resource_display_name(res)}<span py:if="res.format" class="format-label" property="dc:format" data-format="${res.format.lower()}">${res.format}</span>
<!--! TODO: Correctly pass localised views into this snippet -->
<py:if test="True" py:with="title=('%s views' % 10)">${h.snippet('snippets/popular.html', title=title)}</py:if>
</a>
<p class="description">
<py:choose test="">
Expand Down
1 change: 1 addition & 0 deletions ckan/templates/snippets/popular.html
@@ -0,0 +1 @@
<span class="popular ckan-icon ckan-icon-flame" title="${title}" xmlns="http://www.w3.org/1999/xhtml">Popular</span>

0 comments on commit cebfd29

Please sign in to comment.