Skip to content
This repository
  • 2 commits
  • 3 files changed
  • 0 comments
  • 1 contributor
3  ckan/public/css/style.css
@@ -1149,6 +1149,9 @@ body.package.read h3 {
1149 1149
 .dataset-resource p {
1150 1150
   margin: 0;
1151 1151
 }
  1152
+.resource-url-cached {
  1153
+    font-size: 0.9em;
  1154
+}
1152 1155
 
1153 1156
 body.package.read .resource-information {
1154 1157
     color: #808080;
3  ckan/templates/package/read_core.html
@@ -31,6 +31,9 @@
31 31
               <a class="resource-url-analytics" href="${res.get('url', '')}" rel="dcat:accessURL" target="_blank">
32 32
                 ${res.get('url', '')}
33 33
               </a>
  34
+              <a py:if="res.get('cache_url')" class="resource-url-cached" href="${res.get('cache_url')}" target="_blank">
  35
+                [cached]
  36
+              </a>
34 37
             </p>
35 38
           </div>
36 39
         </py:for>
16  ckan/tests/functional/test_package.py
@@ -17,6 +17,7 @@
17 17
 from ckan.lib.create_test_data import CreateTestData
18 18
 import ckan.lib.helpers as h
19 19
 import ckan.lib.search as search
  20
+from ckan.logic.action import get, update
20 21
 from ckan.controllers.package import PackageController
21 22
 from ckan.plugins import SingletonPlugin, implements, IPackageController
22 23
 from ckan import plugins
@@ -349,6 +350,21 @@ def test_read_plugin_hook(self):
349 350
         assert plugin.calls['read'] == 1, plugin.calls
350 351
         plugins.unload(plugin)
351 352
 
  353
+    def test_resource_list(self):
  354
+        name = 'annakarenina'
  355
+        cache_url = 'http://thedatahub.org/test_cache_url.csv'
  356
+        # add a cache_url to the first resource in the package
  357
+        context = {'model': model, 'session': model.Session, 'user': 'testsysadmin'}
  358
+        data = {'id': 'annakarenina'}
  359
+        pkg = get.package_show(context, data)
  360
+        pkg['resources'][0]['cache_url'] = cache_url
  361
+        update.package_update(context, pkg)
  362
+        # check that the cache url is included on the dataset view page
  363
+        offset = url_for(controller='package', action='read', id=name)
  364
+        res = self.app.get(offset)
  365
+        assert '[cached]'in res
  366
+        assert cache_url in res
  367
+
352 368
 
353 369
 class TestReadAtRevision(FunctionalTestCase, HtmlCheckMethods):
354 370
 

No commit comments for this range

Something went wrong with that request. Please try again.