diff --git a/pyalchemybiz/controllers/customer.py b/pyalchemybiz/controllers/customer.py
index dc9e80f..74b3cd5 100644
--- a/pyalchemybiz/controllers/customer.py
+++ b/pyalchemybiz/controllers/customer.py
@@ -12,17 +12,17 @@ class CustomerController(BaseController):
sess = meta.Session()
cust_q = sess.query(customer.Customer)
c.customers = cust_q.all()
- return render('/customer/index.mako')
+ return render('/derived/customer/index.mako')
def create(self):
sess = meta.Session()
- return render('/customer/create.mako')
+ return render('/derived/customer/create.mako')
def edit(self, id):
sess = meta.Session()
cust_q = sess.query(customer.Customer)
c.customer = cust_q.filter(customer.Customer.id==id).one()
- return render('/customer/edit.mako')
+ return render('/derived/customer/edit.mako')
def delete(self, id):
sess = meta.Session()
diff --git a/pyalchemybiz/controllers/index.py b/pyalchemybiz/controllers/index.py
index 8549b3c..ec78e87 100644
--- a/pyalchemybiz/controllers/index.py
+++ b/pyalchemybiz/controllers/index.py
@@ -9,7 +9,4 @@ class IndexController(BaseController):
def index(self):
c.menuitems = [(_("Customer management"), "customer", "index")]
- # Return a rendered template
- # return render('/some/template.mako')
- # or, Return a response
- return render('/index.mako')
+ return render('/derived/index/index.mako')
diff --git a/pyalchemybiz/lib/helpers.py b/pyalchemybiz/lib/helpers.py
index 25a63d1..8b482db 100644
--- a/pyalchemybiz/lib/helpers.py
+++ b/pyalchemybiz/lib/helpers.py
@@ -3,5 +3,5 @@
Consists of functions to typically be used within templates, but also
available to Controllers. This module is available to both as 'h'.
"""
-from webhelpers.rails.wrapped import *
+from webhelpers.html.tags import *
from routes import url_for, redirect_to
diff --git a/pyalchemybiz/templates/base.mako b/pyalchemybiz/templates/base.mako
deleted file mode 100644
index 6d6b36e..0000000
--- a/pyalchemybiz/templates/base.mako
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- ${_('PyAlchemyBiz')}
- ${h.stylesheet_link_tag('/pyalchemybiz.css')}
- ${h.javascript_include_tag(
- '/javascripts/pyalchemybiz.js', builtins=True)}
-
-
-
- ${next.body()}\
-
-
-
-
diff --git a/pyalchemybiz/templates/base/base.mako b/pyalchemybiz/templates/base/base.mako
new file mode 100644
index 0000000..2ea16ff
--- /dev/null
+++ b/pyalchemybiz/templates/base/base.mako
@@ -0,0 +1,30 @@
+## -*- coding: utf-8 -*-
+
+
+
+
+ ${self.title()}
+ ${h.stylesheet_link('/pyalchemybiz.css')}
+ ${h.javascript_link('/javascripts/jquery.js', '/javascripts/pyalchemybiz.js')}
+ ${self.head()}
+
+
+ ${self.header()}
+ ${self.tabs()}
+ ${self.menu()}
+ ${self.heading()}
+ ${self.breadcrumbs()}
+ ${next.body()}
+ ${self.footer()}
+
+
+
+<%def name="title()">${_('PyAlchemyBiz')}%def>
+<%def name="head()">%def>
+<%def name="header()">%def>
+<%def name="tabs()">%def>
+<%def name="menu()">%def>
+<%def name="heading()">${c.heading or _('PyAlchemyBiz')}
%def>
+<%def name="breadcrumbs()">%def>
+<%def name="footer()">Top ^
%def>
diff --git a/pyalchemybiz/templates/base/customer.mako b/pyalchemybiz/templates/base/customer.mako
new file mode 100644
index 0000000..d508ff2
--- /dev/null
+++ b/pyalchemybiz/templates/base/customer.mako
@@ -0,0 +1,5 @@
+<%inherit file="/base/base.mako" />
+
+${next.body()}
+<%def name="title()">${parent.title()} - ${_('Customer management')}%def>
+<%def name="heading()">${_('Customer management')}
%def>
diff --git a/pyalchemybiz/templates/customer/create.mako b/pyalchemybiz/templates/customer/create.mako
deleted file mode 100644
index 1f5673b..0000000
--- a/pyalchemybiz/templates/customer/create.mako
+++ /dev/null
@@ -1,15 +0,0 @@
-<%inherit file="/base.mako" />
-
-${_('Customer management')}
-${_('Create new customer')}
-
-${h.start_form(h.url_for(action='process_create'), method='post')}
-
-
-${h.text_field('firstname')}
-
-${h.text_field('lastname')}
-
-${h.submit(_('Add new customer'))}
-
-${h.end_form()}
diff --git a/pyalchemybiz/templates/customer/edit.mako b/pyalchemybiz/templates/customer/edit.mako
deleted file mode 100644
index f899ba2..0000000
--- a/pyalchemybiz/templates/customer/edit.mako
+++ /dev/null
@@ -1,15 +0,0 @@
-<%inherit file="/base.mako" />
-
-${_('Customer management')}
-${_('Edit customer')}
-
-${h.start_form(h.url_for(action='process_edit'), method='post')}
-
-
-${h.text_field('firstname', c.customer.person.firstname)}
-
-${h.text_field('lastname', c.customer.person.lastname)}
-
-${h.submit(_('Save changes'))}
-
-${h.end_form()}
diff --git a/pyalchemybiz/templates/derived/customer/create.mako b/pyalchemybiz/templates/derived/customer/create.mako
new file mode 100644
index 0000000..2590188
--- /dev/null
+++ b/pyalchemybiz/templates/derived/customer/create.mako
@@ -0,0 +1,14 @@
+<%inherit file="/base/customer.mako" />
+
+${h.form(h.url_for(action='process_create'))}
+
+${h.end_form()}
+
+<%def name="heading()">${_('Create new customer')}
%def>
diff --git a/pyalchemybiz/templates/derived/customer/edit.mako b/pyalchemybiz/templates/derived/customer/edit.mako
new file mode 100644
index 0000000..3290995
--- /dev/null
+++ b/pyalchemybiz/templates/derived/customer/edit.mako
@@ -0,0 +1,14 @@
+<%inherit file="/base/customer.mako" />
+
+${h.form(h.url_for(action='process_edit'))}
+
+${h.end_form()}
+
+<%def name="heading()">${_('Edit customer')}
%def>
diff --git a/pyalchemybiz/templates/customer/index.mako b/pyalchemybiz/templates/derived/customer/index.mako
similarity index 82%
rename from pyalchemybiz/templates/customer/index.mako
rename to pyalchemybiz/templates/derived/customer/index.mako
index 714bfc8..f8b950e 100644
--- a/pyalchemybiz/templates/customer/index.mako
+++ b/pyalchemybiz/templates/derived/customer/index.mako
@@ -1,6 +1,4 @@
-<%inherit file="/base.mako" />
-
-${_('Customer management')}
+<%inherit file="/base/customer.mako" />
% for customer in c.customers:
diff --git a/pyalchemybiz/templates/index.mako b/pyalchemybiz/templates/derived/index/index.mako
similarity index 76%
rename from pyalchemybiz/templates/index.mako
rename to pyalchemybiz/templates/derived/index/index.mako
index 37fd53a..14b97fd 100644
--- a/pyalchemybiz/templates/index.mako
+++ b/pyalchemybiz/templates/derived/index/index.mako
@@ -1,4 +1,4 @@
-<%inherit file="base.mako" />
+<%inherit file="/base/base.mako" />