doc/book/en/development/webstdlib/baseviews.rst
brancholdstable
changeset 5422 0865e1e90674
parent 4985 02b52bf9f5f8
parent 5421 8167de96c523
child 5424 8ecbcbff9777
equal deleted inserted replaced
4985:02b52bf9f5f8 5422:0865e1e90674
     1 .. -*- coding: utf-8 -*-
       
     2 
       
     3 Base views (:mod:`cubicweb.web.views.baseviews`)
       
     4 ------------------------------------------------
       
     5 
       
     6 *CubicWeb* provides a lot of standard views. You can find them in
       
     7 ``cubicweb/web/views/``.
       
     8 
       
     9 A certain number of views are used to build the web interface, which apply
       
    10 to one or more entities. Their identifier is what distinguish them from
       
    11 each others and the main ones are:
       
    12 
       
    13 HTML views
       
    14 ~~~~~~~~~~
       
    15 Special views
       
    16 `````````````
       
    17 
       
    18 *noresult*
       
    19     This view is the default view used when no result has been found
       
    20     (e.g. empty result set).
       
    21 
       
    22 *final*
       
    23     Display the value of a cell without trasnformation (in case of a non final
       
    24     entity, we see the eid). Applicable on any result set.
       
    25 
       
    26 *null*
       
    27     This view is the default view used when nothing needs to be rendered.
       
    28     It is always applicable and it does not return anything
       
    29 
       
    30 Entity views
       
    31 ````````````
       
    32 *incontext, outofcontext*
       
    33     Those are used to display a link to an entity, depending on the
       
    34     entity having to be displayed in or out of context
       
    35     (of another entity).  By default it respectively returns the
       
    36     result of `textincontext` and `textoutofcontext` wrapped in a link
       
    37     leading to the primary view of the entity.
       
    38 
       
    39 *oneline*
       
    40     This view is used when we can't tell if the entity should be considered as
       
    41     displayed in or out of context.  By default it returns the result of `text`
       
    42     in a link leading to the primary view of the entity.
       
    43 
       
    44 List
       
    45 `````
       
    46 *list*
       
    47     This view displays a list of entities by creating a HTML list (`<ul>`)
       
    48     and call the view `listitem` for each entity of the result set.
       
    49 
       
    50 *listitem*
       
    51     This view redirects by default to the `outofcontext` view.
       
    52 
       
    53 *adaptedlist*
       
    54     This view displays a list of entities of the same type, in HTML section (`<div>`)
       
    55     and call the view `adaptedlistitem` for each entity of the result set.
       
    56 
       
    57 *adaptedlistitem*
       
    58     This view redirects by default to the `outofcontext` view.
       
    59 
       
    60 *csv*
       
    61     This view applies to entity groups, which are individually
       
    62     displayed using the `incontext` view. It displays each entity as a
       
    63     coma separated list. It is NOT related to the well-known text file
       
    64     format.
       
    65 
       
    66 Text entity views
       
    67 ~~~~~~~~~~~~~~~~~
       
    68 *text*
       
    69     This is the simplest text view for an entity. By default it returns the
       
    70     result of the `.dc_title` method, which is cut to fit the
       
    71     `navigation.short-line-size` property if necessary.
       
    72 
       
    73 *textincontext, textoutofcontext*
       
    74     Similar to the `text` view, but called when an entity is considered out or
       
    75     in context. By default it returns respectively the result of the
       
    76     methods `.dc_title` and `.dc_long_title` of the entity.