+ + {% block search_sortby_button %} + + {% endblock %} +
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 90aaa6b9..261281d0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: uses: gsa/data.gov/.github/workflows/ckan-test.yml@main with: ext_name: datagovtheme - plugins: harvest datagovtheme + plugins: harvest datagovtheme geodatagov secrets: inherit ui-test: diff --git a/.gitignore b/.gitignore index 642f6269..a04365f9 100644 --- a/.gitignore +++ b/.gitignore @@ -11,8 +11,8 @@ syntax: glob .vscode/ # Cypress -e2e/cypress/videos/* -e2e/cypress/screenshots/* -e2e/cypress/results/output.xml +cypress/e2e/videos/* +cypress/e2e/screenshots/* +cypress/e2e/results/output.xml node_modules -package-lock.json \ No newline at end of file +package-lock.json diff --git a/Dockerfile b/Dockerfile index a2be6b97..22751ec4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,10 @@ -ARG CKAN_VERSION=2.9 +ARG CKAN_VERSION=2.10.1 FROM openknowledge/ckan-dev:${CKAN_VERSION} ARG CKAN_VERSION -# Add timezone data if it does not exist -RUN if [[ "${CKAN_VERSION}" = "2.9" ]]; then sudo apk add tzdata; fi +# Add timezone data +RUN sudo apk add tzdata COPY . $APP_DIR/ -# WORKDIR /app RUN pip install -r $APP_DIR/requirements.txt -r $APP_DIR/dev-requirements.txt -e $APP_DIR/. diff --git a/Makefile b/Makefile index 36fc0525..036e49d7 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CKAN_VERSION ?= 2.9 +CKAN_VERSION ?= 2.10 COMPOSE_FILE ?= docker-compose.yml build: ## Build the docker containers @@ -17,6 +17,9 @@ test: ## Run extension tests ui-test: CKAN_VERSION=$(CKAN_VERSION) docker-compose -f $(COMPOSE_FILE) -f docker-compose.test.yml up --abort-on-container-exit test +ui-interactive: + CYPRESS_BASE_URL=http://ckan:5000 npx cypress open + up: ## Start the containers CKAN_VERSION=$(CKAN_VERSION) docker-compose -f $(COMPOSE_FILE) up diff --git a/README.md b/README.md index 6f462a30..741fb422 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,8 @@ This extension is compatible with these versions of CKAN. CKAN version | Compatibility ------------ | ------------- <=2.8 | no -2.9 | yes +2.9 | 0.1.27 (last supported) +2.10 | >=0.2.0 ### Configuration @@ -115,10 +116,10 @@ In order to support multiple versions of CKAN, or even upgrade to new versions of CKAN, we support development and testing through the `CKAN_VERSION` environment variable. - $ make CKAN_VERSION=2.9 test + $ make CKAN_VERSION=2.10 test Variable | Description | Default -------- | ----------- | ------- -CKAN_VERSION | Version of CKAN to use. | 2.9 +CKAN_VERSION | Version of CKAN to use. | 2.10 COMPOSE_FILE | docker-compose service description file. | docker-compose.yml diff --git a/ckanext/datagovtheme/blueprint.py b/ckanext/datagovtheme/blueprint.py index 0403c095..2bef2a37 100644 --- a/ckanext/datagovtheme/blueprint.py +++ b/ckanext/datagovtheme/blueprint.py @@ -1,10 +1,8 @@ -from future import standard_library -standard_library.install_aliases() - import urllib.parse import ckan.plugins as p from ckan.plugins.toolkit import config -from ckan.lib.base import c, request, abort +from ckan.lib.base import abort +from ckan.common import c, request from flask import Blueprint, redirect diff --git a/ckanext/datagovtheme/fanstatic_library/styles/datagovtheme.css b/ckanext/datagovtheme/fanstatic_library/styles/datagovtheme.css index 46b7ef62..61e9ba9e 100644 --- a/ckanext/datagovtheme/fanstatic_library/styles/datagovtheme.css +++ b/ckanext/datagovtheme/fanstatic_library/styles/datagovtheme.css @@ -19,6 +19,9 @@ background-color: transparent; border: 0; } +.hide { + display: none; +} body, .main, [role='main'], @@ -51,6 +54,9 @@ body, padding-top: 0; padding-bottom: 0; } +header.masthead { + padding: 0 !important; +} [role='main'] { padding-top: 0; @@ -531,6 +537,203 @@ a { .label[data-format*='wms'] { background-color: #f06f64; } + +.pagination-wrapper { + text-align: center; + border-top: 1px solid #eeeeee; + padding-top: 10px; +} +.pagination { + display: inline-block; + padding-left: 0; + margin: 20px 0; + border-radius: 4px; +} +.pagination > li { + display: inline; +} +.pagination > li > a, +.pagination > li > span { + position: relative; + float: left; + padding: 6px 12px; + margin-left: -1px; + line-height: 1.42857143; + color: #206b82; + text-decoration: none; + background-color: #fff; + border: 1px solid #ddd; +} +.pagination > li > a:hover, +.pagination > li > span:hover, +.pagination > li > a:focus, +.pagination > li > span:focus { + z-index: 2; + color: #113845; + background-color: #eeeeee; + border-color: #ddd; +} +.pagination > li:first-child > a, +.pagination > li:first-child > span { + margin-left: 0; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; +} +.pagination > li:last-child > a, +.pagination > li:last-child > span { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} +.pagination > .active > a, +.pagination > .active > span, +.pagination > .active > a:hover, +.pagination > .active > span:hover, +.pagination > .active > a:focus, +.pagination > .active > span:focus { + z-index: 3; + color: #fff; + cursor: default; + background-color: #206b82; + border-color: #206b82; +} +.pagination > .disabled > span, +.pagination > .disabled > span:hover, +.pagination > .disabled > span:focus, +.pagination > .disabled > a, +.pagination > .disabled > a:hover, +.pagination > .disabled > a:focus { + color: #777777; + cursor: not-allowed; + background-color: #fff; + border-color: #ddd; +} +.pagination-lg > li > a, +.pagination-lg > li > span { + padding: 10px 16px; + font-size: 18px; + line-height: 1.3333333; +} +.pagination-lg > li:first-child > a, +.pagination-lg > li:first-child > span { + border-top-left-radius: 6px; + border-bottom-left-radius: 6px; +} +.pagination-lg > li:last-child > a, +.pagination-lg > li:last-child > span { + border-top-right-radius: 6px; + border-bottom-right-radius: 6px; +} +.pagination-sm > li > a, +.pagination-sm > li > span { + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; +} +.pagination-sm > li:first-child > a, +.pagination-sm > li:first-child > span { + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; +} +.pagination-sm > li:last-child > a, +.pagination-sm > li:last-child > span { + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} +.label[data-diff=added], +.label[data-diff=updated], +.label[data-diff=deleted], +.label[data-diff='not modified'] { + color:#000 + } +.label[data-diff=error] { + color: #fff; +} +.module .module-content .dataset-list.unstyled .dataset-item .dataset-content { + padding-bottom: 0px; +} +.module .module-content .dataset-list.unstyled .dataset-item .dataset-resources.unstyled { + margin-bottom: 30px; +} +.label { + display: inline; + padding: 0.2em 0.6em 0.3em; + font-size: 75%; + font-weight: 700; + line-height: 1; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + border-radius: 0.25em; +} +a.label:hover, +a.label:focus { + color: #fff; + text-decoration: none; + cursor: pointer; +} +.label:empty { + display: none; +} +.label[data-format=html], +.label[data-format*=html] { + background-color: #2E759E; +} +.label[data-format=json], +.label[data-format*=json] { + background-color: #D63B00; +} +.label[data-format=xml], +.label[data-format*=xml] { + background-color: #D63B00; +} +.label[data-format=text], +.label[data-format*=text] { + background-color: #1A7EA3; +} +.label[data-format=csv], +.label[data-format*=csv] { + background-color: #856A00; +} +.label[data-format=xls], +.label[data-format*=xls] { + background-color: #207E42; +} +.label[data-format=zip], +.label[data-format*=zip] { + background-color: #686868; +} +.label[data-format=api], +.label[data-format*=api] { + background-color: #D22D81; +} +.label[data-format=pdf], +.label[data-format*=pdf] { + background-color: #e0051e; +} +.label[data-format=rdf], +.label[data-format*=rdf], +.label[data-format*=nquad], +.label[data-format*=ntriples], +.label[data-format*=turtle] { + background-color: #0b4498; +} + +.item-count.badge { +display: inline-block; +min-width: 10px; +padding: 3px 7px; +font-size: 12px; +font-weight: bold; +line-height: 1; +color: #fff; +text-align: center; +white-space: nowrap; +vertical-align: middle; +background-color: #6E6E6E; +border-radius: 10px; +} + #search-helper-message { display: none; position: absolute; @@ -638,6 +841,9 @@ a { .dataset-item .dataset-content { padding: 0 0 30px 0; } +.dataset-item .dataset-content { + padding: 0 0 30px 0; +} .dataset-item .dataset-organization { display: inline; font-style: italic; @@ -660,7 +866,7 @@ a { .dataset-item .more:hover { color: #222; } -.dataset-item .label:hover { +.dataset-item .label:hover:not(.label[data-diff]) { background-color: #333; } .dataset-item.has-organization .dataset-heading { @@ -954,6 +1160,7 @@ header .header_new.banner_new.page-heading_new { } .header_new.banner_new.page-heading_new { border-bottom: 0 none; + width: 100vw; } .page-header_new { border-bottom: medium none; @@ -1084,7 +1291,7 @@ ul#menu-primary-navigation li, } .fa { display: inline-block; - font-family: FontAwesome; + font-family: FontAwesome !important; font-style: normal; font-weight: normal; line-height: 1; @@ -1659,10 +1866,11 @@ aside.secondary { color: white !important; float: none !important; } -.fa-question-circle { - font-size: 32px; +.harvest-types label.radio { + font-weight: normal; + margin-bottom: 10px; + display: block; } - .main-heading { float: left; width: 590px; @@ -1670,7 +1878,6 @@ aside.secondary { } .fa-home { - font-size: 24px; width: 24px; vertical-align: -1px; } @@ -1895,8 +2102,8 @@ form.search-form { } .module-content.page-header { padding-top: 20px; + margin-bottom: 20px; } - .search-form.no-bottom-border { display: flex; flex-wrap: wrap; @@ -1967,11 +2174,14 @@ p.module-content { .dataset-collection { margin-right: 5px; + background-color: #777777; } .dataset-collection .icon-collection { background: transparent url('/images/collection.png') no-repeat; height: 12px; + display: inline-block; + width: 14px } .topic-ecosystems a i:before { @@ -2046,10 +2256,19 @@ p.module-content { #access-use .access-non-public strong { color: #b85123; } - #access-use .fa-file-text-o { color: #474747; } +#access-use .fa-file-text-o::before { + content: "\f0f6"; +} +.fa-building-o:before { + content: "\f0f7"; +} +.fa-edit:before, +.fa-pencil-square-o:before { + content: "\f044"; +} .alert-info.non-federal { border: 1px solid #ccc; font-size: 16px; @@ -2231,7 +2450,7 @@ article.module.prose h3 { position: absolute; right: 29%; text-indent: -900em; - top: 27%; + top: 42px; width: 30px; } diff --git a/ckanext/datagovtheme/helpers.py b/ckanext/datagovtheme/helpers.py index 557ff685..ce2dad6e 100644 --- a/ckanext/datagovtheme/helpers.py +++ b/ckanext/datagovtheme/helpers.py @@ -537,35 +537,6 @@ def get_map_viewer_params(resource, advanced=False): return urllib.parse.urlencode(params) -def resource_preview_custom(resource, pkg_id): - - resource_format = resource.get('format', '').lower() - - if is_map_viewer_format(resource): - # TODO rename config option to ckanext.datagovtheme - viewer_url = config.get('ckanext.geodatagov.spatial_preview.url') - - url = '{viewer_url}?{params}'.format( - viewer_url=viewer_url, - params=get_map_viewer_params(resource)) - - return p.toolkit.render_snippet("dataviewer/snippets/data_preview.html", - data={'embed': False, - 'resource_url': url, - 'raw_resource_url': resource['url']}) - - elif resource_format in ('web map application', 'arcgis online map') \ - and ('webmap=' in resource.get('url') or 'services=' in resource.get('url')): - url = resource['url'].replace('viewer.html', 'embedViewer.html') - - return p.toolkit.render_snippet("dataviewer/snippets/data_preview.html", - data={'embed': False, - 'resource_url': url, - 'raw_resource_url': resource['url']}) - - return h.resource_preview(resource, pkg_id) - - types = { 'web': ('html', 'data', 'esri rest', 'gov', 'org', ''), 'preview': ('csv', 'xls', 'txt', 'jpg', 'jpeg', 'png', 'gif'), diff --git a/ckanext/datagovtheme/plugin.py b/ckanext/datagovtheme/plugin.py index b6374929..407342df 100644 --- a/ckanext/datagovtheme/plugin.py +++ b/ckanext/datagovtheme/plugin.py @@ -13,7 +13,6 @@ class DatagovTheme(p.SingletonPlugin): p.implements(p.IBlueprint) p.implements(p.IConfigurer) p.implements(p.IFacets, inherit=True) - p.implements(p.IRoutes, inherit=True) p.implements(p.ITemplateHelpers) # IConfigurer @@ -97,7 +96,6 @@ def get_helpers(self): 'is_web_format': datagovtheme_helpers.is_web_format, 'is_map_viewer_format': datagovtheme_helpers.is_map_viewer_format, 'get_map_viewer_params': datagovtheme_helpers.get_map_viewer_params, - 'resource_preview_custom': datagovtheme_helpers.resource_preview_custom, 'is_preview_format': datagovtheme_helpers.is_preview_format, 'is_map_format': datagovtheme_helpers.is_map_format, 'is_plotly_format': datagovtheme_helpers.is_plotly_format, diff --git a/ckanext/datagovtheme/public/css/datagovtheme.css b/ckanext/datagovtheme/public/css/datagovtheme.css index a5eb88e9..ebddd27b 100644 --- a/ckanext/datagovtheme/public/css/datagovtheme.css +++ b/ckanext/datagovtheme/public/css/datagovtheme.css @@ -18,6 +18,13 @@ background-color: transparent; border: 0; } +.hide { + display: none; +} +.p-2, .masthead { + padding: 0px; +} + body, .main, [role=main], diff --git a/ckanext/datagovtheme/templates/header.html b/ckanext/datagovtheme/templates/header.html index 18ff4c44..c7eb2d4d 100644 --- a/ckanext/datagovtheme/templates/header.html +++ b/ckanext/datagovtheme/templates/header.html @@ -131,14 +131,6 @@ {{ c.userobj.display_name }} - {% set new_activities = h.new_activities() %} -