Skip to content

Commit

Permalink
Merge branch 'feature-2442-demo-dataset-view' into feature-2375-demo-…
Browse files Browse the repository at this point in the history
…theme
  • Loading branch information
aron committed May 29, 2012
2 parents edb9cd9 + d91ab06 commit 323085c
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 16 deletions.
Binary file added ckan/public/base/images/ckan.ico
Binary file not shown.
Binary file modified ckan/public/base/images/sprite-resource-icons.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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;
}
11 changes: 10 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,16 @@
font-weight: bold;
}

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

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

.resource-item .description {
font-size: 12px;
}
Expand Down
67 changes: 67 additions & 0 deletions ckan/public/base/less/icons.less
Expand Up @@ -10,6 +10,10 @@
@large-y: 20px;
@large-offset-x: -@large-x;
@large-offset-y: -@small-y - @medium-y;
@format-medium-x: 32px;
@format-medium-y: 35px;
@format-medium-offset-x: -@format-medium-x;
@format-medium-offset-y: -62px;

.ckan-icon {
.ie7-restore-right-whitespace;
Expand Down Expand Up @@ -72,3 +76,66 @@
.ckan-icon-star { .ckan-icon-background-position(11, "large") }
.ckan-icon-info-flat { .ckan-icon-background-position(12, "large") }
.ckan-icon-tag { .ckan-icon-background-position(13, "large") }

// RESOURCE FORMAT ICONS

.format-label {
.ckan-icon;

text-indent: -900em;
background: url("@{image-path}/sprite-resource-icons.png") no-repeat 0 0;
}

.format-label {
.ckan-icon-background-position(0, "format-medium");
}

.format-label[data-format=rdf],
.format-label[data-format*=rdf] {
.ckan-icon-background-position(1, "format-medium");
}

.format-label[data-format=pdf],
.format-label[data-format*=pdf] {
.ckan-icon-background-position(2, "format-medium");
}

.format-label[data-format=api],
.format-label[data-format*=api] {
.ckan-icon-background-position(3, "format-medium");
}

.format-label[data-format=zip],
.format-label[data-format*=zip] {
.ckan-icon-background-position(4, "format-medium");
}

.format-label[data-format=xls],
.format-label[data-format*=xls] {
.ckan-icon-background-position(5, "format-medium");
}

.format-label[data-format=csv],
.format-label[data-format*=csv] {
.ckan-icon-background-position(6, "format-medium");
}

.format-label[data-format=txt],
.format-label[data-format*=txt] {
.ckan-icon-background-position(7, "format-medium");
}

.format-label[data-format=xml],
.format-label[data-format*=xml] {
.ckan-icon-background-position(8, "format-medium");
}

.format-label[data-format=json],
.format-label[data-format*=json] {
.ckan-icon-background-position(9, "format-medium");
}

.format-label[data-format=html],
.format-label[data-format*=html] {
.ckan-icon-background-position(10, "format-medium");
}
12 changes: 12 additions & 0 deletions ckan/public/base/less/module.less
Expand Up @@ -105,3 +105,15 @@
padding-right: @gutter-small-x;
}
}

// GROUP

.group .content img {
margin: 0 -5px 5px;
max-width: initial;
}

.group .content h3 {
font-size: 14px;
line-height: 1.3;
}
1 change: 1 addition & 0 deletions ckan/templates/base.html
Expand Up @@ -12,6 +12,7 @@
<title py:with="title = list(select('title/text()'))">
<py:if test="title">${title} - </py:if>CKAN
</title>
<link rel="shortcut icon" href="/base/images/ckan.ico" />
<link rel="stylesheet/less" href="/base/less/main.less" />
<script src="/base/test/vendor/less.js"></script>
${select('*[local-name()!="title"]')}
Expand Down
42 changes: 27 additions & 15 deletions ckan/templates/package/read.html
Expand Up @@ -21,7 +21,7 @@
</ul>
</nav>

<div class="primary test" data-cake="test">
<div class="primary">
<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 @@ -37,29 +37,32 @@ <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>
<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="">
<!-- 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">
<section class="tags content" py:if="len(c.pkg_dict.tags)">
${h.snippet('snippets/tag_list.html', tags=c.pkg_dict.tags)}
</section>
<section class="content additional-info">
Expand Down Expand Up @@ -121,6 +124,15 @@ <h3>Additional Info</h3>
</div>

<aside class="secondary">
<!--! TODO: Check to see if the resource has a group and display it. -->
<section class="module info group" py:if="True">
<div class="content">
<img src="http://placehold.it/200x125" width="200" height="125" />
<h3>Group name here</h3>
<p>Description text here…</p>
</div>
</section>

<section class="module subscribe">
<h2 class="heading"><i class="ckan-icon ckan-icon-add"></i> Subscribe</h2>
<ul class="nav nav-simple">
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 323085c

Please sign in to comment.