From 8b026b46c5a50f6b312a2a5f8b2bb27136f6e902 Mon Sep 17 00:00:00 2001 From: Tibor Leupold Date: Thu, 22 Feb 2024 16:39:41 -0800 Subject: [PATCH 1/3] Don't end sentence with colon if not necessary --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0450fe3..9bf7053 100644 --- a/README.md +++ b/README.md @@ -219,9 +219,10 @@ A couple more examples of how components can be used can be found [below](#patte #### Using the parent context You may have noticed in the above examples that the `render_html` and `get_context_data` methods take a `parent_context` argument. -This is the context of the template that is calling the component. +This is the context of the template that is rendering the component. The `parent_context` is passed into the `render_html` method by the `{% component %}` template tag. -In the default implementation of the `render_html` method, the `parent_context` is then passed to the `get_context_data` method. + +In the default implementation of the `render_html` method, the `parent_context` is passed to the `get_context_data` method. The default implementation of the `get_context_data` method, however, ignores the `parent_context` argument and returns an empty dictionary. To make use of it, you will have to override the `get_context_data` method. @@ -289,7 +290,7 @@ Specifically, the keywords `with`, `only` and `as` are supported, similar to how #### Provide additional parent context variables with `with` -You can pass additional parent context variables to the component using the keyword `with`: +You can pass additional parent context variables to the component using the `with` keyword. ```html+django {% component welcome with name=request.user.first_name %} @@ -301,7 +302,7 @@ For more information see the above section on the [parent context](#using-the-pa #### Limit the parent context variables with `only` -To limit the parent context variables passed to the component to only those variables provided by the `with` keyword (and no others from the calling template's context), use `only`: +To limit the parent context variables passed to the component to only those variables provided by the `with` keyword (and no others from the calling template's context), use `only`. ```html+django {% component welcome with name=request.user.first_name only %} @@ -311,7 +312,7 @@ To limit the parent context variables passed to the component to only those vari #### Store the rendered output in a variable with `as` -To store the component's rendered output in a variable rather than outputting it immediately, use `as` followed by the variable name: +To store the component's rendered output in a variable rather than outputting it immediately, use `as` followed by the variable name. ```html+django {% component welcome as welcome_html %} From f2664e4364427565a734bb97ffa226fd07ec793a Mon Sep 17 00:00:00 2001 From: Tibor Leupold Date: Thu, 22 Feb 2024 16:41:20 -0800 Subject: [PATCH 2/3] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9bf7053..9b3204f 100644 --- a/README.md +++ b/README.md @@ -368,7 +368,7 @@ Once you have defined the assets on the component in one of the two ways above, This, again, works in the same way as it does for Django form widgets. The component instance will have a `media` property which returns an instance of the `django.forms.Media` class. This is the case, even if you used the nested `Media` class to define the assets. -The [string representation of a `Media` objects](https://docs.djangoproject.com/en/5.0/topics/forms/media#s-media-objects) are the HTML declarations to include the assets. +The [string representation of `Media` objects](https://docs.djangoproject.com/en/5.0/topics/forms/media#s-media-objects) are the HTML declarations to include the assets. In the example home template from above, we can output the component's media declarations like so: From a0588294cb5f945706b2c047ccc8ddd522bbb0aa Mon Sep 17 00:00:00 2001 From: Tibor Leupold Date: Thu, 22 Feb 2024 16:55:43 -0800 Subject: [PATCH 3/3] Add emoji --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b3204f..0896e96 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Laces +# Laces 👟 [![License: BSD-3-Clause](https://img.shields.io/github/license/tbrlpld/laces)](https://github.com/tbrlpld/laces/blob/main/LICENSE) [![PyPI version](https://img.shields.io/pypi/v/laces)](https://pypi.org/project/laces/)