odoo/doc/howto/howto_website/ta-controller

58 lines
1.5 KiB
Plaintext

# HG changeset patch
# Parent e95e38d7a1c75741d1f7babf1fe6590b8227888e
diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/academy.py
+++ b/controllers/academy.py
@@ -3,9 +3,22 @@
from openerp import http
from openerp.addons.web.controllers import main
+teaching_assistants = [
+ {'name': "Diana Padilla"},
+ {'name': "Jody Carroll"},
+ {'name': "Lester Vaughn"},
+ {'name': "Paul Jimenez"},
+ {'name': "Tanya Harris"},
+]
+
class academy(main.Home):
@http.route('/', auth='none')
def index(self):
+ tas = [
+ '<li><a href="/tas/?id=%d">%s</a></li>' % (i, ta['name'])
+ for i, ta in enumerate(teaching_assistants)
+ ]
+
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>
-"""
+""" % {
+ 'tas': '\n'.join(tas)
+ }
+
+ @http.route('/tas', 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">
+ </head>
+ <body class="container">
+ <h1>%(name)s</h1>
+ </body>
+</html>
+""" % teaching_assistants[int(id)]