Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AV-1986: CKAN 2.10 + Python 3.10 #1946

Draft
wants to merge 63 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
d1abb54
AV-1986: CKAN 2.10, Python 3.10 Alpine base image
bzar Apr 21, 2023
f62ec47
AV-1986: Update ckanext-spatial from upstream
bzar Apr 24, 2023
11ba4aa
Update extensions
bzar Apr 24, 2023
a70db49
AV-1986: showcase is now upstream, no need to check style
bzar Apr 24, 2023
c1ae092
AV-1986: Fix issues in CKAN startup, extension form CSRF
bzar Apr 27, 2023
e55a6b4
AV-1986: Added temporary 'not reviewed' values for all required licen…
bzar Apr 27, 2023
3d2dca3
AV-1986: Speed up extension requirements installation by installing t…
bzar Apr 27, 2023
852be7f
AV-1986: Add required core patches
bzar May 2, 2023
01a52fb
AV-1986: Change spatial search backend to solr-bbox as solr backend i…
bzar May 2, 2023
05d2812
AV-1986: Migrate ckanext-advancedsearch for ckan 2.10
bzar May 2, 2023
e497db3
AV-1986: Migrate ckanext-sixodp_showcase for ckan 2.10
bzar May 2, 2023
2af96bd
AV-1986: Parallelize compiling extension translations
bzar May 2, 2023
534387a
AV-1986: migrate ckanext-ytp_request for ckan 2.10
bzar May 2, 2023
7363b47
AV-1986: migrate ckanext-ytp_main views for ckan 2.10
bzar May 2, 2023
cbe965e
AV-1986: ckan 2.10 does not allow non-self-defined functions like uni…
bzar May 2, 2023
b124226
AV-1986: migrate ytp_main IPackageController method names
bzar May 2, 2023
c580193
AV-1986: move hierarchy_display in plugin order as it was interfering…
bzar May 2, 2023
fe9fac9
AV-1986: use ckanext-scheming upstream_merge branch
bzar May 2, 2023
ce33381
Merge branch 'master' into AV-1986_ckan-2.10
bzar May 3, 2023
4c763f0
AV-1986: use ckanext-apis ckan-2.10 branch
bzar May 3, 2023
4f38f59
AV-1986: update ckanext-archiver from upstream
bzar May 3, 2023
d1ceb7c
AV-1986: use ckanext-cloudstorage ckan-2.10 branch
bzar May 3, 2023
404e4a2
AV-1986: update ckanext-dcat from upstream
bzar May 3, 2023
52e680c
AV-1986: fix template syntax
bzar May 3, 2023
709f4b4
AV-1986: fix logout issue
bzar May 3, 2023
7bf1dfc
Update ckanext-harvest
bzar May 3, 2023
021d726
AV-1986: Update ckanext-matomo
bzar May 3, 2023
15fb69a
AV-1986: use ckanext-openapiviewer ckan-2.10 branch
bzar May 3, 2023
c3b676a
AV-1986: Update ckanext-reminder
bzar May 3, 2023
c14abd5
Serialize object fields before indexing in ckanext-sitesearch
bzar May 3, 2023
c25e7c6
AV-1986: Fixed sparql indexing issue
bzar May 3, 2023
3fc6c8f
AV-1986: remove unused import
bzar May 3, 2023
01b7ce7
AV-1986: remove unused import in ckanext-apis
bzar May 3, 2023
8982ad6
AV-1986: switch ckanext-cloudstorage to master
bzar May 8, 2023
19c95f1
Add CKAN 2.9 compatibility to submodules
bzar May 8, 2023
dcbacae
AV-1986: switch ckanext-apis, ckanext-drupal8 to master
bzar May 8, 2023
eed4fc1
AV-1986: switch ckanext-openapiviewer to master
bzar May 9, 2023
022f193
AV-1986: switch ckanext-dcat to master
bzar May 9, 2023
2a80c2d
AV-1986: disable installing ckanext-qa until it is migrated
bzar May 10, 2023
cc60c6a
AV-1986: switch ckanext-statistics to master
bzar May 10, 2023
c80a332
Merge branch 'master' into AV-1986_ckan-2.10
bzar May 17, 2023
f106149
Check if .init-done exists before verifying contents to reduce unnece…
bzar May 17, 2023
fcd0915
AV-1986: use master branch for ckanext-cloudstorage
bzar May 17, 2023
141102e
AV-1986: fix incorrect function name
bzar May 17, 2023
24557c3
AV-1987: initial port from less to sass
bzar May 29, 2023
cabf7c5
AV-1987: update package.lock
bzar May 29, 2023
4b72aa5
AV-1987: Update stylelint configuration and documentation for SCSS
bzar May 31, 2023
f3d5cf1
AV-1987: Update github action configuration and documentation for SCSS
bzar May 31, 2023
664d4b2
AV-1987: fix styles, add scss rules
bzar May 31, 2023
7df1abb
AV-1987: scss style fixes
bzar May 31, 2023
a031d17
AV-1986: Update ckanext-cloudstorage for CKAN 2.10 compatibility fixes
bzar May 31, 2023
3d9166c
Merge branch 'AV-1986_ckan-2.10' into AV-1987_less-to-sass
bzar May 31, 2023
1f4b74d
AV-1986: Use ckanext-cloudstorage master branch
bzar May 31, 2023
7be4b17
Merge branch 'AV-1986_ckan-2.10' into AV-1987_less-to-sass
bzar May 31, 2023
8d276cb
AV-1987: fix bootstrap gulp build
bzar Jun 5, 2023
3d6c2c4
AV-1987: regenerate package lock to try and fix stylelint
bzar Jun 5, 2023
1d3e329
AV-1987: write bootstrap.css to ckanext-ytp resources for bundling
bzar Jun 6, 2023
3c52d7d
AV-1987: increase max_connections for postgres to handle cypress tests
bzar Jun 7, 2023
bc4a6db
AV-1987: Update ckanext-drupal8 to fix postgres connection spam issue
bzar Jun 7, 2023
e1b52c4
AV-1987: Use bootstrap 3 public/template folder in CKAN
bzar Jun 12, 2023
242e2de
Merge pull request #1953 from vrk-kpa/AV-1987_less-to-sass
bzar Jun 12, 2023
f1df2d8
Merge branch 'master' into AV-1986_ckan-2.10
Zharktas Oct 3, 2023
c3dd9a6
Add new rules to ignore and fix many style issues
Zharktas Oct 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
working-directory: ./opendata-assets

