Skip to content

modificando assets #19

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

modificando assets #19

wants to merge 1 commit into from

Conversation

germankay
Copy link
Collaborator

@germankay germankay commented Jun 18, 2025

fixes https://github.com/okfn/ckan-bcie/issues/222

Aparentemente es un problema con los nombres

@germankay germankay requested review from avdata99 and Copilot June 18, 2025 14:47
@germankay germankay added the bug Something isn't working label Jun 18, 2025
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 standardizes the asset bundle names by replacing the old ckanext-iati-generator-* prefixes with iati_generator-* to resolve asset loading errors (fixes issue #222).

  • Update template tags in base.html to reference the new bundle names
  • Change the plugin’s resource registration to match the renamed assets
  • Adjust webassets.yml entries and output paths for the CSS/JS bundles

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
ckanext/iati_generator/templates/base.html Swapped asset tags from ckanext-iati-generator-* to iati_generator-*
ckanext/iati_generator/plugin.py Renamed the second argument in toolkit.add_resource to "iati_generator"
ckanext/iati_generator/assets/webassets.yml Renamed both bundle keys and updated their output paths to use iati_generator
Comments suppressed due to low confidence (2)

ckanext/iati_generator/assets/webassets.yml:1

  • [nitpick] Consider choosing a consistent separator style for bundle names (e.g., all underscores: iati_generator_css or all hyphens: iati-generator-css) to avoid confusion when referencing assets.
iati_generator-css:

ckanext/iati_generator/plugin.py:22

  • Update any README or deployment documentation to reflect the new resource name (iati_generator) so that asset paths remain accurate for end users.
        toolkit.add_resource("assets", "iati_generator")

@avdata99
Copy link
Member

Te paso lo que tengo de otro proyecto andando como referencia @germankay

webassets.yml

ndx-js:
  filter: rjsmin
  output: ckanext-ndx/%(version)s-ndx.js
  contents:
    - js/file-upload.js
    - js/readMore.js
    - js/select-all.js
  extra:
    preload:
      - base/main

ndx-css:
  filter: cssrewrite
  output: ndx/%(version)s-ndx.css
  contents:
    - css/ndx-main.css

plugin.py

    def update_config(self, config_):
        ...
        toolkit.add_resource("assets", "ndx")

Uso en el HTML

  {% asset 'ndx/ndx-css' %}
  {% asset 'ndx/ndx-js' %}

@avdata99
Copy link
Member

Cambiaste de orden el CSS y el JS en el yml.
Eso hace dificil entender los cambios del PR

@avdata99
Copy link
Member

Creo que el error esta relacionado con esto
El archivo HTML dice

{% ckan_extends %}

{% block styles %}
    {{ super() }}
    {% asset 'ckanext-iati-generator-css' %}
{% endblock %}

{% block body_extras %}
    {{ super() }}
    {% asset 'ckanext-iati-generator-js' %}
{% endblock %}

Donde no se llama correctamente a los assets
Entiendo que se deben llamar usando el nombre usado toolkit.add_resource + / + nombre del webasset

Creo que
{% asset 'ckanext-iati-generator-css' %}
debería ser
{% asset 'ckanext-iati-generator/ckanext-iati-generator-css' %}

Tambien el otro require correccion
Parece que el error es en el HTML, se llama a un recurso que no se encuentra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants