Commit graph

105 commits

Author SHA1 Message Date
pre-commit-ci[bot]
c8a1915f58 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-02-21 22:38:06 +01:00
Emil Stenström
1f50ed0bd5 Add script to upgrade component syntax. 2024-02-21 22:38:06 +01: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
48fe8171b4 Reformat lines that became too long. And enforce 119 line length. 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
Dylan Castillo
bb639d45c6 Remove unnecessary print 2024-02-08 08:45:00 +01:00
Dylan Castillo
567c8ccc3d Fix for #290 2024-02-08 08:45:00 +01:00
pre-commit-ci[bot]
eac0cb6f4b [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-01-29 20:46:50 +00:00
Dylan Castillo
dc9f1b46b2
Fix issue #368 and add tests (#369) 2024-01-27 23:10:03 +01:00
Dylan Castillo
91b4accfeb
Render components as views (#366) (thanks @dylanjcastillo) 2024-01-24 22:36:57 +01:00
Dylan Castillo
90d41c6946 Make nodelist a public attribute 2024-01-19 16:09:54 +01:00
Dylan Castillo
560b721523 Change context behavior setting to enum 2024-01-15 21:58:42 +01:00
Dylan Castillo
4da76c178b Add setting to isolate components' context by default 2024-01-15 21:58:42 +01:00
Dylan Castillo
70a2a01400 Implement single file components 2024-01-14 22:36:55 +01:00
Dylan Castillo
27b35f32b9
Add startcomponent test cases and setup (#346) 2023-12-17 23:40:12 +01:00
Hanif Birgani
4753698765 fix(context): change context template in the template file and rename context dict keys with default values. 2023-10-09 22:28:11 +02:00
Hanif Birgani
ba436c0080 fix: raise command error if path or BASE_DIR not available 2023-10-09 22:28:11 +02:00
pre-commit-ci[bot]
4f4b81b7a0 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-10-09 22:28:11 +02:00
Hanif Birgani
58c7d55256 fix(management):
- Add `path` argument for custom component path
- Add `js`, `css`, `template` arguments for custom component script, style and template files
- Add `force` argument to force rewrite the existing component
- Add `verbose` option to make the command more informative
- Add `dry-run` option to simulate the command without writing to disk
- related #249
2023-10-09 22:28:11 +02:00
Hanif Birgani
af107910a6 fix(management):
- use `textwrap.dedent` for better readability
- remove unused comments from generated python file
- related #249
2023-10-09 22:28:11 +02:00
Hanif Birgani
a45bfdc837 fix(management): change a line to pass flake8. related #249 2023-10-09 22:28:11 +02:00
pre-commit-ci[bot]
deb17c6c70 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-10-09 22:28:11 +02:00
Hanif Birgani
825b0cbbaa feat(management): [WIP] add startcomponent management command. related #249 2023-10-09 22:28:11 +02:00
pre-commit-ci[bot]
6a633c67a8 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-09-29 16:06:52 +02:00
Roman Imankulov
a919b648b3 Add support for - and / in component names in middleware
- Fix the COMPONENT_COMMENT_REGEX to find component names with special symbols.
- Fix the test to catch the error.

Follow-up of e0c29e5 and ref: #262
2023-09-29 16:06:52 +02:00
Emil Stenström
e0c29e55b7 Add support for - and / in component names in middleware. 2023-09-03 11:44:40 +02:00
VojtechPetru
26bd72a9e2
Invalid slot more helpful message (#283)
* more helpful message when filling invalid slot name

* Update tests/test_templatetags.py

Co-authored-by: Emil Stenström <emil@emilstenstrom.se>

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

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

* add missing import; set -> typing.Set

* fix after rebase

* set -> typing.Set

* let -> typing.List

* Reduce duplicated effort; extend helpfulness; add extra comments

code qa

---------

Co-authored-by: Emil Stenström <emil@emilstenstrom.se>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: lemontheme <lemontheme@gmail.com>
2023-05-22 14:54:18 +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
Timothy
1bbd4a1f3c
Use valid script tag HTML to avoid console errors (#271) 2023-04-24 17:37:59 +02:00
vojtech
814f526658 ignore .pyc files in collectstatic 2023-04-22 01:27:35 +02:00
adriaan
6f49339c91
fix/263 performance regression (#264)
* Replace deep copies in Component.render
* Add 2nd example component to sampleproject
2023-04-13 14:20:43 +02:00
adriaan
fa41387a53
Introduce safer_staticfiles app as user-friendly security measure for #260 (#261)
* Introduce safer_staticfiles app to ignore .py,.html as security measure. Docs up-to-date

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-04-11 13:55:11 +02:00
lemontheme
bb181f47b0 Remove dangling comment 2023-04-06 16:08:17 +02:00
lemontheme
a47b007f67 Fix #250 (3.6 failing) by removing postponed eval of type hints. 2023-04-06 15:52:45 +02:00
Serafeim Papastefanos
f68390953a
Fix for #239 (#240)
* Fix for #239
* Improve patch
2023-03-20 17:06:00 +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
47af3151e2 Merge branch 'master' of https://github.com/EmilStenstrom/django-components 2023-02-09 22:15:51 +01:00
Emil Stenström
36237f0752 Make Media.css and Media.js optional. 2023-02-09 22:15:47 +01:00
pre-commit-ci[bot]
0996a14544 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-02-07 04:59:41 +00:00
Emil Stenström
9578ef16cd
Merge branch 'master' into master 2023-01-04 00:07:03 +01:00
Emil Stenström
b2a328d9ab Add *args and **kwargs to make typecheckers and linters happy. 2022-12-13 12:30:56 +01:00
Rafael P
dcbe0bccd1 Issue loading media when RENDER_DEPENDENCIES True 2022-07-31 20:18:41 -05:00
Emil Stenström
f5c3f64c86 Handle case with SETTINGS_MODULE not set. 2022-07-18 09:23:04 +02:00
Emil Stenström
681c540cb7 Can't use wahlrus operator in old pythons. 2022-07-18 09:21:10 +02:00
Emil Stenström
18ee5ad3b0 Autodetect components inside component subdirectories to make setup easier. 2022-07-18 09:13:03 +02:00
Emil Stenström
58c6e476f1 Automitically load component templates from directory where settings.py files is (old style), and from settings.py parent dir (new style). 2022-07-17 13:26:27 +02:00
Emil Stenström
29e6d1a4a0 Delay loading component until rendering, and clean up usage of component variable. 2022-07-14 12:47:06 +02:00
pre-commit-ci[bot]
16065367d5 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-07-14 10:34:34 +02:00
AIT ALI EL HOSAYN
bfd55f9fbe Component name as variable
I have removed the exception raising when a variable without quotes is given, and keep the variable name until the render function where I'm resolving it if it's a String (which means it's a variable, not a component) then I'm moving the slot parts which relies on the component from __init__ to render after getting the component.
2022-07-14 10:34:34 +02:00