- name: run stylelint
run: npx stylelint "src/less" -f github
run: npx stylelint "src/scss" -f github
working-directory: ./opendata-assets

slack:
Expand Down
2 changes: 1 addition & 1 deletion .stylelintignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
modules/ytp-assets-common/src/less/ckan/upstream_ckan
modules/ytp-assets-common/src/scss/ckan/upstream_ckan
19 changes: 12 additions & 7 deletions ckan/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ ARG SECRET_NPMRC
##################
### Build CKAN ###
##################
FROM public.ecr.aws/docker/library/python:3.9.16-alpine3.17 as base_ckan_build
FROM public.ecr.aws/docker/library/python:3.10.9-alpine3.17 as base_ckan_build

# Used by Github Actions to tag the image with
ENV IMAGE_TAG=2.10.0

# Set CKAN version to build
ENV GIT_URL=https://github.com/ckan/ckan.git
ENV GIT_BRANCH=ckan-2.9.9
ENV GIT_BRANCH=ckan-2.10.0

# Set src dirs
ENV SRC_DIR=/srv/app/src
Expand Down Expand Up @@ -47,7 +50,7 @@ RUN apk add --no-cache \
libxml2-dev \
libxslt-dev

# Create the src and pip cache directory
# Create the src directory
RUN mkdir -p ${SRC_DIR}

# Install pip
Expand All @@ -67,7 +70,7 @@ RUN pip wheel --wheel-dir=/wheels uWSGI==2.0.20 gevent==21.12.0 greenlet==1.1.3
###########################
### Default-Extensions ####
###########################
FROM public.ecr.aws/docker/library/python:3.9.16-alpine3.17 as base_extbuild
FROM public.ecr.aws/docker/library/python:3.10.9-alpine3.17 as base_extbuild

