Commit graph

28 commits

Author SHA1 Message Date
Juro Oravec
81c0d419b4
fix: Fix bug where JS and CSS were missing when {% component %} tag was inside {% include %} tag (#1300)
* fix: Fix bug where JS and CSS were missing when `{% component %}` tag was inside `{% include %}` tag

* refactor: fix mypy error
2025-07-20 23:42:59 +02:00
Oliver Haas
e0b718c314
test: test to illustrate bug in component caching when using include tag (#1135)
* test: test to illustrate bug in component caching when using include tag

* fix: add cleanup for render context in component rendering

* refactor: clarify cleanup comment in component rendering logic

* refactor: fix linter errors

* test: formatting and unnecessary test setup

---------

Co-authored-by: Juro Oravec <juraj.oravec.josefson@gmail.com>
2025-04-20 11:53:06 +02:00
lilian D
58d4c78671
Bug : Relative path in extends and include does not work when using template_file (#976)
Co-authored-by: Juro Oravec <juraj.oravec.josefson@gmail.com>
2025-02-16 13:29:37 +01:00
Juro Oravec
85fc6e3497
fix: TemplateDoesNotExist when using {% extends %} on main template and two components with same parent template (#862) 2024-12-23 12:58:03 +01:00
Juro Oravec
ab059f362d
Multi-line tag support, watch component files, and cleanup (#624)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-28 07:46:48 +02:00
Juro Oravec
8ca2814ee3
feat: dependency injection with inject/provide (#506) 2024-06-01 10:51:21 +02:00
Juro Oravec
b8ff610a48
fix: compat with block tag in django mode (#511)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-30 08:34:58 +02:00
Juro Oravec
8c4a55901c tests: add inline syntax highlight, inline template files 2024-05-02 22:33:02 +02:00
Juro Oravec
e566d8ecbb
fix: loader tags compatibility (#468) 2024-05-02 22:24:49 +02:00
Juro Oravec
3fc90e4956
feat: merge context settings, replace if_filled tag with var
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-01 20:55:09 +02:00
Juro Oravec
981eb59cf1
feat: Allow multiple slots with the same name in the same template
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-29 15:09:25 +02:00
Emil Stenström
edf3885632 Replace all instances of component_block with component. Remove duplicate tests. 2024-02-21 22:38:06 +01:00
Emil Stenström
ef6a082238 Remove component tag in favour of component_block. 2024-02-21 22:38:06 +01:00
VojtechPetru
9fd53436d7
Fix - fill inside loop (#273)
* simple iteration fill test case

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* a couple more tests

* distinguish between filled & default value

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: adriaan <lemontheme@gmail.com>
2023-05-18 15:46:46 +02:00
adriaan
2d86f042da
Implement #231 – default slot filling (#269)
* Add 'default' slot option + implicit fills; tests; docs
* Differentiate between standard fillnodes and implicitfillnodes on type lvl
* Reworking slot-fill rendering logic. Simplifying component interfact. Add new get_string_template method
* First working implementation of chainmap instead of stacks for slot resolution
* Stop passing FillNode to Component initalizer -> better decoupling
* Treat fill name and alias and component name as filterexpression, dropping namedvariable
* Name arg of if_filled tags and slots must be string literal
2023-05-18 14:58:46 +02:00
adriaan
7544bd10e2
Add regression test for #239 (broke extends tags) + minor tweaks (#247) 2023-03-23 21:38:08 +01:00
lemontheme
898d148382 Add required kwd to slot tag and add test
Move required slot check to SlotNode.render(); clean up needed

Remove unused code; drop caching

Update docs

Incorporate PR feedback
2023-03-14 23:40:21 +01:00
lemontheme
a8dfcce24e Introduce {% fill %} replacing 'fill' func of 'slot' tag
Partial implementation fill-tags plus update tests

Implement {% fill %} tags. Next: update tests.

Bring back support for {%slot%} blocks for bckwrd-compat and implement ambig. resolution policy

Update tests to use fill blocks. Add extra checks that raise errors

Add new tests for fill-slot nesting

Update README. Editing still required

remove unused var ctxt after flake8 complaint

fix flake8 warning about slotless f-string

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Add new slot aliases in fill context. Clean up rendering logic in Component. Update docs.

fix flake8, isort, black errors

Refactor duplicated name validation

Add if_filled tag + elif_filled...else_filled...endif_filled for cond. slots

Fix mistake in do_if_filled() docstring

Upload templates for tests! D'oh

Incorporate PR feedback

Drop Literal type hint; Use isort off-on instead of skip in tests

Treat all fill,slot,if_filled,component names as variables

Reset sampleproject components

Add test for variable filled name

Update examples in docs
2023-03-14 23:40:21 +01:00
Emil Stenström
a5bd0cf2e3
Rework slot management to avoid nodelist copying (fixes #64)
Co-authored-by: rbeard0330 <@dul2k3BKW6m>
2021-05-30 18:46:11 +02:00
rbeard0330
070b754d24 Improve slot handling to allow nested components, conditional slots, and slot.super (Fixes #33, #34, #37)
Co-authored-by: rbeard0330 <@dul2k3BKW6m>
2021-05-26 00:59:46 +02:00
Emil Stenström
57a5aa0f4b
Only render dependencies that are used of a specific page (#52)
Co-authored-by: rbeard0330 <@dul2k3BKW6m>
2021-03-24 22:47:48 +01:00
Emil Stenström
475bc8720f Add tests for components with dynamic template. 2021-02-20 10:04:10 +01:00
rbeard0330
93b8a7404a
Rework of context handling (#18)
Co-authored-by: rbeard0330 <@dul2k3BKW6m>
2020-12-28 10:40:35 +01:00
rbeard0330
be0a75e2a3
Missing context variables and kwargs in component_block (#17)
* Fix issue with missing variables by binding template to context in Component.render method.
* Pass extra_context to Component.render()

Co-authored-by: rbeard0330 <@dul2k3BKW6m>
2020-12-14 18:25:36 +01:00
Emil Stenström
d1405dda13 Add slots to components that can be filled when using component. 2020-06-06 09:11:27 +02:00
Emil Stenström
9d48a8e93f Add test for passing two variables to template tag. 2019-11-24 11:17:17 +01:00
Emil Stenström
701e1e3ac2 Add test for more complex template that uses built-in django filter. 2019-11-24 11:10:14 +01:00
Emil Stenström
6492081b64 Add render() and render_dependencies() to Compoent. 2015-06-12 22:15:09 +02:00