Skip to content

Commit

Permalink
[2442] Add resource icons to dataset overview page
Browse files Browse the repository at this point in the history
  • Loading branch information
aron committed May 29, 2012
1 parent a6338c5 commit f28dfbe
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
7 changes: 6 additions & 1 deletion ckan/public/base/less/dataset.less
Expand Up @@ -123,7 +123,6 @@
position: relative;
padding-left: 40px;
padding-right: 110px; // Should really use ems here.
background: url("@{image-path}/sprite-resource-icons.png") no-repeat -1px 2px;
}

.resource-item .heading {
Expand All @@ -132,6 +131,12 @@
font-weight: bold;
}

.resource-item .format-label {
position: absolute;
top: 0;
left: 0;
}

.resource-item .description {
font-size: 12px;
}
Expand Down
24 changes: 13 additions & 11 deletions ckan/templates/package/read.html
Expand Up @@ -37,26 +37,28 @@ <h1>${c.pkg_dict.title or c.pkg_dict.name}</h1>
</section>

<section id="dataset-resources" class="resources content">
<h3>Resources</h3>
<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-box" property="dc:format">${res.format}</span>
<span py:if="res.format" class="format-label" property="dc:format" data-format="${res.format.lower()}">${res.format}</span>
</a>
<p class="description"><py:choose test="">
<!-- only show description if name is given as we show
the description for the name if none is given -->
<py:if test="res.name">
${h.markdown_extract(res.description, extract_length=80)}
</py:if>
<py:otherwise>&nbsp;</py:otherwise>
</py:choose></p>
<p class="description">
<py:choose test="">
<!-- only show description if name is given as we show
the description for the name if none is given -->
<py:if test="res.name">
${h.markdown_extract(res.description, extract_length=80)}
</py:if>
<py:otherwise><span class="empty">No description for this resource</span></py:otherwise>
</py:choose>
</p>
<a class="btn btn-primary" href="${url}">Explore Data</a>
</li>
</ul>
<py:if test="not c.pkg_dict.resources">
(none)
<p>This dataset has no data, <a href="#">why not add some?</a></p>
</py:if>
</section>
<section class="tags content" py:if="len(c.pkg_dict.tags)">
Expand Down

0 comments on commit f28dfbe

Please sign in to comment.