Tweak code and docs based on feedback

pull/1150/head
Dan Braghis 2015-04-03 18:34:03 +01:00
rodzic 63672e0976
commit aa5fe7574b
4 zmienionych plików z 22 dodań i 16 usunięć

Wyświetl plik

@ -42,7 +42,7 @@ Changelog
* Added hook `construct_homepage_summary_items` for customising the site summary panel on the admin homepage
* No longer automatically tries to use Celery for sending notification emails
* Added "Add child page" button to admin userbar (Eric Drechsel)
* Renamed the `construct_wagtail_edit_bird` hook to `construct_wagtail_edit_bird`
* Renamed the `construct_wagtail_edit_bird` hook to `construct_wagtail_userbar`
0.8.6 (10.03.2015)

Wyświetl plik

@ -48,6 +48,12 @@ The available hooks are:
.. _construct_wagtail_userbar:
.. versionadded:: 0.3
.. versionchanged:: 1.0
The hook was renamed from ``construct_wagtail_edit_bird``
``construct_wagtail_userbar``
Add or remove items from the wagtail userbar. Add, edit, and moderation tools are provided by default. The callable passed into the hook must take the ``request`` object and a list of menu objects, ``items``. The menu item objects must have a ``render`` method which can take a ``request`` object and return the HTML string representing the menu item. See the userbar templates and menu item classes for more information.

Wyświetl plik

@ -87,7 +87,7 @@ Admin
* Added cache-control headers to all admin views. This allows Varnish/Squid/CDN to run on vanilla settings in front of a Wagtail site
* Date / time pickers now consistently use times without seconds, to prevent Javascript behaviour glitches when focusing / unfocusing fields
* Added hook ``construct_homepage_summary_items`` for customising the site summary panel on the admin homepage
* Renamed the ``construct_wagtail_edit_bird`` hook to ``construct_wagtail_edit_bird``
* Renamed the ``construct_wagtail_edit_bird`` hook to ``construct_wagtail_userbar``

Wyświetl plik

@ -17,13 +17,8 @@ def for_frontend(request, page_id):
AddPageItem(Page.objects.get(id=page_id)),
]
for fn in hooks.get_hooks('construct_wagtail_edit_bird'):
fn(request, items)
warnings.warn(
"The 'construct_wagtail_edit_bird' hook has been renamed to 'construct_wagtail_userbar'."
"Please update function '%s' in '%s'." % (fn.__name__, fn.__module__), RemovedInWagtail11Warning
)
# TODO: Remove in 1.1 release
run_deprecated_edit_bird_hook(request, items)
for fn in hooks.get_hooks('construct_wagtail_userbar'):
fn(request, items)
@ -49,13 +44,8 @@ def for_moderation(request, revision_id):
RejectModerationEditPageItem(PageRevision.objects.get(id=revision_id)),
]
for fn in hooks.get_hooks('construct_wagtail_edit_bird'):
fn(request, items)
warnings.warn(
"The 'construct_wagtail_edit_bird' hook has been renamed to 'construct_wagtail_userbar'."
"Please update function '%s' in '%s'." % (fn.__name__, fn.__module__), RemovedInWagtail11Warning
)
# TODO: Remove in 1.1 release
run_deprecated_edit_bird_hook(request, items)
for fn in hooks.get_hooks('construct_wagtail_userbar'):
fn(request, items)
@ -70,3 +60,13 @@ def for_moderation(request, revision_id):
return render(request, 'wagtailadmin/userbar/base.html', {
'items': rendered_items,
})
def run_deprecated_edit_bird_hook(request, items):
for fn in hooks.get_hooks('construct_wagtail_edit_bird'):
fn(request, items)
warnings.warn(
"The 'construct_wagtail_edit_bird' hook has been renamed to 'construct_wagtail_userbar'."
"Please update function '%s' in '%s'." % (fn.__name__, fn.__module__), RemovedInWagtail11Warning
)