|
1 .. -*- coding: utf-8 -*- |
|
2 |
|
3 Base views |
|
4 ---------- |
|
5 |
|
6 *CubicWeb* provides a lot of standard views, that can be found in |
|
7 :mod:`cubicweb.web.views` and :mod:`cubicweb.web.views.baseviews`. |
|
8 |
|
9 A certain number of views are used to build the web interface, which |
|
10 apply to one or more entities. Their identifier is what distinguish |
|
11 them from each others and the main ones are: |
|
12 |
|
13 HTML views |
|
14 ~~~~~~~~~~ |
|
15 |
|
16 Special views |
|
17 ````````````` |
|
18 |
|
19 *noresult* |
|
20 This view is the default view used when no result has been found |
|
21 (e.g. empty result set). |
|
22 |
|
23 *final* |
|
24 Display the value of a cell without trasnformation (in case of a non final |
|
25 entity, we see the eid). Applicable on any result set. |
|
26 |
|
27 .. note:: |
|
28 |
|
29 `final` entities are merely attributes. |
|
30 |
|
31 *null* |
|
32 This view is the default view used when nothing needs to be rendered. |
|
33 It is always applicable. |
|
34 |
|
35 Entity views |
|
36 ```````````` |
|
37 |
|
38 *incontext, outofcontext* |
|
39 Those are used to display a link to an entity, depending on the |
|
40 entity having to be displayed in or out of context |
|
41 (of another entity). By default it respectively produces the |
|
42 result of `textincontext` and `textoutofcontext` wrapped in a link |
|
43 leading to the primary view of the entity. |
|
44 |
|
45 *oneline* |
|
46 This view is used when we can't tell if the entity should be considered as |
|
47 displayed in or out of context. By default it produces the result of `text` |
|
48 in a link leading to the primary view of the entity. |
|
49 |
|
50 List |
|
51 ````` |
|
52 |
|
53 *list* |
|
54 This view displays a list of entities by creating a HTML list (`<ul>`) |
|
55 and call the view `listitem` for each entity of the result set. |
|
56 |
|
57 *listitem* |
|
58 This view redirects by default to the `outofcontext` view. |
|
59 |
|
60 *sameetypelist* |
|
61 This view displays a list of entities of the same type, in HTML section (`<div>`) |
|
62 and call the view `sameetypelistitem` for each entity of the result set. |
|
63 |
|
64 *sameetypelistitem* |
|
65 This view redirects by default to the `listitem` view. |
|
66 |
|
67 *csv* |
|
68 This view applies to entity groups, which are individually |
|
69 displayed using the `incontext` view. It displays each entity as a |
|
70 coma separated list. It is NOT related to the well-known text file |
|
71 format. |
|
72 |
|
73 Text entity views |
|
74 ~~~~~~~~~~~~~~~~~ |
|
75 |
|
76 *text* |
|
77 This is the simplest text view for an entity. By default it returns the |
|
78 result of the `.dc_title` method, which is cut to fit the |
|
79 `navigation.short-line-size` property if necessary. |
|
80 |
|
81 *textincontext, textoutofcontext* |
|
82 Similar to the `text` view, but called when an entity is considered out or |
|
83 in context. By default it returns respectively the result of the |
|
84 methods `.dc_title` and `.dc_long_title` of the entity. |