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

Datatables View Ext: Null / NoneType Front-End Label Option & Helper #7574

Merged
merged 11 commits into from May 21, 2023

Conversation

JVickery-TBS
Copy link
Contributor

@JVickery-TBS JVickery-TBS commented May 2, 2023

feat(frontend): added null label;

  • Added new config option ckan.null_label.
  • Added new helper get_null_label.
  • Used get_null_label in datatables view.

Fixes #

Added a new config option and helper to set labels for NoneType (or null from sql) string labels. This is to be used to display NoneType values on the front-end.

The new config option also supports a dict for i18n labels.

Included is its use in the datatableview plugin to display null datastore values with the label instead of it casting NoneType to the string of "None".

Features:

  • includes tests covering changes
  • includes updated documentation
  • includes user-visible changes
  • includes API changes
  • includes bugfix for possible backport

Please [X] all the boxes above that apply

- Added new config option `ckan.null_label`.
- Added new helper `get_null_label`.
- Used `get_null_label` in datatables view.
- Added change log file.
- Set return of `get_null_label` helper to blank string.
ckan/lib/helpers.py Outdated Show resolved Hide resolved
ckan/lib/helpers.py Outdated Show resolved Hide resolved
- Moved all code from core to datatablesview plugin.
@JVickery-TBS
Copy link
Contributor Author

@wardi okay the code has been moved to the datatablesview extension exclusively.

The config option name has been updated, and the declaration moved.

The helper has also been moved into datatablesview ext.

The config option has been simplified, so it will just be a string and the helper will now just return the value of the option, put through gettext.

If the option is not set, the helper will just return a blank string.

- Slightly improved return on the `get_helpers` implementation;moved condition into single lambda function.
- Fixed continual line over-indent.
@JVickery-TBS JVickery-TBS changed the title Null / NoneType Front-End Label Option & Helper Datatables View Ext: Null / NoneType Front-End Label Option & Helper May 3, 2023
@JVickery-TBS JVickery-TBS requested a review from wardi May 3, 2023 19:36
changes/7574.feature Outdated Show resolved Hide resolved
- Updated config option name in change log.
- Updated helper name.
- Moved helper function from lambda to helpers module.
- Added to change log.
- Fixed flake8 reportings.
@JVickery-TBS JVickery-TBS requested a review from wardi May 4, 2023 13:56
- Added empty string as default value to `ckan.datatables.null_label` declaration.
- Added encoding to helpers script.
- Used `toolkit.blanket.helpers` instead of `plugin.implements`.
@smotornyuk smotornyuk merged commit 2772aec into ckan:master May 21, 2023
8 checks passed
wardi added a commit to open-data/ckan that referenced this pull request Jun 22, 2023
JVickery-TBS pushed a commit to open-data/ckan that referenced this pull request Jun 27, 2023
Datatables View Ext: Null / NoneType Front-End Label Option & Helper
# Conflicts:
#	ckanext/datatablesview/blueprint.py
#	ckanext/datatablesview/config_declaration.yaml
#	ckanext/datatablesview/plugin.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants