doc/book/en/development/webstdlib/baseviews.rst
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 24 Jul 2009 13:04:44 +0200
changeset 2474 23e8aa37b2df
parent 2175 16d3c37c5d28
child 3258 6536ee4f37f7
permissions -rw-r--r--
fix/enhance baseview doc
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*
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    33
    Those are used to display a link to an entity, depending if the entity is
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    34
    considered as displayed in or out of context (of another entity).  By default
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    35
    it respectively returns the result of `textincontext` and `textoutofcontext`
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    36
    wrapped 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
    37
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    38
*oneline*
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    39
    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
    40
    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
    41
    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
    42
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    43
List
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
    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
    47
    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
    48
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    49
*listitem*
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    50
    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
    51
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    52
*adaptedlist*
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    53
    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
    54
    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
    55
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    56
*adaptedlistitem*
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    57
    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
    58
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    59
Text entity views
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    60
~~~~~~~~~~~~~~~~~
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    61
*text*
2474
23e8aa37b2df fix/enhance baseview doc
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2175
diff changeset
    62
    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
    63
    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
    64
    `navigation.short-line-size` property if necessary.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    65
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    66
*textincontext, textoutofcontext*
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    67
    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
    68
    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
    69
    methods `.dc_title` and `.dc_long_title` of the entity.