--- a/doc/book/en/devweb/views/breadcrumbs.rst Mon Jul 05 12:37:13 2010 +0200
+++ b/doc/book/en/devweb/views/breadcrumbs.rst Mon Jul 05 12:37:21 2010 +0200
@@ -8,11 +8,11 @@
~~~~~~~
Breadcrumbs are displayed by default in the header section (see
-:ref:`the_main_template_sections`). With the default main
-template, the header section is composed by the logo, the application
-name, breadcrumbs and, at the most right, the login box. Breadcrumbs
-are displayed just next to the application name, thus breadcrumbs
-begin with a separator.
+:ref:`the_main_template_sections`). With the default main template,
+the header section is composed by the logo, the application name,
+breadcrumbs and, at the most right, the login box. Breadcrumbs are
+displayed just next to the application name, thus they begin with a
+separator.
Here is the header section of the CubicWeb's forge:
@@ -22,29 +22,31 @@
:mod:`cubicweb.web.views.ibreadcrumbs`:
- `BreadCrumbEntityVComponent`: displayed for a result set with one line
- if the entity implements the ``IBreadCrumbs`` interface.
+ if the entity is adaptable to ``IBreadCrumbsAdapter``.
- `BreadCrumbETypeVComponent`: displayed for a result set with more than
- one line, but with all entities of the same type which implement the
- ``IBreadCrumbs`` interface.
+ one line, but with all entities of the same type which can adapt to
+ ``IBreadCrumbsAdapter``.
- `BreadCrumbAnyRSetVComponent`: displayed for any other result set.
Building breadcrumbs
~~~~~~~~~~~~~~~~~~~~
-The ``IBreadCrumbs`` interface is defined in the
-:mod:`cubicweb.interfaces` module. It specifies that an entity which
-implements this interface must have a ``breadcrumbs`` method.
+The ``IBreadCrumbsAdapter`` adapter is defined in the
+:mod:`cubicweb.web.views.ibreadcrumbs` module. It specifies that an
+entity which implements this interface must have a ``breadcrumbs`` and
+a ``parent_entity`` method. A default implementation for each is
+provided. This implementation expoits the ITreeAdapter.
.. note::
Redefining the breadcrumbs is the hammer way to do it. Another way
- is to define the `parent` method on an entity (as defined in the
- `ITree` interface). If available, it will be used to compute
- breadcrumbs.
+ is to define an `ITreeAdapter` adapter on an entity type. If
+ available, it will be used to compute breadcrumbs.
-Here is the API of the ``breadcrumbs`` method:
+Here is the API of the ``IBreadCrumbsAdapter`` class:
-.. automethod:: cubicweb.interfaces.IBreadCrumbs.breadcrumbs
+.. automethod:: cubicweb.web.views.ibreadcrumbs.IBreadCrumbs.parent_entity
+.. automethod:: cubicweb.web.views.ibreadcrumbs.IBreadCrumbs.breadcrumbs
If the breadcrumbs method return a list of entities, the
``cubicweb.web.views.ibreadcrumbs.BreadCrumbView`` is used to display