1
Fork 0

Add bmoe872 to contributors.

This commit is contained in:
Adam Hill 2022-02-17 16:59:35 -05:00
parent 5988c1ef8e
commit 3faa402ccc
2 changed files with 5 additions and 4 deletions

View file

@ -18,7 +18,6 @@ Unsure whether you want to use a snippet link or embed? Embeds have complete fle
1. Add `"snippet-link"` and `"snippet-embed"` to the `features` keyword list argument when instantiating a `RichTextBlock`, e.g. `paragraph = RichTextBlock(features=["bold", "italic", "h1", "h2", "h3", "snippet-link", "snippet-embed"])` 1. Add `"snippet-link"` and `"snippet-embed"` to the `features` keyword list argument when instantiating a `RichTextBlock`, e.g. `paragraph = RichTextBlock(features=["bold", "italic", "h1", "h2", "h3", "snippet-link", "snippet-embed"])`
1. Create a frontend template to determine how the snippet model will be rendered. Frontend templates are required for a snippet to be selected and are discovered when they match a path like `{app_name}/{model_name}_snippet_link.html` and `{app_name}/{model_name}_snippet_embed.html`. For example, if you have an `Affiliate` snippet model in `affiliates/models.py`, then a file in `affiliates/templates/affiliates/affiliate_snippet_link.html` and `affiliates/templates/affiliates/affiliate_snippet_embed.html` would be required. 1. Create a frontend template to determine how the snippet model will be rendered. Frontend templates are required for a snippet to be selected and are discovered when they match a path like `{app_name}/{model_name}_snippet_link.html` and `{app_name}/{model_name}_snippet_embed.html`. For example, if you have an `Affiliate` snippet model in `affiliates/models.py`, then a file in `affiliates/templates/affiliates/affiliate_snippet_link.html` and `affiliates/templates/affiliates/affiliate_snippet_embed.html` would be required.
## Example use-case ## Example use-case
Wagtail is used for a content site that will display articles that have affiliate links embedded inside the content. Affiliate links have a snippet data model to store information with a URL, start, and end dates; the urls need to be rendered in such a way that JavaScript can attach an event listener to their clicks for analytics. Wagtail is used for a content site that will display articles that have affiliate links embedded inside the content. Affiliate links have a snippet data model to store information with a URL, start, and end dates; the urls need to be rendered in such a way that JavaScript can attach an event listener to their clicks for analytics.
@ -26,6 +25,7 @@ Wagtail is used for a content site that will display articles that have affiliat
When the content gets rendered, it uses the specific affiliate model to get the URL stored in the snippet model. If the affiliate's URL ever changes, the snippet can be changed in the Wagtail admin, and the all of the content will use the correct link when rendered. When the content gets rendered, it uses the specific affiliate model to get the URL stored in the snippet model. If the affiliate's URL ever changes, the snippet can be changed in the Wagtail admin, and the all of the content will use the correct link when rendered.
An example frontend template in `affiliates/templates/affiliates/affiliate_snippet_link.html` could be the following. An example frontend template in `affiliates/templates/affiliates/affiliate_snippet_link.html` could be the following.
``` ```
<a href="{{ object.url }}" data-vars-action="content-cta" data-vars-label="{{ object.slug }}" rel="sponsored"> <a href="{{ object.url }}" data-vars-action="content-cta" data-vars-label="{{ object.slug }}" rel="sponsored">
``` ```
@ -39,6 +39,7 @@ The package requires Wagtail 2.5 or above.
1. `poetry build` 1. `poetry build`
## Run tests ## Run tests
1. `poetry install` 1. `poetry install`
1. `poetry run pytest` 1. `poetry run pytest`
@ -46,7 +47,7 @@ The package requires Wagtail 2.5 or above.
- [Parbhat Puri](https://github.com/Parbhat) - [Parbhat Puri](https://github.com/Parbhat)
- [Adam Hill](https://github.com/adamghill/) - [Adam Hill](https://github.com/adamghill/)
- [Brady Moe](https://github.com/bmoe872/)
## License ## License

View file

@ -2,7 +2,7 @@
name = "wagtail-draftail-snippet" name = "wagtail-draftail-snippet"
version = "0.4.0" version = "0.4.0"
description = "Associate RichTextBlock text content to a snippet model." description = "Associate RichTextBlock text content to a snippet model."
authors = ["Parbhat Puri <me@parbhatpuri.com>", "Adam Hill <ahill@fool.com>"] authors = ["Parbhat Puri <me@parbhatpuri.com>", "Adam Hill <ahill@fool.com>", "Brady Moe <bmoe872@gmail.com>"]
repository = "https://github.com/themotleyfool/wagtail-draftail-snippet" repository = "https://github.com/themotleyfool/wagtail-draftail-snippet"
readme = "README.md" readme = "README.md"
license = "BSD-3-Clause" license = "BSD-3-Clause"