Skip to content

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

Merged
merged 4 commits into from
Jul 23, 2025
Merged

Escondiendo IATI #22

merged 4 commits into from
Jul 23, 2025

Conversation

germankay
Copy link
Collaborator

fixes #21

Antes:
image

Ahora
image

Copilot

This comment was marked as outdated.

@@ -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))
Copy link
Member

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.

Copy link
Collaborator Author

@germankay germankay Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@germankay germankay requested review from avdata99 and Copilot July 23, 2025 12:51
Copy link
Contributor

@Copilot Copilot AI left a 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

Comment on lines +48 to +51
"iati_tab_enabled": lambda: not toolkit.asbool(
toolkit.config.get("ckanext.iati_generator.hide_tab", False)
)
}
Copy link
Preview

Copilot AI Jul 23, 2025

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.

Suggested change
"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.

@germankay germankay merged commit 6ef3325 into main Jul 23, 2025
2 checks passed
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.

Esconder IATI por el momento
2 participants