# HG changeset patch # User Aurelien Campeas # Date 1271093811 -7200 # Node ID ed6905d98a5e2bb0c112d40265f087265b844607 # Parent b851558456bb8e34def896898ecacc6c76977c9e [doc/book] more flesh to views/primary view diff -r b851558456bb -r ed6905d98a5e doc/book/en/conf.py --- a/doc/book/en/conf.py Mon Apr 12 16:57:11 2010 +0200 +++ b/doc/book/en/conf.py Mon Apr 12 19:36:51 2010 +0200 @@ -32,7 +32,7 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'logilab.common.sphinx_ext'] +extensions = ['sphinx.ext.autodoc', 'logilab.common.sphinx_ext', 'sphinxcontrib.aafig'] autoclass_content = 'both' # Add any paths that contain templates here, relative to this directory. templates_path = ['.templates'] @@ -186,3 +186,5 @@ # If false, no module index is generated. #latex_use_modindex = True +aafig_format = dict(latex='pdf', html='svg', text=None) + diff -r b851558456bb -r ed6905d98a5e doc/book/en/development/devweb/internationalization.rst --- a/doc/book/en/development/devweb/internationalization.rst Mon Apr 12 16:57:11 2010 +0200 +++ b/doc/book/en/development/devweb/internationalization.rst Mon Apr 12 19:36:51 2010 +0200 @@ -37,7 +37,7 @@ * by using the equivalent request's method :: - class NoResultView(EmptyRsetView): + class NoResultView(View): """default view when no result has been found""" __regid__ = 'noresult' diff -r b851558456bb -r ed6905d98a5e doc/book/en/development/devweb/rtags.rst --- a/doc/book/en/development/devweb/rtags.rst Mon Apr 12 16:57:11 2010 +0200 +++ b/doc/book/en/development/devweb/rtags.rst Mon Apr 12 19:36:51 2010 +0200 @@ -1,5 +1,5 @@ -Configuring the generated interface ------------------------------------ +Configuring the user interface +------------------------------ Relation tags diff -r b851558456bb -r ed6905d98a5e doc/book/en/development/devweb/views.rst --- a/doc/book/en/development/devweb/views.rst Mon Apr 12 16:57:11 2010 +0200 +++ b/doc/book/en/development/devweb/views.rst Mon Apr 12 19:36:51 2010 +0200 @@ -9,7 +9,7 @@ in *CubicWeb*. We'll start with a description of the interface providing you with a basic -understanding of the classes and methods available, then detail the view +understanding of the available classes and methods, then detail the view selection principle which makes *CubicWeb* web interface very flexible. A `View` is an object applied to another object such as an entity. @@ -26,20 +26,22 @@ A `View` is instantiated to render a result set or part of a result set. `View` subclasses may be parametrized using the following class attributes: - * `templatable` indicates if the view may be embeded in a main - template or if it has to be rendered standalone (i.e. XML views - must not be embeded in the main template for HTML pages) - * if the view is not templatable, it should set the `content_type` class - attribute to the correct MIME type (text/xhtml by default) - * the `category` attribute may be used in the interface to regroup related - objects together +* `templatable` indicates if the view may be embedded in a main + template or if it has to be rendered standalone (i.e. XML views must + not be embedded in the main template for HTML pages) + +* if the view is not templatable, it should set the `content_type` + class attribute to the correct MIME type (text/xhtml by default) + +* the `category` attribute may be used in the interface to regroup + related objects together + +A view writes to its output stream thanks to its attribute `w` (an +`UStreamIO`, except for binary views). At instantiation time, the standard `_cw` and `cw_rset` attributes are added and the `w` attribute will be set at rendering time. -A view writes to its output stream thanks to its attribute `w` (an -`UStreamIO`, except for binary views). - The basic interface for views is as follows (remember that the result set has a tabular structure with rows and columns, hence cells): @@ -51,24 +53,21 @@ result set) * `cell_call(row, col, **kwargs)`, call the view for a given cell of a - result set + result set (`row` and `col` being integers used to access the cell) * `url()`, returns the URL enabling us to get the view with the current result set -* `view(__vid, rset, __fallback_vid=None, **kwargs)`, call the view of identifier - `__vid` on the given result set. It is possible to give a view identifier - of fallback that will be used if the view requested is not applicable to the - result set. This is actually defined on the AppObject class. +* `wview(__vid, rset, __fallback_vid=None, **kwargs)`, call the view of + identifier `__vid` on the given result set. It is possible to give a + fallback view identifier that will be used if the requested view is + not applicable to the result set. -* `wview(__vid, rset, __fallback_vid=None, **kwargs)`, similar to `view` except - the flow is automatically passed in the parameters - -* `html_headers()`, returns a list of HTML headers to set by the main template +* `html_headers()`, returns a list of HTML headers to be set by the + main template * `page_title()`, returns the title to use in the HTML header `title` - Other basic view classes ```````````````````````` Here are some of the subclasses of `View` defined in `cubicweb.common.view` @@ -77,8 +76,6 @@ * `EntityView`, view applying to lines or cell containing an entity (e.g. an eid) * `StartupView`, start view that does not require a result set to apply to * `AnyRsetView`, view applicable to any result set -* `EmptyRsetView`, view applicable to an empty result set - Examples of views class ----------------------- @@ -109,6 +106,7 @@ __select__ = one_line_rset() & match_search_state('linksearch') & implements('Any') + Example of view customization and creation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff -r b851558456bb -r ed6905d98a5e doc/book/en/development/entityclasses/data-as-objects.rst --- a/doc/book/en/development/entityclasses/data-as-objects.rst Mon Apr 12 16:57:11 2010 +0200 +++ b/doc/book/en/development/entityclasses/data-as-objects.rst Mon Apr 12 19:36:51 2010 +0200 @@ -16,15 +16,15 @@ :Formatting and output generation: - * `view(vid, **kwargs)`, applies the given view to the entity + * `view(__vid, __registry='views', **kwargs)`, applies the given view to the entity (and returns an unicode string) - * `absolute_url(**kwargs)`, returns an absolute URL to access the primary view + * `absolute_url(*args, **kwargs)`, returns an absolute URL to access the primary view of an entity * `rest_path()`, returns a relative REST URL to get the entity - * `printable_value(attr, value=_marker, attrtype=None, format='text/html')`, + * `printable_value(attr, value=_marker, attrtype=None, format='text/html', displaytime=True)`, returns a string enabling the display of an attribute value in a given format (the value is automatically recovered if necessary) diff -r b851558456bb -r ed6905d98a5e doc/book/en/development/webstdlib/baseviews.rst --- a/doc/book/en/development/webstdlib/baseviews.rst Mon Apr 12 16:57:11 2010 +0200 +++ b/doc/book/en/development/webstdlib/baseviews.rst Mon Apr 12 19:36:51 2010 +0200 @@ -12,6 +12,7 @@ HTML views ~~~~~~~~~~ + Special views ````````````` @@ -43,6 +44,7 @@ List ````` + *list* This view displays a list of entities by creating a HTML list (`