Skip to content

Commit

Permalink
[#1583][l]: Moving template changes into ckanext-qa. Keeping core fun…
Browse files Browse the repository at this point in the history
…ctionality (eg. hover-help).
  • Loading branch information
teajaymars committed Jan 25, 2012
1 parent 274dd05 commit 46018fb
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 42 deletions.
26 changes: 1 addition & 25 deletions ckan/lib/helpers.py
Expand Up @@ -20,7 +20,7 @@
from routes import url_for, redirect_to
from alphabet_paginate import AlphaPage
from lxml.html import fromstring
from i18n import get_available_locales, _
from i18n import get_available_locales



Expand Down Expand Up @@ -338,30 +338,6 @@ def resource_display_name(resource_dict):
else:
return '[no name] %s ' % resource_dict['id']

def resource_star_rating(resource_dict):
stars = 0 if ('index' in resource_dict.get('url')) else 3

if stars==0:
message = _('When we last checked, this resource was not available.'),
return literal('<span class="hover-for-help semi-link"><span class="help-text">%s</span>404?</span>' % message)

captions = [
_('Available under an open license.'),
_('Available as structured data (eg. Excel instead of a scanned table).'),
_('Uses non-proprietary formats (e.g., CSV instead of Excel).'),
_('Uses URIs to identify things, so that people can link to it.'),
_('Linked to other data to provide context.')
]

caption = ""
for i in range(5,0,-1):
fail = 'fail' if (i > stars) else ''
text_stars = i * '&#9733'
caption += literal('<span class="%s">%s&nbsp; "%s"</span>' % (fail, text_stars, captions[i-1]))

star_icons = stars * icon('star')
return literal('<span class="hover-for-help"><span class="help-text">%s</span><a href="http://lab.linkeddata.deri.ie/2010/star-scheme-by-example/" target="_blank">%s</a></span>' % (caption, star_icons))

def resource_link(resource_dict, package_id):
text = resource_display_name(resource_dict)
url = url_for(controller='package',
Expand Down
11 changes: 2 additions & 9 deletions ckan/public/css/style.css
Expand Up @@ -212,7 +212,7 @@ tbody tr.table-empty td {
}
.hover-for-help > .help-text {
position: absolute;
top: 18px;
top: 24px;
left: -90px;
display: none;
padding: 2px 8px;
Expand All @@ -237,6 +237,7 @@ tbody tr.table-empty td {
border-bottom: 1px dashed #000;
}


/* =============== */
/* MinorNavigation */
/* =============== */
Expand Down Expand Up @@ -1170,14 +1171,6 @@ body.package.read h3 {
opacity:0.4;
filter:alpha(opacity=40); /* For IE8 and earlier */
}
.search-result .star-rating {
display: block;
padding-top: 5px;
text-align: right;
}
.search-result .hover-for-help {
font-size: 11px;
}
.search-result .view-more-link:hover {
opacity:1.0;
filter:alpha(opacity=100); /* For IE8 and earlier */
Expand Down
1 change: 0 additions & 1 deletion ckan/public/scripts/application.js
Expand Up @@ -8,7 +8,6 @@
CKAN.Utils.setupFormatAutocomplete($(this));
});
CKAN.Utils.setupMarkdownEditor($('.markdown-editor'));

// set up ckan js
var config = {
endpoint: CKAN.SITE_URL + '/'
Expand Down
5 changes: 1 addition & 4 deletions ckan/templates/package/read_core.html
Expand Up @@ -18,12 +18,9 @@
<div id="dataset-resources" class="resources subsection">
<h3>Resources</h3>
<py:for each="res in c.pkg_dict.get('resources', [])">
<div class="search-result">
<div class="search-result" id="${res['id']}">
<p class="extra-links">
<a class="view-more-link" href="${h.url_for(controller='package', action='resource_read', id=c.pkg_dict['name'], resource_id=res['id'])}">View</a>
<span class="star-rating">
${h.resource_star_rating(res)}
</span>
</p>
<a class="main-link" href="${h.url_for(controller='package', action='resource_read', id=c.pkg_dict['name'], resource_id=res['id'])}">${h.resource_display_name(res)}</a>
&nbsp;&nbsp;
Expand Down
4 changes: 1 addition & 3 deletions ckan/templates/package/resource_read.html
Expand Up @@ -45,7 +45,7 @@
</a>
</div>

<div class="quick-info .span-8">
<div class="quick-info">
<dl>
<dt>Part of dataset</dt>
<dd>
Expand Down Expand Up @@ -77,8 +77,6 @@
</span>
</py:if>
</dd>
<dt>Quality</dt>
<dd>${h.resource_star_rating(c.resource)}</dd>
</dl>
</div>

Expand Down

0 comments on commit 46018fb

Please sign in to comment.