Skip to content

Commit

Permalink
Merge pull request #58 from okfn/2650-markdown-resource-description
Browse files Browse the repository at this point in the history
Fixed missing markdown on the resource read page.
  • Loading branch information
johnglover committed Jul 10, 2012
2 parents 5d13781 + 870f980 commit d57be83
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ckan/controllers/package.py
Expand Up @@ -772,6 +772,11 @@ def resource_read(self, id, resource_id):
c.datastore_api = h.url_for('datastore_read', id=c.resource.get('id'),
qualified=True)

c.resource_desc_formatted = ckan.misc.MarkdownFormat().to_html(
c.resource.get('description',''))
c.pkg_notes_formatted = ckan.misc.MarkdownFormat().to_html(
c.package.get('notes',''))

c.related_count = len(c.pkg.related)
return render('package/resource_read.html')

Expand Down
10 changes: 6 additions & 4 deletions ckan/templates/package/resource_read.html
Expand Up @@ -126,19 +126,21 @@
</dl>
</div>

<div class="notes" property="rdfs:label">
<div class="notes" property="rdfs:label" py:if="c.resource_desc_formatted">
<div id="notes-extract">
${c.resource.get('description') or '(No description)'}
${ Markup(c.resource_desc_formatted) }
</div>
</div>

<div py:if="not c.resource.get('description') and c.package.get('notes')" id="dataset-description">
<div py:if="not c.resource_desc_formatted and c.pkg_notes_formatted">
<div>
<strong i18n:msg="">
From the <a href="${h.url_for(controller='package', action='read', id=c.package['name'])}">Dataset</a>:
</strong>
</div>
<div>${h.markdown_extract(c.package.get('notes'), 300)}</div>
<div class="notes">
<div id="notes-extract">${ Markup(c.pkg_notes_formatted)}</div>
</div>
</div>

<div class="resource-preview">
Expand Down

0 comments on commit d57be83

Please sign in to comment.