doc/book/en/development/devweb/views/baseviews.rst
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Fri, 16 Apr 2010 16:40:25 +0200
branchstable
changeset 5312 d2dbba898a96
parent 5266 84f285d96363
permissions -rw-r--r--
[doc/book] misc on views, docstrings

.. -*- coding: utf-8 -*-

Base views
----------

*CubicWeb* provides a lot of standard views, that can be found in
 :mod:`cubicweb.web.views` and :mod:`cubicweb.web.views.baseviews`.

A certain number of views are used to build the web interface, which
apply to one or more entities. Their identifier is what distinguish
them from each others and the main ones are:

HTML views
~~~~~~~~~~

Special views
`````````````

*noresult*
    This view is the default view used when no result has been found
    (e.g. empty result set).

*final*
    Display the value of a cell without trasnformation (in case of a non final
    entity, we see the eid). Applicable on any result set.

.. note::

   `final` entities are merely attributes.

*null*
    This view is the default view used when nothing needs to be rendered.
    It is always applicable.

Entity views
````````````

*incontext, outofcontext*
    Those are used to display a link to an entity, depending on the
    entity having to be displayed in or out of context
    (of another entity).  By default it respectively produces the
    result of `textincontext` and `textoutofcontext` wrapped in a link
    leading to the primary view of the entity.

*oneline*
    This view is used when we can't tell if the entity should be considered as
    displayed in or out of context.  By default it produces the result of `text`
    in a link leading to the primary view of the entity.

List
`````

*list*
    This view displays a list of entities by creating a HTML list (`<ul>`)
    and call the view `listitem` for each entity of the result set.

*listitem*
    This view redirects by default to the `outofcontext` view.

*sameetypelist*
    This view displays a list of entities of the same type, in HTML section (`<div>`)
    and call the view `sameetypelistitem` for each entity of the result set.

*sameetypelistitem*
    This view redirects by default to the `listitem` view.

*csv*
    This view applies to entity groups, which are individually
    displayed using the `incontext` view. It displays each entity as a
    coma separated list. It is NOT related to the well-known text file
    format.

Text entity views
~~~~~~~~~~~~~~~~~

*text*
    This is the simplest text view for an entity. By default it returns the
    result of the `.dc_title` method, which is cut to fit the
    `navigation.short-line-size` property if necessary.

*textincontext, textoutofcontext*
    Similar to the `text` view, but called when an entity is considered out or
    in context. By default it returns respectively the result of the
    methods `.dc_title` and `.dc_long_title` of the entity.