summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2014-04-11 14:11:58 +0200
committerXavier Morel <xmo@openerp.com>2014-05-19 08:32:17 +0200
commitd3268420aedf752b70a5344654fd73504ed52a2b (patch)
treed4bb73888a23312b78821c7f09cd94de13a49406 /doc
parent8bcc42d4d08530801630c1ae9310369d59d1d17a (diff)
[IMP] slightly simplify first code snippet
Diffstat (limited to 'doc')
-rw-r--r--doc/howto/howto_website.rst2
-rw-r--r--doc/howto/howto_website/basic-page19
-rw-r--r--doc/howto/howto_website/lectures-model-add4
-rw-r--r--doc/howto/howto_website/ta-controller26
-rw-r--r--doc/howto/howto_website/ta-model4
-rw-r--r--doc/howto/howto_website/templates-basic37
-rw-r--r--doc/howto/howto_website/website-dependency12
-rw-r--r--doc/howto/howto_website/website-layoutify10
8 files changed, 50 insertions, 64 deletions
diff --git a/doc/howto/howto_website.rst b/doc/howto/howto_website.rst
index 192f7f1b9c8..bb2d0ee5554 100644
--- a/doc/howto/howto_website.rst
+++ b/doc/howto/howto_website.rst
@@ -24,6 +24,8 @@ create a module:
.. todo:: output directory probably shouldn't be ``.``
+.. todo:: ``oe`` v ``./oe``?
+
.. code-block:: console
$ oe scaffold Academy .
diff --git a/doc/howto/howto_website/basic-page b/doc/howto/howto_website/basic-page
index 765522cbbbc..5e053dcdea2 100644
--- a/doc/howto/howto_website/basic-page
+++ b/doc/howto/howto_website/basic-page
@@ -1,24 +1,17 @@
# HG changeset patch
-# Parent d06b1f422ac5672c4a4c34bb3a50e98df42f3e31
+# Parent b96cd22d25cfa9a67f451d091f5c4896997d350d
diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/academy.py
+++ b/controllers/academy.py
-@@ -6,4 +6,16 @@ from openerp.addons.web.controllers impo
+@@ -6,4 +6,9 @@ from openerp.addons.web.controllers impo
class academy(main.Home):
@http.route('/', auth='none')
def index(self):
- return "Hello, world!"
+ return """<!doctype html>
-+<html>
-+ <head>
-+ <title>AcademyAcademy</title>
-+ <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
-+ </head>
-+ <body class="container">
-+ <h1>Introduction to a thing</h1>
-+ <h2>Course description</h2>
-+ <p>Course introduction</p>
-+ </body>
-+</html>
++<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
++<body class="container">
++ <h1>Introduction to a thing</h1>
++</body>
+"""
diff --git a/doc/howto/howto_website/lectures-model-add b/doc/howto/howto_website/lectures-model-add
index 5fc1a7c592a..5dccc34aedb 100644
--- a/doc/howto/howto_website/lectures-model-add
+++ b/doc/howto/howto_website/lectures-model-add
@@ -1,5 +1,5 @@
# HG changeset patch
-# Parent fef5ecf2dad4b7bdcc9a760545c2689187bb15f9
+# Parent dc6e1146075f61db66b1f7d2b7d3b8e76341e7bb
diff --git a/__openerp__.py b/__openerp__.py
--- a/__openerp__.py
@@ -17,7 +17,7 @@ diff --git a/controllers/academy.py b/controllers/academy.py
+++ b/controllers/academy.py
@@ -6,10 +6,15 @@ from openerp.addons.web.controllers impo
class academy(main.Home):
- @http.route('/', auth='public')
+ @http.route('/', auth='public', website=True)
def index(self):
+ cr, uid, context = http.request.cr, http.request.uid, http.request.context
+ Lectures = http.request.registry['academy.lectures']
diff --git a/doc/howto/howto_website/ta-controller b/doc/howto/howto_website/ta-controller
index 71a86d7311b..e3fef6d3486 100644
--- a/doc/howto/howto_website/ta-controller
+++ b/doc/howto/howto_website/ta-controller
@@ -1,10 +1,10 @@
# HG changeset patch
-# Parent e95e38d7a1c75741d1f7babf1fe6590b8227888e
+# Parent a110c540b0769ee849a404324cf8594d116cc982
diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/academy.py
+++ b/controllers/academy.py
-@@ -3,9 +3,22 @@
+@@ -3,12 +3,45 @@
from openerp import http
from openerp.addons.web.controllers import main
@@ -25,18 +25,14 @@ diff --git a/controllers/academy.py b/controllers/academy.py
+ ]
+
return """<!doctype html>
- <html>
- <head>
-@@ -16,6 +29,26 @@ class academy(main.Home):
- <h1>Introduction to a thing</h1>
- <h2>Course description</h2>
- <p>Course introduction</p>
-+ <h2>Teaching Assistants</h2>
-+ <ul>
-+ %(tas)s
-+ </ul>
- </body>
- </html>
+ <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
+ <body class="container">
+ <h1>Introduction to a thing</h1>
++ <h2>Teaching Assistants</h2>
++ <ul>
++ %(tas)s
++ </ul>
+ </body>
-"""
+""" % {
+ 'tas': '\n'.join(tas)
@@ -48,7 +44,7 @@ diff --git a/controllers/academy.py b/controllers/academy.py
+<html>
+ <head>
+ <title>AcademyAcademy TA %(name)s</title>
-+ <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
++ <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
+ </head>
+ <body class="container">
+ <h1>%(name)s</h1>
diff --git a/doc/howto/howto_website/ta-model b/doc/howto/howto_website/ta-model
index f5fd1013ec6..d3b79299e9c 100644
--- a/doc/howto/howto_website/ta-model
+++ b/doc/howto/howto_website/ta-model
@@ -1,5 +1,5 @@
# HG changeset patch
-# Parent 21954f9743a937b8185a5e717fe6af0e92660c55
+# Parent e8b98f4c8f9070f7d5b91936381324cd1fe12e17
diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/academy.py
@@ -17,7 +17,7 @@ diff --git a/controllers/academy.py b/controllers/academy.py
-]
-
class academy(main.Home):
- @http.route('/', auth='public')
+ @http.route('/', auth='public', website=True)
def index(self):
+ tas = http.request.registry['academy.tas'].search_read(
+ http.request.cr, http.request.uid, context=http.request.context)
diff --git a/doc/howto/howto_website/templates-basic b/doc/howto/howto_website/templates-basic
index f7c63664fef..b857b214f94 100644
--- a/doc/howto/howto_website/templates-basic
+++ b/doc/howto/howto_website/templates-basic
@@ -1,5 +1,5 @@
# HG changeset patch
-# Parent 5342fd2d61587d3ab2c29f88e813b9a402eaa808
+# Parent 93586905ed9663bf48ef33ca6476a537a8f96ac8
diff --git a/__openerp__.py b/__openerp__.py
--- a/__openerp__.py
@@ -19,7 +19,7 @@ diff --git a/__openerp__.py b/__openerp__.py
diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/academy.py
+++ b/controllers/academy.py
-@@ -14,41 +14,18 @@ teaching_assistants = [
+@@ -14,34 +14,17 @@ teaching_assistants = [
class academy(main.Home):
@http.route('/', auth='none')
def index(self):
@@ -30,35 +30,28 @@ diff --git a/controllers/academy.py b/controllers/academy.py
]
- return """<!doctype html>
--<html>
-- <head>
-- <title>AcademyAcademy</title>
-- <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
-- </head>
-- <body class="container">
-- <h1>Introduction to a thing</h1>
-- <h2>Course description</h2>
-- <p>Course introduction</p>
-- <h2>Teaching Assistants</h2>
-- <ul>
-- %(tas)s
-- </ul>
-- </body>
--</html>
+-<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
+-<body class="container">
+- <h1>Introduction to a thing</h1>
+- <h2>Teaching Assistants</h2>
+- <ul>
+- %(tas)s
+- </ul>
+-</body>
-""" % {
- 'tas': '\n'.join(tas)
- }
+-
+ return http.request.registry['ir.ui.view'].render(cr, uid, 'academy.index', {
+ 'tas': '\n'.join(tas)
+ }, context=context)
-
@http.route('/tas/<int:id>/', auth='none')
def ta(self, id):
- return """<!doctype html>
-<html>
- <head>
- <title>AcademyAcademy TA %(name)s</title>
-- <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
+- <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
- </head>
- <body class="container">
- <h1>%(name)s</h1>
@@ -67,7 +60,7 @@ diff --git a/controllers/academy.py b/controllers/academy.py
-""" % teaching_assistants[id]
+ cr, uid, context = http.request.cr, http.request.uid, http.request.context
+ return http.request.registry['ir.ui.view'].render(
-+ cr, uid, "academy.ta", teaching_assistants[id], context=context)
++ cr, uid, 'academy.ta', teaching_assistants[id], context=context)
diff --git a/views/templates.xml b/views/templates.xml
new file mode 100644
--- /dev/null
@@ -79,7 +72,7 @@ new file mode 100644
+ <html>
+ <head>
+ <title>AcademyAcademy</title>
-+ <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"/>
++ <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"/>
+ </head>
+ <body class="container">
+ <h1>Introduction to a thing</h1>
@@ -102,7 +95,7 @@ new file mode 100644
+ <html>
+ <head>
+ <title>AcademyAcademy TA <t t-esc="name"/></title>
-+ <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"/>
++ <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"/>
+ </head>
+ <body class="container">
+ <h1><t t-esc="name"/></h1>
diff --git a/doc/howto/howto_website/website-dependency b/doc/howto/howto_website/website-dependency
index ae310ee4935..37c14e8f2c2 100644
--- a/doc/howto/howto_website/website-dependency
+++ b/doc/howto/howto_website/website-dependency
@@ -1,5 +1,5 @@
# HG changeset patch
-# Parent dce817856f7995c3220ef7261c26b83006c3627e
+# Parent 0fdf3e29ce5bb1dd39479f157eeac5bdfd3cffb0
diff --git a/__openerp__.py b/__openerp__.py
--- a/__openerp__.py
@@ -16,9 +16,12 @@ diff --git a/__openerp__.py b/__openerp__.py
diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/academy.py
+++ b/controllers/academy.py
-@@ -14,18 +14,10 @@ teaching_assistants = [
+@@ -12,19 +12,12 @@ teaching_assistants = [
+ ]
+
class academy(main.Home):
- @http.route('/', auth='none')
+- @http.route('/', auth='none')
++ @http.route('/', auth='none', website=True)
def index(self):
- cr, uid, context = http.request.cr, http.request.uid, http.request.context
- tas = [
@@ -32,13 +35,12 @@ diff --git a/controllers/academy.py b/controllers/academy.py
- return http.request.registry['ir.ui.view'].render(cr, uid, 'academy.index', {
- 'tas': '\n'.join(tas)
- }, context=context)
--
- @http.route('/tas/<int:id>/', auth='none')
+ @http.route('/tas/<int:id>/', auth='none', website=True)
def ta(self, id):
- cr, uid, context = http.request.cr, http.request.uid, http.request.context
- return http.request.registry['ir.ui.view'].render(
-- cr, uid, "academy.ta", teaching_assistants[id], context=context)
+- cr, uid, 'academy.ta', teaching_assistants[id], context=context)
+ return http.request.website.render('academy.ta', teaching_assistants[id])
diff --git a/views/templates.xml b/views/templates.xml
--- a/views/templates.xml
diff --git a/doc/howto/howto_website/website-layoutify b/doc/howto/howto_website/website-layoutify
index 2d6aafbcf05..d4ed9647dd5 100644
--- a/doc/howto/howto_website/website-layoutify
+++ b/doc/howto/howto_website/website-layoutify
@@ -1,5 +1,5 @@
# HG changeset patch
-# Parent 006b3182bb96e16310fd6fc4be808bd5698f1ab6
+# Parent 69c500d7634c0e5287508cfaffa14174cc47d800
diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/academy.py
@@ -8,8 +8,8 @@ diff --git a/controllers/academy.py b/controllers/academy.py
]
class academy(main.Home):
-- @http.route('/', auth='none')
-+ @http.route('/', auth='public')
+- @http.route('/', auth='none', website=True)
++ @http.route('/', auth='public', website=True)
def index(self):
return http.request.website.render('academy.index', {
'tas': teaching_assistants,
@@ -29,7 +29,7 @@ diff --git a/views/templates.xml b/views/templates.xml
- <html>
- <head>
- <title>AcademyAcademy</title>
-- <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"/>
+- <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"/>
- </head>
- <body class="container">
- <h1>Introduction to a thing</h1>
@@ -83,7 +83,7 @@ diff --git a/views/templates.xml b/views/templates.xml
- <html>
- <head>
- <title>AcademyAcademy TA <t t-esc="name"/></title>
-- <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"/>
+- <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"/>
- </head>
- <body class="container">
- <h1><t t-esc="name"/></h1>