joshuadavidthomas / django-bird

High-flying components for perfectionists with deadlines
https://django-bird.readthedocs.io
MIT License
37 stars 1 forks source link

Template resolution inconsistent with documentation #29

Open joshuadavidthomas opened 2 weeks ago

joshuadavidthomas commented 2 weeks ago

In the docs, I have the template resolution for components written down as:

When using {% bird accordion %}, the library will look for components in the following order:

  1. accordion/accordion.html
  2. accordion/index.html
  3. accordion.html

Link

However, in the actual code, it's the other way around:

https://github.com/joshuadavidthomas/django-bird/blob/1e27e57463c28a6e5b896a0624373dda98bccd40/src/django_bird/templatetags/django_bird.py#L158-L163

https://github.com/joshuadavidthomas/django-bird/blob/1e27e57463c28a6e5b896a0624373dda98bccd40/src/django_bird/templatetags/django_bird.py#L138-L147

(In case the variable names are not clear enough out of context.)

I think the correct order is in the documentation. It should go specific -> general, so the actual implementation should be adjusted.

Also, should throw in a specific unit test for this, the one there right now doesn't test for the potential of multiple templates for the same component. Link to test.