doc/book/en/B1022-views-stdlib.en.txt
author Sandrine Ribeau <sandrine.ribeau@logilab.fr>
Wed, 22 Apr 2009 21:43:06 -0700
changeset 1440 4fc48f2a1748
parent 1331 2335945523f5
permissions -rw-r--r--
[doc] Typos and minor changes.

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

Predefined views in the library
```````````````````````````````

`CubicWeb` provides a lot of standard views. You can find them in
``cubicweb/web/views/``.

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:

*primary*
    Primary view of an entity, this is the view called by default when a single
    non final entity is in the result set and needs to be displayed. 
    This view is supposed to render a maximum of informations about the entity.

*text*
    This is the simplest text view for an entity. It displays the 
    title of an entity. It should not contain HTML.

*oneline*
    This is a hyper linked *text* view. Similar to the `secondary` view, 
    but called when we want the view to stand on a single line, or just 
    get a brief view. By default this view uses the
    parameter `MAX_LINE_CHAR` to control the result size.

*secondary*
    This is a combinaison of an icon and a *oneline* view.
    By default it renders the two first attributes of the entity as a 
    clickable link redirecting to the primary view.

*incontext, outofcontext*
    Similar to the `secondary` view, but called when an entity is considered
    as in or out of context. By default it respectively returns the result of 
    `textincontext` and `textoutofcontext` wrapped in a link leading to 
    the primary view of the entity.

*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.

*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.

*rss*
    Creates a RSS/XML view and call the view `rssitem` for each entity of
    the result set.

*rssitem*
    Create a RSS/XML view for each entity based on the results of the dublin core
    methods of the entity (`dc_*`)

*sidebox*
  This view displays usually a side box of some related entities 
  in a primary view.

  
Start view (e.g. views that don't apply to a result set):

*index*
    This view defines the home page of your application. It does not require
    a result set to apply to.

*schema*
    A view dedicated to the display of the schema of the application

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.

*table*
    Creates a HTML table (`<table>`) and call the view `cell` for each cell of
    the result set. Applicable on any result set.

*cell*
    By default redirects to the `final` view if this is a final entity or
    `outofcontext` view otherwise

*null*
    This view is the default view used when nothing needs to be rendered.
    It is always applicable and it does not return anything