wagtail-developer-reference 0.1.4__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {wagtail_developer_reference-0.1.4/wagtail_developer_reference.egg-info → wagtail_developer_reference-0.1.5}/PKG-INFO +20 -1
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/README.md +19 -0
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/pyproject.toml +1 -1
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/setup.py +1 -1
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/wagtail_developer_reference/templates/index.html +45 -1
- wagtail_developer_reference-0.1.5/wagtail_developer_reference/tests/test_registry.py +37 -0
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/wagtail_developer_reference/wagtail_hooks.py +5 -0
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5/wagtail_developer_reference.egg-info}/PKG-INFO +20 -1
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/wagtail_developer_reference.egg-info/SOURCES.txt +2 -1
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/MANIFEST.in +0 -0
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/setup.cfg +0 -0
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/wagtail_developer_reference/__init__.py +0 -0
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/wagtail_developer_reference/apps.py +0 -0
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/wagtail_developer_reference/migrations/0001_initial.py +0 -0
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/wagtail_developer_reference/migrations/__init__.py +0 -0
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/wagtail_developer_reference/models.py +0 -0
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/wagtail_developer_reference/templates/detail.html +0 -0
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/wagtail_developer_reference/tests/__init__.py +0 -0
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/wagtail_developer_reference/tests/test_auditor.py +0 -0
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/wagtail_developer_reference.egg-info/dependency_links.txt +0 -0
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/wagtail_developer_reference.egg-info/requires.txt +0 -0
- {wagtail_developer_reference-0.1.4 → wagtail_developer_reference-0.1.5}/wagtail_developer_reference.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wagtail-developer-reference
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: A visual auditing tool for Wagtail developers to track Page models and StreamField blocks.
|
|
5
5
|
Author-email: Four Digits <info@fourdigits.nl>
|
|
6
6
|
Project-URL: Homepage, https://github.com/fourdigits/wagtail-developer-reference
|
|
@@ -72,5 +72,24 @@ By default, no account can see the menu item or access the URLs. Superusers are
|
|
|
72
72
|
granted access automatically by this package; assign the permission directly or
|
|
73
73
|
through a group.
|
|
74
74
|
|
|
75
|
+
## Settings
|
|
76
|
+
|
|
77
|
+
### `WAGTAIL_DEVELOPER_REFERENCE_ALLOW_ALL_ADMIN_USERS`
|
|
78
|
+
|
|
79
|
+
Default: `False`.
|
|
80
|
+
|
|
81
|
+
Set this to `True` in your Django settings to allow all active, authenticated
|
|
82
|
+
users with access to the Wagtail admin (`wagtailadmin.access_admin`) to see the
|
|
83
|
+
**System Registry** menu item and access the Developer Reference URLs, without
|
|
84
|
+
assigning the additional Developer Reference permission:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
WAGTAIL_DEVELOPER_REFERENCE_ALLOW_ALL_ADMIN_USERS = True
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This includes active superusers. When omitted or set to `False`, the explicit
|
|
91
|
+
user or group permission described above is still required, including for
|
|
92
|
+
superusers.
|
|
93
|
+
|
|
75
94
|
## License
|
|
76
95
|
**Internal Use Only** - Copyright © 2026 Fourdigits. All rights reserved.
|
|
@@ -46,5 +46,24 @@ By default, no account can see the menu item or access the URLs. Superusers are
|
|
|
46
46
|
granted access automatically by this package; assign the permission directly or
|
|
47
47
|
through a group.
|
|
48
48
|
|
|
49
|
+
## Settings
|
|
50
|
+
|
|
51
|
+
### `WAGTAIL_DEVELOPER_REFERENCE_ALLOW_ALL_ADMIN_USERS`
|
|
52
|
+
|
|
53
|
+
Default: `False`.
|
|
54
|
+
|
|
55
|
+
Set this to `True` in your Django settings to allow all active, authenticated
|
|
56
|
+
users with access to the Wagtail admin (`wagtailadmin.access_admin`) to see the
|
|
57
|
+
**System Registry** menu item and access the Developer Reference URLs, without
|
|
58
|
+
assigning the additional Developer Reference permission:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
WAGTAIL_DEVELOPER_REFERENCE_ALLOW_ALL_ADMIN_USERS = True
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
This includes active superusers. When omitted or set to `False`, the explicit
|
|
65
|
+
user or group permission described above is still required, including for
|
|
66
|
+
superusers.
|
|
67
|
+
|
|
49
68
|
## License
|
|
50
69
|
**Internal Use Only** - Copyright © 2026 Fourdigits. All rights reserved.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "wagtail-developer-reference"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.5"
|
|
4
4
|
description = "A visual auditing tool for Wagtail developers to track Page models and StreamField blocks."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{name = "Four Digits", email = "info@fourdigits.nl" }]
|
|
@@ -39,6 +39,24 @@
|
|
|
39
39
|
}
|
|
40
40
|
.quick-search-item .type-tag { margin-right: 0.35rem; }
|
|
41
41
|
.registry-controls label { display: block; font-weight: bold; color: white; margin-bottom: 0.5rem; }
|
|
42
|
+
.registry-controls .usage-label { display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.5rem; }
|
|
43
|
+
.registry-controls .usage-label label { margin-bottom: 0; }
|
|
44
|
+
.usage-help { position: relative; display: inline-flex; }
|
|
45
|
+
.usage-help-icon {
|
|
46
|
+
background: transparent; border: 1px solid currentColor; border-radius: 50%;
|
|
47
|
+
color: white; cursor: help; font: bold 0.8rem serif;
|
|
48
|
+
width: 1.25rem; height: 1.25rem; padding: 0;
|
|
49
|
+
}
|
|
50
|
+
.usage-help-icon:focus-visible { outline: 2px solid #dcbd3d; outline-offset: 2px; }
|
|
51
|
+
.usage-help-tooltip {
|
|
52
|
+
display: none; position: absolute; top: 100%; right: 0; z-index: 20;
|
|
53
|
+
width: 16rem; max-width: calc(100vw - 3rem); padding: 0.75rem;
|
|
54
|
+
background: #222; border: 1px solid #dcbd3d; color: white;
|
|
55
|
+
font-size: 0.875rem; font-weight: normal; line-height: 1.5;
|
|
56
|
+
}
|
|
57
|
+
.usage-help:hover .usage-help-tooltip,
|
|
58
|
+
.usage-help:focus-within .usage-help-tooltip { display: block; }
|
|
59
|
+
.usage-help-tooltip[hidden] { display: none; }
|
|
42
60
|
.registry-controls input, .registry-controls select {
|
|
43
61
|
box-sizing: border-box; height: 2.5rem; width: 100%;
|
|
44
62
|
border: 1px solid #dcbd3d; background: #333; color: white; border-radius: 0;
|
|
@@ -133,7 +151,16 @@
|
|
|
133
151
|
<div class="registry-search"><label for="reg-search">Search Registry</label><input type="search" id="reg-search" name="q" value="{{ filters.q }}" placeholder="Name, field or site..."></div>
|
|
134
152
|
<div><label for="reg-filter">Component Type</label><select id="reg-filter" name="type"><option value="ALL" {% if filters.type == "ALL" %}selected{% endif %}>All</option><option value="PAGE" {% if filters.type == "PAGE" %}selected{% endif %}>Pages</option><option value="BLOCK" {% if filters.type == "BLOCK" %}selected{% endif %}>Blocks</option></select></div>
|
|
135
153
|
<div><label for="reg-site-filter">Site</label><select id="reg-site-filter" name="site"><option value="">All sites</option>{% for site in sites %}<option value="{{ site.id }}" {% if filters.site == site.id|stringformat:"s" %}selected{% endif %}>{{ site.site_name }}</option>{% endfor %}</select></div>
|
|
136
|
-
<div class="usage-range"
|
|
154
|
+
<div class="usage-range">
|
|
155
|
+
<span class="usage-label">
|
|
156
|
+
<label for="min-usage">Min usage</label>
|
|
157
|
+
<span class="usage-help">
|
|
158
|
+
<button id="min-usage-help" class="usage-help-icon" type="button" aria-label="About Min usage" aria-describedby="min-usage-tooltip"><span aria-hidden="true">i</span></button>
|
|
159
|
+
<span id="min-usage-tooltip" class="usage-help-tooltip" role="tooltip">Usage counts for pages, blocks, images and documents are only shown when Min usage is filled in. Enter 0 to include items with no usage, then apply the filters.</span>
|
|
160
|
+
</span>
|
|
161
|
+
</span>
|
|
162
|
+
<input id="min-usage" type="number" min="0" name="min_usage" value="{{ filters.min_usage }}" aria-describedby="min-usage-tooltip">
|
|
163
|
+
</div>
|
|
137
164
|
<div class="usage-range"><label for="max-usage">Max usage</label><input id="max-usage" type="number" min="0" name="max_usage" value="{{ filters.max_usage }}"></div>
|
|
138
165
|
<div class="filter-actions"><button type="submit" class="button">Apply Filters</button><a class="button button-secondary" href="{% url 'dev_reference' %}">Clear</a></div>
|
|
139
166
|
</form>
|
|
@@ -214,6 +241,23 @@
|
|
|
214
241
|
</div>
|
|
215
242
|
|
|
216
243
|
<script>
|
|
244
|
+
const usageHelp = document.getElementById("min-usage-help");
|
|
245
|
+
const usageTooltip = document.getElementById("min-usage-tooltip");
|
|
246
|
+
["mouseenter", "focus", "click"].forEach(eventName => {
|
|
247
|
+
usageHelp.addEventListener(eventName, () => {
|
|
248
|
+
usageTooltip.hidden = false;
|
|
249
|
+
usageTooltip.style.transform = "";
|
|
250
|
+
const tooltipLeft = usageTooltip.getBoundingClientRect().left;
|
|
251
|
+
if (tooltipLeft < 16) {
|
|
252
|
+
usageTooltip.style.transform = `translateX(${16 - tooltipLeft}px)`;
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
window.addEventListener("resize", () => { usageTooltip.hidden = true; });
|
|
257
|
+
document.addEventListener("keydown", event => {
|
|
258
|
+
if (event.key === "Escape") usageTooltip.hidden = true;
|
|
259
|
+
});
|
|
260
|
+
|
|
217
261
|
let currentSortColumn = -1;
|
|
218
262
|
let isSortAscending = true;
|
|
219
263
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from django.contrib.auth import get_user_model
|
|
2
|
+
from django.contrib.auth.models import Permission
|
|
3
|
+
from django.test import TestCase
|
|
4
|
+
from django.urls import reverse
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class RegistryHelpTests(TestCase):
|
|
8
|
+
def test_min_usage_help_is_available_without_applying_filters(self):
|
|
9
|
+
user = get_user_model().objects.create_superuser(
|
|
10
|
+
username="registry-admin", email="admin@example.com", password="password"
|
|
11
|
+
)
|
|
12
|
+
user.user_permissions.add(
|
|
13
|
+
Permission.objects.get(
|
|
14
|
+
content_type__app_label="wagtail_developer_reference",
|
|
15
|
+
codename="access_developer_reference",
|
|
16
|
+
)
|
|
17
|
+
)
|
|
18
|
+
self.client.force_login(user)
|
|
19
|
+
|
|
20
|
+
response = self.client.get(reverse("dev_reference"))
|
|
21
|
+
|
|
22
|
+
self.assertContains(response, '<label for="min-usage">Min usage</label>')
|
|
23
|
+
self.assertContains(
|
|
24
|
+
response,
|
|
25
|
+
'<button id="min-usage-help" class="usage-help-icon" type="button" '
|
|
26
|
+
'aria-label="About Min usage" aria-describedby="min-usage-tooltip">'
|
|
27
|
+
'<span aria-hidden="true">i</span></button>',
|
|
28
|
+
html=True,
|
|
29
|
+
)
|
|
30
|
+
self.assertContains(
|
|
31
|
+
response,
|
|
32
|
+
'<span id="min-usage-tooltip" class="usage-help-tooltip" role="tooltip">'
|
|
33
|
+
"Usage counts for pages, blocks, images and documents are only shown "
|
|
34
|
+
"when Min usage is filled in. Enter 0 to include items with no usage, "
|
|
35
|
+
"then apply the filters.</span>",
|
|
36
|
+
html=True,
|
|
37
|
+
)
|
|
@@ -9,6 +9,7 @@ from pathlib import Path
|
|
|
9
9
|
from typing import Any, Literal, Optional, TypedDict
|
|
10
10
|
from urllib.parse import urlencode
|
|
11
11
|
|
|
12
|
+
from django.conf import settings
|
|
12
13
|
from django.contrib.auth.decorators import user_passes_test
|
|
13
14
|
from django.contrib.contenttypes.models import ContentType
|
|
14
15
|
from django.core.exceptions import PermissionDenied
|
|
@@ -85,6 +86,10 @@ def user_can_access_developer_reference(user: Any) -> bool:
|
|
|
85
86
|
return False
|
|
86
87
|
if not getattr(user, "is_active", False):
|
|
87
88
|
return False
|
|
89
|
+
|
|
90
|
+
if getattr(settings, "WAGTAIL_DEVELOPER_REFERENCE_ALLOW_ALL_ADMIN_USERS", False):
|
|
91
|
+
return user.has_perm("wagtailadmin.access_admin")
|
|
92
|
+
|
|
88
93
|
return user.user_permissions.filter(
|
|
89
94
|
codename=ACCESS_PERMISSION_CODENAME,
|
|
90
95
|
content_type__app_label=ACCESS_PERMISSION_APP_LABEL,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wagtail-developer-reference
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: A visual auditing tool for Wagtail developers to track Page models and StreamField blocks.
|
|
5
5
|
Author-email: Four Digits <info@fourdigits.nl>
|
|
6
6
|
Project-URL: Homepage, https://github.com/fourdigits/wagtail-developer-reference
|
|
@@ -72,5 +72,24 @@ By default, no account can see the menu item or access the URLs. Superusers are
|
|
|
72
72
|
granted access automatically by this package; assign the permission directly or
|
|
73
73
|
through a group.
|
|
74
74
|
|
|
75
|
+
## Settings
|
|
76
|
+
|
|
77
|
+
### `WAGTAIL_DEVELOPER_REFERENCE_ALLOW_ALL_ADMIN_USERS`
|
|
78
|
+
|
|
79
|
+
Default: `False`.
|
|
80
|
+
|
|
81
|
+
Set this to `True` in your Django settings to allow all active, authenticated
|
|
82
|
+
users with access to the Wagtail admin (`wagtailadmin.access_admin`) to see the
|
|
83
|
+
**System Registry** menu item and access the Developer Reference URLs, without
|
|
84
|
+
assigning the additional Developer Reference permission:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
WAGTAIL_DEVELOPER_REFERENCE_ALLOW_ALL_ADMIN_USERS = True
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This includes active superusers. When omitted or set to `False`, the explicit
|
|
91
|
+
user or group permission described above is still required, including for
|
|
92
|
+
superusers.
|
|
93
|
+
|
|
75
94
|
## License
|
|
76
95
|
**Internal Use Only** - Copyright © 2026 Fourdigits. All rights reserved.
|
|
@@ -16,4 +16,5 @@ wagtail_developer_reference/migrations/__init__.py
|
|
|
16
16
|
wagtail_developer_reference/templates/detail.html
|
|
17
17
|
wagtail_developer_reference/templates/index.html
|
|
18
18
|
wagtail_developer_reference/tests/__init__.py
|
|
19
|
-
wagtail_developer_reference/tests/test_auditor.py
|
|
19
|
+
wagtail_developer_reference/tests/test_auditor.py
|
|
20
|
+
wagtail_developer_reference/tests/test_registry.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|