1 .. -*- coding: utf-8 -*- |
|
2 |
|
3 Predefined views in the library |
|
4 ``````````````````````````````` |
|
5 |
|
6 `CubicWeb` provides a lot of standard views. You can find them in |
|
7 ``cubicweb/web/views/``. |
|
8 |
|
9 A certain number of views are used to build the web interface, which apply |
|
10 to one or more entities. Their identifier is what distinguish them from |
|
11 each others and the main ones are: |
|
12 |
|
13 *primary* |
|
14 Primary view of an entity, this is the view called by default when a single |
|
15 non final entity is in the result set and needs to be displayed. |
|
16 This view is supposed to render a maximum of informations about the entity. |
|
17 |
|
18 *text* |
|
19 This is the simplest text view for an entity. It displays the |
|
20 title of an entity. It should not contain HTML. |
|
21 |
|
22 *oneline* |
|
23 This is a hyper linked *text* view. Similar to the `secondary` view, |
|
24 but called when we want the view to stand on a single line, or just |
|
25 get a brief view. By default this view uses the |
|
26 parameter `MAX_LINE_CHAR` to control the result size. |
|
27 |
|
28 *secondary* |
|
29 This is a combinaison of an icon and a *oneline* view. |
|
30 By default it renders the two first attributes of the entity as a |
|
31 clickable link redirecting to the primary view. |
|
32 |
|
33 *incontext, outofcontext* |
|
34 Similar to the `secondary` view, but called when an entity is considered |
|
35 as in or out of context. By default it respectively returns the result of |
|
36 `textincontext` and `textoutofcontext` wrapped in a link leading to |
|
37 the primary view of the entity. |
|
38 |
|
39 *textincontext, textoutofcontext* |
|
40 Similar to the `text` view, but called when an entity is considered out or |
|
41 in context. By default it returns respectively the result of the |
|
42 methods `.dc_title` and `.dc_long_title` of the entity. |
|
43 |
|
44 *list* |
|
45 This view displays a list of entities by creating a HTML list (`<ul>`) |
|
46 and call the view `listitem` for each entity of the result set. |
|
47 |
|
48 *listitem* |
|
49 This view redirects by default to the `outofcontext` view. |
|
50 |
|
51 *rss* |
|
52 Creates a RSS/XML view and call the view `rssitem` for each entity of |
|
53 the result set. |
|
54 |
|
55 *rssitem* |
|
56 Create a RSS/XML view for each entity based on the results of the dublin core |
|
57 methods of the entity (`dc_*`) |
|
58 |
|
59 *sidebox* |
|
60 This view displays usually a side box of some related entities |
|
61 in a primary view. |
|
62 |
|
63 |
|
64 Start view (e.g. views that don't apply to a result set): |
|
65 |
|
66 *index* |
|
67 This view defines the home page of your application. It does not require |
|
68 a result set to apply to. |
|
69 |
|
70 *schema* |
|
71 A view dedicated to the display of the schema of the application |
|
72 |
|
73 Special views: |
|
74 |
|
75 *noresult* |
|
76 This view is the default view used when no result has been found |
|
77 (e.g. empty result set). |
|
78 |
|
79 *final* |
|
80 Display the value of a cell without trasnformation (in case of a non final |
|
81 entity, we see the eid). Applicable on any result set. |
|
82 |
|
83 *table* |
|
84 Creates a HTML table (`<table>`) and call the view `cell` for each cell of |
|
85 the result set. Applicable on any result set. |
|
86 |
|
87 *cell* |
|
88 By default redirects to the `final` view if this is a final entity or |
|
89 `outofcontext` view otherwise |
|
90 |
|
91 *null* |
|
92 This view is the default view used when nothing needs to be rendered. |
|
93 It is always applicable and it does not return anything |
|