doc/book/en/development/webstdlib/baseviews.rst
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Tue, 02 Mar 2010 19:15:26 +0100
branchstable
changeset 4751 1a9d2c3c7f0c
parent 3258 6536ee4f37f7
child 5222 ed6905d98a5e
permissions -rw-r--r--
[book] more id -> __regid__
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     1
.. -*- coding: utf-8 -*-
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     2
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     3
Base views (:mod:`cubicweb.web.views.baseviews`)
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     4
------------------------------------------------
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     5
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
     6
*CubicWeb* provides a lot of standard views. You can find them in
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     7
``cubicweb/web/views/``.
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     8
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     9
A certain number of views are used to build the web interface, which apply
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    10
to one or more entities. Their identifier is what distinguish them from
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    11
each others and the main ones are:
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    12
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    13
HTML views
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    14
~~~~~~~~~~
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    15
Special views
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    16
`````````````
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    17
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    18
*noresult*
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    19
    This view is the default view used when no result has been found
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    20
    (e.g. empty result set).
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    21
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    22
*final*
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    23
    Display the value of a cell without trasnformation (in case of a non final
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    24
    entity, we see the eid). Applicable on any result set.
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    25
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    26
*null*
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    27
    This view is the default view used when nothing needs to be rendered.
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    28
    It is always applicable and it does not return anything
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    29
2474
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    30
Entity views
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    31
````````````
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    32
*incontext, outofcontext*
3258
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    33
    Those are used to display a link to an entity, depending on the
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    34
    entity having to be displayed in or out of context
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    35
    (of another entity).  By default it respectively returns the
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    36
    result of `textincontext` and `textoutofcontext` wrapped in a link
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    37
    leading to the primary view of the entity.
2474
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    38
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    39
*oneline*
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    40
    This view is used when we can't tell if the entity should be considered as
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    41
    displayed in or out of context.  By default it returns the result of `text`
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    42
    in a link leading to the primary view of the entity.
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    43
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    44
List
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    45
`````
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    46
*list*
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    47
    This view displays a list of entities by creating a HTML list (`<ul>`)
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    48
    and call the view `listitem` for each entity of the result set.
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    49
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    50
*listitem*
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    51
    This view redirects by default to the `outofcontext` view.
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    52
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    53
*adaptedlist*
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    54
    This view displays a list of entities of the same type, in HTML section (`<div>`)
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    55
    and call the view `adaptedlistitem` for each entity of the result set.
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    56
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    57
*adaptedlistitem*
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    58
    This view redirects by default to the `outofcontext` view.
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    59
3258
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    60
*csv*
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    61
    This view applies to entity groups, which are individually
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    62
    displayed using the `incontext` view. It displays each entity as a
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    63
    coma separated list. It is NOT related to the well-known text file
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    64
    format.
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    65
2474
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    66
Text entity views
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    67
~~~~~~~~~~~~~~~~~
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    68
*text*
2474
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    69
    This is the simplest text view for an entity. By default it returns the
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    70
    result of the `.dc_title` method, which is cut to fit the
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    71
    `navigation.short-line-size` property if necessary.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    72
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    73
*textincontext, textoutofcontext*
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    74
    Similar to the `text` view, but called when an entity is considered out or
2172
cf8f9180e63e delete-trailing-whitespace
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 1714
diff changeset
    75
    in context. By default it returns respectively the result of the
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    76
    methods `.dc_title` and `.dc_long_title` of the entity.