author | Stephanie Marcu <stephanie.marcu@logilab.fr> |
Fri, 16 Apr 2010 11:40:33 +0200 | |
branch | stable |
changeset 5308 | c691a424d9e0 |
parent 5266 | 84f285d96363 |
child 5309 | e8567135a927 |
permissions | -rw-r--r-- |
5308
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
1 |
Breadcrumbs |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
2 |
----------- |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
3 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
4 |
Breadcrumbs are a navigation component to situate the user in the |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
5 |
arborescence's site. |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
6 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
7 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
8 |
Display |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
9 |
~~~~~~~ |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
10 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
11 |
Breadcrumbs are displayed by default in the header section (see |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
12 |
:ref:`the_main_template_sections`). With the default base template, |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
13 |
the header section is composed by the logo, the application name, |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
14 |
breadcrumbs and, at the most right, the login box. Breadcrumbs are |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
15 |
displayed just next to the application name, thus breadcrumbs begin |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
16 |
with a separator. |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
17 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
18 |
Here is the header section of the CubicWeb's forge: |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
19 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
20 |
.. image:: ../../../images/breadcrumbs_header.png |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
21 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
22 |
There are three breadcrumbs components defined in |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
23 |
``cubicweb/web/views/ibreadcrumbs.py`` file: |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
24 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
25 |
- BreadCrumbEntityVComponent: displayed for a result set with one line |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
26 |
if the entity implements the ``IBreadCrumbs`` interface. |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
27 |
- BreadCrumbETypeVComponent: displayed for a result set with more than |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
28 |
one line, but with all entities of the same type which implement the |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
29 |
``IBreadCrumbs`` interface. |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
30 |
- BreadCrumbAnyRSetVComponent: displayed for any other result set. |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
31 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
32 |
Implementation |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
33 |
~~~~~~~~~~~~~~ |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
34 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
35 |
The ``IBreadCrumbs`` interface is defined in the |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
36 |
``cubicweb/interfaces.py`` file. It specifies that an entity which |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
37 |
implements this interface must have a ``breadcrumbs`` method. |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
38 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
39 |
Here is the API of the ``breadcrumbs`` method: |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
40 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
41 |
.. automethod:: cubicweb.interfaces.IBreadCrumbs.breadcrumbs |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
42 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
43 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
44 |
If the breadcrumbs method return a list of entities, the |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
45 |
``cubicweb.web.views.ibreadcrumbs.BreadCrumbView`` is used to display |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
46 |
the first elements and the |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
47 |
``cubicweb.web.views.ibreadcrumbs.BreadCrumbTextView`` is used to |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
48 |
display the last one. |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
49 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
50 |
By default, for any entity, if recurs=True, breadcrumbs method returns |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
51 |
a list of entities, else a list of a simple string. |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
52 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
53 |
In order to see a hierarchical breadcrumbs, entities must have a |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
54 |
``parent`` method which returns the parent entity. By default this |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
55 |
method doesn't exist on entity, given that it can not be guessed. |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
56 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
57 |
XXX To change the default separator, you have to monkeypatch the |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
58 |
``BreadCrumbEntityVComponent.separator`` class attribute. |
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
59 |
|
c691a424d9e0
[doc/book] complete the breadcrumbs section
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
5266
diff
changeset
|
60 |
XXX add_to_breadcrumbs = False on an EntityView |