diff --git a/doc/howto/howto_website.rst b/doc/howto/howto_website.rst index 192f7f1b9c8bf3714afaccaf740223016afa3993..bb2d0ee5554411473d0a8bef1f35328e81426f4d 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 765522cbbbc5178aefd36125b02271fbf7c046f9..5e053dcdea21b4b2cf14d501d0d1f5c7a0ec0b40 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 5fc1a7c592aed178783a86c6c2ca1cd2adf68eeb..5dccc34aedb24ea26aa0020a4fe7bf11c2a4f0d9 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 71a86d7311b807d3947909883b5c21c3a9c1b802..e3fef6d3486a07d194d3a9dfcfad9a245b7c2f82 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 f5fd1013ec6073312bd62a6f4359da1277c34979..d3b79299e9cc895404df5b52580f3309b7aea4d4 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 f7c63664fef9af1ba83a22bf028bdff4d28187e8..b857b214f9454dad278eef605446d7c0b1315f4f 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 ae310ee4935381170fc409039ba1ccebb13ebf9d..37c14e8f2c2d10cf3687c5c0871fa2e76e286993 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 2d6aafbcf052edadd4724c51d3e77a3d52f115c1..d4ed9647dd51abb5bc827847e9a39fb6db14f290 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>