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
3022 IDatasetForm fixes #233
Conversation
Routes have the form `dataset-type_action`, eg `harvest_source_read` or `mydatasettype_edit`. This allows to build the url with url_for or nav_named_link from the controllers or templates.
This makes search queries much easier
When visiting the search page of a custom dataset type (eg /<my-type>), only datasets from this type are shown. On the main search page (/dataset), only standard datasets are shown, unless the config option `ckan.search.show_all_types` is set to True.
Also don't pass id on new action
This allows custom URLs like the ones from dataset types. Private function _url_with_params was duplicated on helpers.
This allows the Pager to generate URLs that point to the relevant dataset type page, and not /dataset.
This allows dataset type pages to show their own facets and have links pointing to the right direction.
@@ -273,7 +273,8 @@ def package_dictize(pkg, context): | |||
result_dict['isopen'] = pkg.isopen if isinstance(pkg.isopen,bool) else pkg.isopen() | |||
|
|||
# type | |||
result_dict['type']= pkg.type | |||
# if null assign the default value to make searching easier | |||
result_dict['type']= pkg.type if pkg.type else u'dataset' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about this result_dict['type'] = pkg.type or u'dataset'
Apart from the minor fixes this looks good to me. Thanks for removing that duplicate code in lib/helpers. I'll merge if you make the changes or tell me why they are a bad idea ;p |
else: | ||
# Unless changed via config options, don't show non standard | ||
# dataset types on the default search page | ||
if not asbool(config.get('ckan.search.show_all_types','False')): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pep8 if not asbool(config.get('ckan.search.show_all_types', 'False')):
space after comma
@tobes I fixed the issues you mentioned, let me know if you find something else |
I had to rename your migration file due to a conflict. now merged |
This is because package_type should not influence the page that is redirected to. The previous implementation had the problem that package_type is `package` by default which broke the redirection after editing the slug of a dataset.
This pull request adds fixes and new functionality to properly support dataset types on 2.0.
Some highlights:
type_action
(eg my-type_new, my-type_edit, ...) to allow generating the urls from extensions, etc. as a call to url_for with control, action etc did not generate a url for a non deafult typeAs reference, this branch of ckanext-harvest is using these changes to handle dataset types for harvest sources, and has custom templates, etc:
https://github.com/okfn/ckanext-harvest/tree/2.0-dataset-sources