doc/book/en/development/webstdlib/baseviews.rst
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Mon, 12 Apr 2010 19:36:51 +0200
branchstable
changeset 5222 ed6905d98a5e
parent 3258 6536ee4f37f7
permissions -rw-r--r--
[doc/book] more flesh to views/primary view
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
~~~~~~~~~~
5222
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3258
diff changeset
    15
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    16
Special views
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
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    19
*noresult*
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    20
    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
    21
    (e.g. empty result set).
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    22
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    23
*final*
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    24
    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
    25
    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
    26
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    27
*null*
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    28
    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
    29
    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
    30
2474
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    31
Entity views
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    32
````````````
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    33
*incontext, outofcontext*
3258
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    34
    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
    35
    entity having to be displayed in or out of context
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    36
    (of another entity).  By default it respectively returns the
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    37
    result of `textincontext` and `textoutofcontext` wrapped in a link
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    38
    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
    39
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    40
*oneline*
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    41
    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
    42
    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
    43
    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
    44
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    45
List
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    46
`````
5222
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3258
diff changeset
    47
2474
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    48
*list*
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    49
    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
    50
    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
    51
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    52
*listitem*
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    53
    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
    54
5222
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3258
diff changeset
    55
*sameetypelist*
2474
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    56
    This view displays a list of entities of the same type, in HTML section (`<div>`)
5222
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3258
diff changeset
    57
    and call the view `sameetypelistitem` for each entity of the result set.
2474
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    58
5222
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3258
diff changeset
    59
*sameetypelistitem*
ed6905d98a5e [doc/book] more flesh to views/primary view
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 3258
diff changeset
    60
    This view redirects by default to the `listitem` view.
2474
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    61
3258
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    62
*csv*
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    63
    This view applies to entity groups, which are individually
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    64
    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
    65
    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
    66
    format.
6536ee4f37f7 update the documentation
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2474
diff changeset
    67
2474
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    68
Text entity views
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    69
~~~~~~~~~~~~~~~~~
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    70
*text*
2474
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    71
    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
    72
    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
    73
    `navigation.short-line-size` property if necessary.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    74
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    75
*textincontext, textoutofcontext*
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    76
    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
    77
    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
    78
    methods `.dc_title` and `.dc_long_title` of the entity.