# Set src dirs
ENV SRC_DIR=/srv/app/src
Expand Down Expand Up @@ -99,7 +102,7 @@ RUN pip wheel --wheel-dir=/wheels git+${ENVVARS_GIT_URL}@${ENVVARS_GIT_BRANCH}#e
############
### MAIN ###
############
FROM public.ecr.aws/docker/library/python:3.9.16-alpine3.17 as base_ckan
FROM public.ecr.aws/docker/library/python:3.10.9-alpine3.17 as base_ckan

ENV APP_DIR=/srv/app
ENV SRC_DIR=/srv/app/src
Expand Down Expand Up @@ -266,7 +269,9 @@ RUN cd ${SRC_DIR}/ckan && \
patch --strip=1 --input=patches/json_serializable_lazyjsonobject.patch && \
patch --strip=1 --input=patches/implement_is_required_for_image_upload.patch && \
patch --strip=1 --input=patches/add_drafts_to_search.patch && \
patch --strip=1 --input=patches/add_prefix_to_werkzeug.patch
patch --strip=1 --input=patches/fix_license_dictization.patch && \
patch --strip=1 --input=patches/fix_truncate_helper_annotations.patch


# install crontab
RUN chmod +x ${CRON_DIR}/scripts/*.sh && \
Expand Down Expand Up @@ -300,7 +305,7 @@ ENTRYPOINT ["/srv/app/scripts/entrypoint_ckan.sh"]
#
# Modules build (for production)
#
FROM public.ecr.aws/docker/library/python:3.9.16-alpine3.17 as modules_build
FROM public.ecr.aws/docker/library/python:3.10.9-alpine3.17 as modules_build

# install required packages
RUN apk add curl nodejs libjpeg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
import logging
import math

from ckan.common import c, request
from ckan.lib.base import render
from ckan.logic import get_action
from ckan.plugins import toolkit
from flask import Blueprint

from .helpers import advancedsearch_schema, field_options, query_helper
Expand All @@ -28,13 +26,13 @@ def search():
context = {
'model': model,
'session': model.Session,
'user': c.user
'user': toolkit.g.user
}

# On initial page load there is no page parameter so display the first page
# On possible page navigations use the page parameter to move to the next page
# NOTE: this works also with a GET request but the POST filters will not be submitted so all datasets will be returned
page = int(request.params.get('page', 1))
page = int(toolkit.request.params.get('page', 1))
# Limit amount of results returned
limit = 20
search_query_filters = []
Expand All @@ -51,11 +49,11 @@ def search():
# Make a list of field options
options[key] = field_options(val)

if request.method == 'POST':
if toolkit.request.method == 'POST':
# Use the field labelled as the main_query to build the value for q
# TODO: Handle no main_query_field provided
main_query_helper = query_helper(schema['input_fields'].get(main_query_field))
q = main_query_helper(main_query_field, request.form, schema['input_fields'], context)
q = main_query_helper(main_query_field, toolkit.request.form, schema['input_fields'], context)

# Iterate through all fields in schema except the main_query_field
# and process every field with the provided query_helper
Expand All @@ -67,13 +65,13 @@ def search():
query_helper_function = query_helper(val)
# TODO: handle no query_helper
if query_helper_function:
res = query_helper_function(key, request.form, schema['input_fields'], context)
res = query_helper_function(key, toolkit.request.form, schema['input_fields'], context)
if res:
search_query_filters.append(res)

sort_string = request.form.get('sort', 'metadata_created desc')
sort_string = toolkit.request.form.get('sort', 'metadata_created desc')
# if an actual sort parameter is provided, use that for selection in the template
sorting_selection = request.form.get('sort')
sorting_selection = toolkit.request.form.get('sort')

data_dict = {
'q': q,
Expand All @@ -93,14 +91,16 @@ def search():
# Outputs: (filter:value) AND (another_filter:another_value)
data_dict['fq'] = '(' + ') AND ('.join(search_query_filters) + ')'

query = get_action('package_search')(context, data_dict)
log.info(f'q = {data_dict["q"]}, fq = {data_dict["fq"]}')
query = toolkit.get_action('package_search')(context, data_dict)

json_query = json.dumps(
{k: v for k, v in list(params_to_dict(request.form).items()) if k != 'page' and isinstance(v, list) and len(v[0]) > 0}
{k: v for k, v in list(params_to_dict(toolkit.request.form).items())
if k != 'page' and isinstance(v, list)and len(v[0]) > 0}
)

filters = {
k: v for k, v in list(params_to_dict(request.form).items()) if k != 'search_target' and k != 'search_query'
k: v for k, v in list(params_to_dict(toolkit.request.form).items()) if k != 'search_target' and k != 'search_query'
and k != 'page' and k != 'released-before' and k != 'released-after' and k != 'updated-before'
and k != 'updated-after' and k != 'sort' and isinstance(v, list) and len(v[0]) > 0
}
Expand All @@ -117,23 +117,23 @@ def search():
options_list.append(x)
filters[key] = options_list

c.advanced_search = {
toolkit.g.advanced_search = {
"item_count": query['count'],
# Round values up to get total amount of pages
"total_pages": int(math.ceil(float(query['count']) / float(limit))),
"collection": query['results'],
# Return query parameters to the UI so that it can populate the fields with the previous query values
# NOTE: Can this cause security issues? Returning POST request params back to the client
"last_query": params_to_dict(request.form),
"last_query": params_to_dict(toolkit.request.form),
"json_query": json_query,
"filters": filters,
"sort_string": sort_string,
"field_options": options,
"sorting_selection": sorting_selection
}
c.advanced_search['last_query']['page'] = page
toolkit.g.advanced_search['last_query']['page'] = page

return render('advanced_search/index.html')
return toolkit.render('advanced_search/index.html')


def params_to_dict(params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
<div id="content" class="container advanced-search-container">
{% block main_content %}
{% block flash %}
{% set flash_messages = h.get_flashed_messages(with_categories=true) %}
<div class="flash-messages">
{% block flash_inner %}
{% for message in h.flash.pop_messages() | list %}
<div class="alert alert-warning fade in {{ message.category }}">
{{ h.literal(message) }}
</div>
{% endfor %}
{% endblock %}
{% for category, message in flash_messages %}
<div class="m-0 alert alert-warning fade in {{ message.category }}">
{{ h.literal(message) }}
</div>
{% endfor %}
</div>
{% endblock %}

Expand Down
2 changes: 1 addition & 1 deletion ckan/ckanext/ckanext-reminder
2 changes: 1 addition & 1 deletion ckan/ckanext/ckanext-scheming
Submodule ckanext-scheming updated 42 files
+9 −8 .github/workflows/test.yml
+24 −0 CHANGELOG.md
+1 −1 COPYING
+1 −1 COPYING.fr
+351 −178 README.md
+8 −0 ckanext/scheming/assets/styles/scheming.css
+1 −1 ckanext/scheming/ckan_dataset.yaml
+106 −0 ckanext/scheming/ckan_formpages.yaml
+2 −2 ckanext/scheming/custom_group_with_status.json
+2 −2 ckanext/scheming/custom_org_with_address.json
+2 −2 ckanext/scheming/group_with_bookface.json
+12 −0 ckanext/scheming/helpers.py
+2 −2 ckanext/scheming/org_with_dept_id.json
+57 −5 ckanext/scheming/plugins.py
+14 −6 ckanext/scheming/presets.json
+1 −1 ckanext/scheming/templates/scheming/form_snippets/_organization_select.html
+1 −1 ckanext/scheming/templates/scheming/form_snippets/date.html
+2 −2 ckanext/scheming/templates/scheming/form_snippets/datetime.html
+3 −3 ckanext/scheming/templates/scheming/form_snippets/datetime_tz.html
+1 −1 ckanext/scheming/templates/scheming/form_snippets/large_text.html
+1 −1 ckanext/scheming/templates/scheming/form_snippets/license.html
+1 −1 ckanext/scheming/templates/scheming/form_snippets/multiple_checkbox.html
+1 −1 ckanext/scheming/templates/scheming/form_snippets/multiple_select.html
+3 −0 ckanext/scheming/templates/scheming/form_snippets/multiple_text.html
+45 −0 ckanext/scheming/templates/scheming/form_snippets/radio.html
+11 −9 ckanext/scheming/templates/scheming/form_snippets/repeating_subfields.html
+1 −1 ckanext/scheming/templates/scheming/form_snippets/select.html
+1 −0 ckanext/scheming/templates/scheming/group/group_form.html
+5 −4 ckanext/scheming/templates/scheming/organization/group_form.html
+15 −11 ckanext/scheming/templates/scheming/package/resource_read.html
+66 −2 ckanext/scheming/templates/scheming/package/snippets/package_form.html
+30 −1 ckanext/scheming/templates/scheming/package/snippets/resource_form.html
+2 −1 ckanext/scheming/templates/scheming/snippets/form_field.html
+101 −99 ckanext/scheming/tests/test_form.py
+35 −1 ckanext/scheming/tests/test_form_snippets.py
+7 −2 ckanext/scheming/tests/test_helpers.py
+11 −88 ckanext/scheming/validation.py
+207 −0 ckanext/scheming/views.py
+2 −2 setup.py
+10 −0 test-requirements-py2.txt
+4 −9 test-requirements.txt
+1 −1 test.ini
2 changes: 1 addition & 1 deletion ckan/ckanext/ckanext-showcase
Submodule ckanext-showcase updated 69 files
+6 −12 .github/workflows/test.yml
+0 −4 .gitignore
+0 −42 .travis.yml
+0 −8 .tx/config
+38 −0 CHANGELOG.md
+12 −42 README.rst
+7,575 −0 ckanext/showcase/assets/build/ckeditor.js
+0 −0 ckanext/showcase/assets/ckanext_showcase.css
+0 −0 ckanext/showcase/assets/ckeditor-content-style.css
+4 −1 ckanext/showcase/assets/js/showcase-ckeditor.js
+0 −0 ckanext/showcase/assets/src/ckeditor.js
+1 −1 ckanext/showcase/assets/webassets.yml
+26 −0 ckanext/showcase/cli.py
+0 −0 ckanext/showcase/commands/__init__.py
+0 −38 ckanext/showcase/commands/cli.py
+0 −147 ckanext/showcase/commands/migrate.py
+0 −66 ckanext/showcase/commands/paster.py
+0 −129 ckanext/showcase/controller.py
+0 −1,350 ckanext/showcase/fanstatic/dist/ckeditor.js
+0 −8 ckanext/showcase/fanstatic/resource.config
+ ckanext/showcase/i18n/de/LC_MESSAGES/ckanext-showcase.mo
+530 −0 ckanext/showcase/i18n/de/LC_MESSAGES/ckanext-showcase.po
+ ckanext/showcase/i18n/fr/LC_MESSAGES/ckanext-showcase.mo
+542 −0 ckanext/showcase/i18n/fr/LC_MESSAGES/ckanext-showcase.po
+ ckanext/showcase/i18n/zh_Hant_TW/LC_MESSAGES/ckanext-showcase.mo
+524 −0 ckanext/showcase/i18n/zh_Hant_TW/LC_MESSAGES/ckanext-showcase.po
+8 −17 ckanext/showcase/logic/action/create.py
+1 −3 ckanext/showcase/logic/action/delete.py
+7 −11 ckanext/showcase/logic/action/get.py
+1 −7 ckanext/showcase/logic/action/update.py
+2 −5 ckanext/showcase/logic/helpers.py
+36 −34 ckanext/showcase/logic/schema.py
+50 −62 ckanext/showcase/plugin.py
+0 −21 ckanext/showcase/plugin/flask_plugin.py
+0 −42 ckanext/showcase/plugin/pylons_plugin.py
+1 −2 ckanext/showcase/templates/admin/confirm_remove_showcase_admin.html
+1 −2 ckanext/showcase/templates/admin/manage_showcase_admins.html
+5 −7 ckanext/showcase/templates/header.html
+7 −5 ckanext/showcase/templates/home/snippets/stats.html
+1 −1 ckanext/showcase/templates/package/dataset_showcase_list.html
+1 −2 ckanext/showcase/templates/package/read_base.html
+3 −3 ckanext/showcase/templates/showcase/add_datasets.html
+1 −3 ckanext/showcase/templates/showcase/confirm_delete.html
+6 −7 ckanext/showcase/templates/showcase/edit_base.html
+4 −4 ckanext/showcase/templates/showcase/manage_datasets.html
+6 −8 ckanext/showcase/templates/showcase/new_package_form.html
+7 −9 ckanext/showcase/templates/showcase/read.html
+5 −5 ckanext/showcase/templates/showcase/search.html
+0 −1 ckanext/showcase/templates/showcase/snippets/ckeditor_asset.html
+0 −1 ckanext/showcase/templates/showcase/snippets/ckeditor_content_css_asset.html
+0 −1 ckanext/showcase/templates/showcase/snippets/ckeditor_content_css_resource.html
+0 −1 ckanext/showcase/templates/showcase/snippets/ckeditor_resource.html
+1 −2 ckanext/showcase/templates/showcase/snippets/helper.html
+0 −1 ckanext/showcase/templates/showcase/snippets/showcase_css_asset.html
+0 −1 ckanext/showcase/templates/showcase/snippets/showcase_css_resource.html
+1 −1 ckanext/showcase/templates/showcase/snippets/showcase_info.html
+3 −5 ckanext/showcase/templates/showcase/snippets/showcase_item.html
+2 −3 ckanext/showcase/templates/showcase/snippets/tags.html
+1 −1 ckanext/showcase/tests/action/test_get.py
+0 −2 ckanext/showcase/tests/fixtures.py
+25 −10 ckanext/showcase/tests/test_auth.py
+81 −72 ckanext/showcase/tests/test_plugin.py
+122 −255 ckanext/showcase/utils.py
+22 −12 ckanext/showcase/views.py
+3,396 −9,083 package-lock.json
+24 −56 package.json
+0 −1 requirements.txt
+7 −8 setup.py
+31 −22 webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-

import six
from ckan.lib.navl.validators import (not_empty)

from ckanext.sixodp_showcase.logic.validators import (convert_package_name_or_id_to_id_for_type_apiset)
from ckanext.showcase.logic.validators import (convert_package_name_or_id_to_id_for_type_showcase)
from ckantoolkit import unicode_safe


def showcase_apiset_association_create_schema():
schema = {
'package_id': [not_empty, six.text_type,
'package_id': [not_empty, unicode_safe,
convert_package_name_or_id_to_id_for_type_apiset],
'showcase_id': [not_empty, six.text_type,
'showcase_id': [not_empty, unicode_safe,
convert_package_name_or_id_to_id_for_type_showcase]
}
return schema
Expand All @@ -23,15 +23,15 @@ def showcase_apiset_association_delete_schema():

def showcase_apiset_list_schema():
schema = {
'showcase_id': [not_empty, six.text_type,
'showcase_id': [not_empty, unicode_safe,
convert_package_name_or_id_to_id_for_type_showcase]
}
return schema


def apiset_showcase_list_schema():
schema = {
'package_id': [not_empty, six.text_type,
'package_id': [not_empty, unicode_safe,
convert_package_name_or_id_to_id_for_type_showcase]
}
return schema
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def _add_to_pkg_dict(self, context, pkg_dict):
return pkg_dict

# IPackageController
def after_show(self, context, data_dict):
def after_dataset_show(self, context, data_dict):
if context.get('for_edit') is not True:
if data_dict.get('notifier', None) is not None:
data_dict.pop('notifier')
Expand All @@ -189,7 +189,7 @@ def after_show(self, context, data_dict):

return self._add_to_pkg_dict(context, data_dict)

def before_index(self, data_dict):
def before_dataset_index(self, data_dict):
if data_dict.get('platform'):
data_dict['vocab_platform'] = [tag for tag in data_dict['platform'].split(',')]

Expand All @@ -208,7 +208,7 @@ def before_index(self, data_dict):

return data_dict

def after_search(self, search_results, search_params):
def after_dataset_search(self, search_results, search_params):
if(search_results['search_facets'].get('groups')):
context = {'for_view': True, 'with_private': False}
data_dict = {
Expand All @@ -232,4 +232,4 @@ def after_search(self, search_results, search_params):
# IClick

def get_commands(self):
return cli.get_commands()
return cli.get_commands()
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{% extends 'showcase/edit_base.html' %}

{% block subtitle %}{{ _('Showcases - Add datasets') }}{% endblock %}

{% block wrapper_class %} ckanext-showcase-edit-wrapper{% endblock %}

{% block ckanext_showcase_edit_span %}span12{% endblock %}

{% block primary_content_inner %}
<section class="module">
<div class="module-content">
{% block form %}
{% set facets = {
'fields': c.fields_grouped,
'search': c.search_facets,
'titles': c.facet_titles,
'translated_fields': c.translated_fields,
'remove_field': c.remove_field }
%}
{% set sorting = [
(_('Relevance'), 'score desc, metadata_created desc'),
(_('Name Ascending'), 'title_string asc'),
(_('Name Descending'), 'title_string desc'),
(_('Last Modified'), 'metadata_modified desc'),
(_('Popular'), 'views_recent desc') if g.tracking_enabled else (false, false) ]
%}
{% snippet 'snippets/search_form.html', type='dataset', query=c.q, sorting=sorting, sorting_selected=c.sort_by_selected, count=c.page.item_count, facets=facets, show_empty=request.params, error=c.query_error, fields=c.fields %}
{% endblock %}
<h3 class="page-heading">
{% block page_heading %}
{{ _('Datasets available to add to this showcase') }}
{% endblock %}
</h3>
{% block package_search_results_list %}
{% if c.page.items %}
<form method="POST" data-module="basic-form">
{#{% block errors %}{{ form.errors(error_summary) }}{% endblock %}#}
<table class="table table-bordered table-header table-hover table-bulk-edit table-edit-hover" data-module="table-selectable-rows">
<col width="8">
<col width="120">
<thead>
<tr>
<th></th>
<th class="table-actions">
<div class="btn-group">
<button name="bulk_action.showcase_add" value="add" class="btn" type="submit">
<i class="fa fa-plus icon-plus"></i>
{{ _('Add to Showcase') }}
</button>
</div>
</th>
</tr>
</thead>
<tbody>
{% for package in c.page.items %}
{% set truncate = truncate or 180 %}
{% set truncate_title = truncate_title or 80 %}
{% set title = package.title or package.name %}
{% set notes = h.markdown_extract(package.notes, extract_length=truncate) %}
<tr>
<td>
<input type="checkbox" name="dataset_{{ package.id }}">
</td>
<td class="context">
<h3 class="dataset-heading">
{{ h.link_to(h.truncate(title, truncate_title), h.url_for(package.type ~ '.read', id=package.name)) }}
</h3>
{% if notes %}
<p>{{ notes|urlize }}</p>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</form>
{% else %}
<p class="empty">{{ _('No datasets could be found') }}</p>
{% endif %}
{% endblock %}
</div>

{% block page_pagination %}
{{ c.page.pager(q=c.q) }}
{% endblock %}
</section>

{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% block form_actions %}
<div class="form-actions">
{% block delete_button %}
{% if form_style == 'edit' and h.check_access('ckanext_showcase_delete', {'id': data.id}) and not data.state == 'deleted' %}
{% if h.check_access('ckanext_showcase_delete', {'id': data.id}) and not data.state == 'deleted' %}
<a class="btn suomifi-button-secondary" href="{% url_for 'sixodp_showcase.delete', id=data.id %}" data-module="confirm-action" data-module-content="{{ _('Are you sure you want to delete this showcase?') }}">{% block delete_button_text %}<i class="far fa-trash"></i>{{ _('Delete') }}{% endblock %}</a>
{% endif %}
<a class="btn suomifi-button-secondary-noborder" href="{% url_for 'sixodp_showcase.search' %}">{{_("Abort")}}</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
(_('Relevance'), 'score desc, metadata_created desc'),
(_('Newest first'), 'metadata_created desc'),
(_('Oldest first'), 'metadata_created asc'),
(_('Popular'), 'views_recent desc') if g.tracking_enabled else (false, false)
(_('Popular'), 'views_recent desc') if g.tracking_enabled else (false, false),
(_('Name Ascending'), 'title_string asc'),
(_('Name Descending'), 'title_string desc'),
(_('Last Modified'), 'metadata_modified desc')]
Expand Down
Loading