diff --git a/ckan/lib/helpers.py b/ckan/lib/helpers.py index f72d5c4efde..50b1ca92f3f 100644 --- a/ckan/lib/helpers.py +++ b/ckan/lib/helpers.py @@ -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, _ @@ -338,6 +338,17 @@ 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 + out = "" + if stars==0: + message = _('When we last checked, this resource was not available.'); + out = literal('404?' % message) + else: + for n in range(stars): + out += icon('star') + return out + def resource_link(resource_dict, package_id): text = resource_display_name(resource_dict) url = url_for(controller='package', diff --git a/ckan/public/css/style.css b/ckan/public/css/style.css index 7e768412664..33c620396f9 100644 --- a/ckan/public/css/style.css +++ b/ckan/public/css/style.css @@ -207,7 +207,29 @@ tbody tr.table-empty td { font-size: 2.2em; font-weight: normal; } - +.mouseover-help-link { + border-bottom: 1px dashed #bb2222; + position: relative; +} +.mouseover-help-link:hover { + border-bottom: 1px dashed #183661; +} +.mouseover-help-link .inner { + position: absolute; + top: 18px; + left: -30px; + display: none; + padding: 4px 8px; + font-size: 11px; + background: #333; + text-align: left; + width: 150px; + z-index: 3; + color: #fff; +} +.mouseover-help-link:hover .inner { + display: block; +} /* =============== */ /* MinorNavigation */ @@ -1129,16 +1151,27 @@ body.package.read h3 { .search-result .main-link { font-size: 125%; } -.search-result .view-more-link { +.search-result .extra-links { float: right; +} +.search-result .view-more-link { color: #000; - text-align: middle; + display: block; + text-align: right; margin-top: 4px; padding: 3px 22px 3px 10px; background: url('/images/icons/arrow-right-16-black.png') no-repeat right; 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 .error-hint { + font-size: 11px; +} .search-result .view-more-link:hover { opacity:1.0; filter:alpha(opacity=100); /* For IE8 and earlier */ diff --git a/ckan/public/images/icons/star.png b/ckan/public/images/icons/star.png new file mode 100755 index 00000000000..8cea494e2fa Binary files /dev/null and b/ckan/public/images/icons/star.png differ diff --git a/ckan/public/scripts/application.js b/ckan/public/scripts/application.js index 48dc00e1acd..0480cf0ada4 100644 --- a/ckan/public/scripts/application.js +++ b/ckan/public/scripts/application.js @@ -8,6 +8,8 @@ CKAN.Utils.setupFormatAutocomplete($(this)); }); CKAN.Utils.setupMarkdownEditor($('.markdown-editor')); + CKAN.Utils.setupMouseoverHelpLinks($('.mouseover-help-link')); + // set up ckan js var config = { endpoint: CKAN.SITE_URL + '/' @@ -427,6 +429,17 @@ CKAN.Utils = function($, my) { }); }; + my.setupMouseoverHelpLinks = function(links) { + $.each(links, function(n,link) { + link = $(link); + link.click(function() { return false; }); + var div = $('
'); + div.html(link.attr('data')); + div.addClass('inner'); + link.append(div); + }); + } + // If notes field is more than 1 paragraph, just show the // first paragraph with a 'Read more' link that will expand // the div if clicked diff --git a/ckan/templates/package/read_core.html b/ckan/templates/package/read_core.html index 6ea1603a94a..2c15825d3e3 100644 --- a/ckan/templates/package/read_core.html +++ b/ckan/templates/package/read_core.html @@ -19,7 +19,12 @@

Resources

- View + ${h.resource_display_name(res)}    ${res.get('format')}