Skip to content

Commit 95e8f8c

Browse files
revert changes to changelog
1 parent 6b74216 commit 95e8f8c

File tree

1 file changed

+166
-2
lines changed

1 file changed

+166
-2
lines changed

CHANGELOG.md

Lines changed: 166 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,172 @@ and this project attempts to adhere to [Semantic Versioning](https://semver.org/
1818

1919
## [Unreleased]
2020

21-
### New Contributors!
21+
## [0.11.0]
22+
23+
### Fixed
24+
25+
- Checking whether a `NavItem` or `NavGroup` is active now takes into account the URL scheme and domain name for both the nav item and request.
26+
27+
## [0.10.0]
28+
29+
### Added
30+
31+
- Support for Python 3.13.
32+
33+
### Changed
34+
35+
- Bumped `django-twc-package` template to v2024.23.
36+
- Removed `westerveltco/setup-ci-action` from GitHub Actions workflows.
37+
38+
## [0.9.0]
39+
40+
### Changed
41+
42+
- Updated `NavItem.get_active` to allow for using URLs that contain query strings.
43+
44+
## [0.8.0]
45+
46+
### Changed
47+
48+
- Updated `NavItem.url` and `NavItem.get_url` to allow for using a callable. This allows `NavItem.url` to support `django.urls.reverse` or `django.urls.reverse_lazy` primarily, but it can be any callable as long as it returns a string.
49+
50+
## [0.7.0]
51+
52+
### Added
53+
54+
- `NavItem` and `NavGroup` now both have a `get_context_data` that returns the context needed for template rendering.
55+
- `NavItem` and `NavGroup` now both have a `get_url` method for returning the URL for the item.
56+
- `NavItem` and `NavGroup` now both have a `get_active` method for returning whether the item is active or not, meaning it's the URL currently being requested.
57+
- `NavItem` and `NavGroup` now both have a `check_permissions` method for checking whether the item should be rendered for a given request.
58+
- `NavItem` and `NavGroup` now support using a callable in the list of `permissions`. This callable should take an `HttpRequest` and return a `bool` indicating whether the item should be rendered for a given request.
59+
- The `Nav` class now has a `get_template` method that returns the template to render. This method takes an optional `template_name` argument, and if not provided is taken from the `get_template_name` method. If overridden, you can return a string as a way to embed a template directly in the `Nav` definition.
60+
- `NavItem` now has a `get_items` method. This is to aid a future refactor.
61+
62+
### Changed
63+
64+
- Internals of library have been refactored to slightly simplify it, including `Nav`, `NavGroup`, `NavItem` and the `django_simple_nav` templatetag.
65+
- `Nav.get_items` now returns a list of `NavGroup` or `NavItem`, instead of a list of `RenderedNavItem`.
66+
- Check for the existence of a user attached to the `request` object passed in to `django_simple_nav.permissions.check_item_permissions` has been moved to allow for an early return if there is no user. There are instances where the `django.contrib.auth` app can be installed, but no user is attached to the request object. This change will allow this function to correctly be used in those instances.
67+
- Now using v2024.20 of `django-twc-package`.
68+
- `NavGroup` is now marked as active if the request path matches it's URL (if set) **or** and of its items' URLs.
69+
70+
### Removed
71+
72+
- The `extra_context` attribute of `NavItem` and `NavGroup` now only renders the contents of the dictionary to the template context. Previously it did that as well as provided `extra_context` to the context. If this sounds confusing, that's because it kinda is. 😅 This basically just means instead of two places to get the extra context (`extra_context` and the keys provided within the `extra_context` attribute), there is now just one (the keys provided within the `extra_context` attribute).
73+
- `RenderedNavItem` has been removed and it's functionality refactored into both `NavItem` and `NavGroup`. This should not affect the public API of this library, but I thought it should be noted.
74+
- `django_simple_nav.permissions` module has been removed and it's functionality refactored into `NavItem`.
75+
- Dropped support for Django 3.2.
76+
77+
### Fixed
78+
79+
- `active` boolean for a `NavItem` should now accurately match the request URL, taking into account any potential nesting and a project's `APPEND_SLASH` setting.
80+
- The permissions check for `NavGroup` has been fixed to apply to the child items as well. Previously, it only checked the top-level permissions on the `NavGroup` instance itself. If the items within the `NavGroup` have permissions defined, they will now be checked and filtered out. If the check ends up filtering all of the items out and the `NavGroup` has no url set, then it will not be rendered.
81+
82+
## [0.6.0]
83+
84+
### Added
85+
86+
- Added two new methods to `Nav`: `get_items` and `get_template_name`. These should allow for further flexibility and customization of rendering the `Nav`.
87+
88+
### Changed
89+
90+
- Now using v2024.16 of `django-twc-package`.
91+
92+
### Fixed
93+
94+
- Active nav item matching is now correctly using the `url` property on `RenderedNavItem`.
95+
96+
## [0.5.1]
97+
98+
### Added
99+
100+
- Added the requisite `py.typed` file to the package, so that it plays nicely when type-checking in projects using `django-simple-nav`.
101+
102+
## [0.5.0]
103+
104+
### Added
105+
106+
- An number of examples have been added to a new `example` directory. These examples are intended to demonstrate various ways how to use `django-simple-nav` in a Django project and include basic usage and usage with some popular CSS frameworks.
107+
108+
### Changed
109+
110+
- `check_item_permission` now takes a `request` argument instead of a `user` argument.
111+
112+
### Fixed
113+
114+
- `check_item_permission` now explicitly checks if `django.contrib.auth` is installed before attempting to check if a user has a permission. If it is not, it will return `True` by default and log a warning.
115+
- The `request` object is now passed to `render_to_string` when rendering the navigation template, so that the `request` object is available in the template context. This allows for nesting the `django_simple_nav` template tag within another `django_simple_nav` template tag, and having the `request` object available in the nested template.
116+
117+
## [0.4.0]
118+
119+
### Added
120+
121+
- The `Nav` class now has two new methods: `get_context_data` and `render`. These methods are used to render the navigation to a template. These new methods give greater flexibility for customizing the rendering of the navigation, as they can be overridden when defining a new `Nav`.
122+
- `Nav.get_context_data` method takes a Django `HttpRequest` object and returns a dictionary of context data that can be used to render the navigation to a template.
123+
- `Nav.render` method takes a Django `HttpRequest` object and an optional template name and renders the navigation to a template, returning the rendered template as a string.
124+
125+
### Removed
126+
127+
- `Nav.render_from_request` method has been removed. This was only used within the template tag to render a `Nav` template from an `HttpRequest` object. It has been removed in favor of the new `Nav.get_context_data` and `Nav.render` methods.
128+
129+
## [0.3.0]
130+
131+
### Added
132+
133+
- `NavGroup` and `NavItem` now has a new `extra_context` attribute. This allows for passing additional context to the template when rendering the navigation, either via the extra attribute (`item.foo`) or the `extra_context` attribute itself (`item.extra_context.foo`).
134+
135+
### Changed
136+
137+
- Now using v2024.13 of `django-twc-package`.
138+
139+
### Fixed
140+
141+
- `RenderedNavItem.items` property now correctly returns a list of `RenderedNavItem` objects, rather than a list of `NavItem` objects. This fixes a bug where the properties that should be available (e.g. `active`, `url`, etc.) were not available when iterating over the `RenderedNavItem.items` list if the item was a `NavGroup` object with child items.
142+
143+
## [0.2.0]
144+
145+
### Added
146+
147+
- The `django_simple_nav` template tag can now take an instance of a `Nav` class, in addition to a `Nav` dotted path string. This should give greater flexibility for rendering a `Nav`, as it can now be overridden on a per-view/template basis.
148+
149+
### Changed
150+
151+
- Now using [`django-twc-package`](https://github.com/westerveltco/django-twc-package) template for repository and package structure.
152+
153+
## [0.1.0]
154+
155+
Initial release! 🎉
156+
157+
### Added
158+
159+
- A group of navigation classes -- `Nav`, `NavGroup`, and `NavItem` -- that can be used together to build a simple navigation structure.
160+
- `Nav` is the main container for a navigation structure.
161+
- `NavGroup` is a container for a group of `NavItem` objects.
162+
- `NavItem` is a single navigation item.
163+
- A `django_simple_nav` template tag that renders a `Nav` object to a template. The template tag takes a string represented the dotted path to a `Nav` object and renders it to the template.
164+
- Navigation item urls can be either a URL string (e.g. `https://example.com/about/` or `/about/`) or a Django URL name (e.g. `about-view`). When rendering out to the template, the template tag will resolve the URL name to the actual URL.
165+
- Navigation items also can take a list of permissions to control the visibility of the item. The permissions can be user attributes (e.g. `is_staff`, `is_superuser`, etc.) or a specific permission (e.g. `auth.add_user`).
166+
- Navigation items are marked as `active` if the current request path matches the item's URL. This is can be useful for highlighting the current page in the navigation.
167+
- A `Nav` object's template can either be set as a class attribute (`template_name`) or passed in as a keyword argument when rendering the template tag. This allows for easy customization of the navigation structure on a per-template or per-view basis.
168+
- Initial documentation.
169+
- Initial tests.
170+
- Initial CI/CD (GitHub Actions).
171+
172+
### New Contributors
22173

23174
- Josh Thomas <[email protected]> (maintainer)
175+
- Jeff Triplett [@jefftriplett](https://github.com/jefftriplett)
24176

25-
[unreleased]: https://github.com/westerveltco/django-simple-nav/commits/main/
177+
[unreleased]: https://github.com/westerveltco/django-simple-nav/compare/v0.11.0...HEAD
178+
[0.1.0]: https://github.com/westerveltco/django-simple-nav/releases/tag/v0.1.0
179+
[0.2.0]: https://github.com/westerveltco/django-simple-nav/releases/tag/v0.2.0
180+
[0.3.0]: https://github.com/westerveltco/django-simple-nav/releases/tag/v0.3.0
181+
[0.4.0]: https://github.com/westerveltco/django-simple-nav/releases/tag/v0.4.0
182+
[0.5.0]: https://github.com/westerveltco/django-simple-nav/releases/tag/v0.5.0
183+
[0.5.1]: https://github.com/westerveltco/django-simple-nav/releases/tag/v0.5.1
184+
[0.6.0]: https://github.com/westerveltco/django-simple-nav/releases/tag/v0.6.0
185+
[0.7.0]: https://github.com/westerveltco/django-simple-nav/releases/tag/v0.7.0
186+
[0.8.0]: https://github.com/westerveltco/django-simple-nav/releases/tag/v0.8.0
187+
[0.9.0]: https://github.com/westerveltco/django-simple-nav/releases/tag/v0.9.0
188+
[0.10.0]: https://github.com/westerveltco/django-simple-nav/releases/tag/v0.10.0
189+
[0.11.0]: https://github.com/westerveltco/django-simple-nav/releases/tag/v0.11.0

0 commit comments

Comments
 (0)