Skip to content

Commit

Permalink
[dataset/view,template][s]: several minor improvements to dataset vie…
Browse files Browse the repository at this point in the history
…w (e.g. say if no resources, and display resource heading etc).

* correct annakarenina notes json to have line endings.
  • Loading branch information
rgrp committed Jul 28, 2011
1 parent dea0e08 commit 777a280
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
13 changes: 13 additions & 0 deletions app/css/ckanjs.css
Expand Up @@ -71,6 +71,19 @@ ul.actions li {
margin-bottom: 10px;
}

.subsection {
margin-top: 15px;
}

.subsection > h3 {
font-size: 1.9em;
margin-bottom: 0.5em;
}

.notes-body h1, .notes-body h2, .notes-body h3, .notes-body h4, .notes-body h5 {
font-size: 120%;
}

/****************************************
* Config
***************************************/
Expand Down
11 changes: 7 additions & 4 deletions lib/template/dataset-view.js
@@ -1,7 +1,7 @@
CKAN.Templates.datasetView = ' \
<div class="dataset view" dataset-id="${dataset.id}"> \
<div class="extract"> \
{{html dataset.snippet}} \
${dataset.snippet} \
<a href="#anchor-notes">Read more</a> \
</div> \
<div class="tags"> \
Expand All @@ -14,7 +14,6 @@ CKAN.Templates.datasetView = ' \
{{/if}} \
</div> \
<div class="resources subsection"> \
{{if dataset.resources.length }} \
<h3>Resources</h3> \
<table> \
<tr> \
Expand All @@ -33,16 +32,20 @@ CKAN.Templates.datasetView = ' \
<td>${$value.format}</td> \
</tr> \
{{/each}} \
{{if !dataset.resources.length }} \
<tr><td>No resources.</td><td></td></tr> \
{{/if}} \
</table> \
{{/if}} \
<div class="add-resource"> \
<a href="#" class="action-add-resource">Add a resource</a> \
<div class="add-resource-form"></div> \
</div> \
</div> \
<div class="notes subsection"> \
<h3 id="anchor-notes">Notes</h3> \
{{html dataset.notesHtml}} \
<div class="notes-body"> \
{{html dataset.notesHtml}} \
</div> \
</div> \
<div class="details subsection"> \
<h3>Additional Information</h3> \
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures.js
Expand Up @@ -78,7 +78,7 @@ var datasets = [
license: "OKD Compliant::Other (Open)",
notes_rendered: "<p>Some test notes </p> <h3>A 3rd level heading</h3> <p><strong>Some bolded text.</strong> </p> <p><em>Some italicized text.</em> </p> <p>Foreign characters: u with umlaut ü 66-style quote “ foreign word: thümb </p> <p>Needs escaping: left arrow &lt; </p> <p><a href=\"http://ckan.net/\">http://ckan.net/</a> </p>",
url: "http://www.annakarenina.com",
notes: "Some test notes ### A 3rd level heading **Some bolded text.** *Some italicized text.* Foreign characters: u with umlaut ü 66-style quote “ foreign word: thümb Needs escaping: left arrow < <http://ckan.net/> ",
notes: "Some test notes\n\n### A 3rd level heading\n\n**Some bolded text.** *Some italicized text.* Foreign characters: u with umlaut ü 66-style quote “ foreign word: thümb Needs escaping: left arrow < <http://ckan.net/> ",
title: "A Novel By Tolstoy",
ratings_average: null,
extras: {
Expand Down

0 comments on commit 777a280

Please sign in to comment.