-
Notifications
You must be signed in to change notification settings - Fork 0
Escondiendo IATI #22
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
Escondiendo IATI #22
Conversation
@@ -12,6 +12,11 @@ | |||
@iati_blueprint.route("/<package_id>", methods=["GET"]) | |||
@require_sysadmin_user | |||
def iati_page(package_id): | |||
# Revisión del flag de configuración | |||
hide_tab = toolkit.asbool(toolkit.config.get("ckanext.iati_generator.hide_tab", 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.
Add this new setting to the Config settings readme section https://github.com/okfn/ckanext-iati-generator?tab=readme-ov-file#config-settings.
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.
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.
Pull Request Overview
This PR adds a configuration option to hide the IATI tab from the dataset view interface. The change allows administrators to disable the IATI functionality through configuration without removing the code.
- Adds a new configuration option
ckanext.iati_generator.hide_tab
to control IATI tab visibility - Implements template helper function to check if IATI tab should be displayed
- Adds route-level protection to return 404 when the feature is disabled
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
ckanext/iati_generator/templates/package/read_base.html | Updates template condition to check both IATI tab enablement and sysadmin access |
ckanext/iati_generator/plugin.py | Implements ITemplateHelpers interface and adds helper function for tab visibility |
ckanext/iati_generator/blueprint/iati.py | Adds configuration check to abort with 404 when tab is disabled |
README.md | Documents the new hide_tab configuration option |
"iati_tab_enabled": lambda: not toolkit.asbool( | ||
toolkit.config.get("ckanext.iati_generator.hide_tab", 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.
[nitpick] Consider extracting the lambda function to a named method for better readability and testability. Lambda functions in helper dictionaries can be harder to debug and test.
"iati_tab_enabled": lambda: not toolkit.asbool( | |
toolkit.config.get("ckanext.iati_generator.hide_tab", False) | |
) | |
} | |
"iati_tab_enabled": self.is_iati_tab_enabled | |
} | |
def is_iati_tab_enabled(self): | |
"""Check if the IATI tab is enabled.""" | |
return not toolkit.asbool( | |
toolkit.config.get("ckanext.iati_generator.hide_tab", False) | |
) |
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <[email protected]>
fixes #21
Antes:

Ahora
