torchbox/wagtail — pull request #419 by gasman (2014-07-03 14:56:45+00:00)
Title: Use serve_preview() rather than serve() for all preview / moderation / view_draft actions

Ticket #253 sets a precedent for allowing additional args/kwargs to be passed to Page.serve(), and this will be formalised further when we decouple the route/serve methods as part of the front end permissions feature.

If a page model's serve method *requires* these extra args/kwargs, it is no longer possible to call serve() in isolation - as we currently do during moderation and 'view draft' - since there's no way for the admin backend to know which args/kwargs to pass.

A partial solution for this already exists, in the form of the 'page modes' system used for previews. This PR extends and adapts the page modes system so that it can be used for moderation and 'view draft':

* Standardised naming: consistently use the name 'preview modes' rather than 'page modes' / 'display modes'
* Change the `get_page_modes()` method to a `preview_modes` property
* Formalise the convention of the first item in the `preview_modes` list being the 'default' mode (to use when the user does not explicitly specify one), accessible as `default_preview_mode`
* Deprecate the `show_as_mode` method in favour of `serve_preview` which additionally takes a 'request' argument - necessary to pass the appropriate bits of request state to show the moderation toolbar.
* Use serve_preview for all preview/moderation/view draft actions in the admin