diff --git a/addons/web/doc/index.rst b/addons/web/doc/index.rst index 7127bb975ed..650c12f55ec 100644 --- a/addons/web/doc/index.rst +++ b/addons/web/doc/index.rst @@ -6,32 +6,49 @@ Welcome to OpenERP Web's documentation! ======================================= -Contents: +Basics +------ .. toctree:: :maxdepth: 1 module - widget + changelog-7.0 +Server-Side Web Framework +------------------------- - async - rpc - qweb - client_action +.. toctree:: + :maxdepth: 1 + + web_controllers + +Javascript +---------- + +.. toctree:: + :maxdepth: 1 guidelines - + widget + rpc + async + qweb + client_action testing +Views +----- + +.. toctree:: + :maxdepth: 1 + search_view list_view form_view - changelog-7.0 - Indices and tables -================== +------------------ * :ref:`genindex` * :ref:`modindex` diff --git a/addons/web/doc/web_controllers.rst b/addons/web/doc/web_controllers.rst new file mode 100644 index 00000000000..4694b72070f --- /dev/null +++ b/addons/web/doc/web_controllers.rst @@ -0,0 +1,85 @@ + +Web Controllers +=============== + +Web controllers are classes in OpenERP able to catch the http requests sent by any browser. They allow to generate +html pages to be served like any web server, implement new methods to be used by the Javascript client, etc... + +Controllers File +---------------- + +By convention the controllers should be placed in the controllers directory of the module. Example: + +.. code-block:: text + + web_example + ├── controllers + │ ├── __init__.py + │ └── my_controllers.py + ├── __init__.py + └── __openerp__.py + +In ``__init__.py`` you must add: + +:: + + import controllers + +And here is the content of ``controllers/__init__.py``: + +:: + + import my_controllers + +Now you can put the following content in ``controllers/my_controllers.py``: + +:: + + import openerp.addons.web.http as http + from openerp.addons.web.http import request + + +Controller Declaration +---------------------- + +In your controllers file, you can now declare a controller this way: + +:: + + class MyController(http.Controller): + _cp_path = '/my_url' + + @http.httprequest + def some_html(self): + return "