# HG changeset patch # User Katia Saurfelt <katia.saurfelt@logilab.fr> # Date 1393947653 -3600 # Tue Mar 04 16:40:53 2014 +0100 # Node ID b3f11a9075c6b34d0d4bb203b669ab6bba86d694 # Parent bc487b9ade283fbd3e191f3e0b27fda3dc52217c [main template] clean the TheMainTemplate structure diff --git a/views/basetemplates.py b/views/basetemplates.py --- a/views/basetemplates.py +++ b/views/basetemplates.py @@ -32,6 +32,12 @@ self.template_footer(view) @monkeypatch(basetemplates.TheMainTemplate) +def template_header(self, content_type, view=None, page_title='', additional_headers=()): + page_title = page_title or view.page_title() + additional_headers = additional_headers or view.html_headers() + self.template_html_header(content_type, page_title, additional_headers) + +@monkeypatch(basetemplates.TheMainTemplate) def template_html_header(self, content_type, page_title, additional_headers=()): w = self.whead @@ -56,15 +62,11 @@ if page_title: w(u'<title>%s</title>\n' % xml_escape(page_title)) - -@monkeypatch(basetemplates.TheMainTemplate) -def template_body_header(self, view): - self.w(u'<body>\n') - self.wview('header', rset=self.cw_rset, view=view) - @monkeypatch(basetemplates.TheMainTemplate) def template_page_content(self, view): w = self.w + self.w(u'<body>\n') + self.wview('header', rset=self.cw_rset, view=view) w(u'<div id="page" class="container">\n') w(u'<div class="row">\n') left_boxes = list(self._cw.vreg['ctxcomponents'].poss_visible_objects( @@ -79,6 +81,8 @@ self.content_column(view, content_cols) self.nav_column(view, right_boxes, 'right') self.w(u'</div>\n') # closes class=row + self.w(u'</div>\n') # closes id="page" from template_page_content + self.w(u'</body>\n') @monkeypatch(basetemplates.TheMainTemplate) def get_components(self, view, context): @@ -87,7 +91,6 @@ rset=self.cw_rset, view=view, context=context) - @monkeypatch(basetemplates.TheMainTemplate) def state_header(self): state = self._cw.search_state @@ -149,11 +152,6 @@ @monkeypatch(basetemplates.TheMainTemplate) -def content_footer(self, view=None): - self.wview('contentfooter', rset=self.cw_rset, view=view) - - -@monkeypatch(basetemplates.TheMainTemplate) def content_components(self, view, components): """TODO : should use context""" rqlcomp = components.select_or_none('rqlinput', self._cw, rset=self.cw_rset) @@ -174,9 +172,6 @@ @monkeypatch(basetemplates.TheMainTemplate) def template_footer(self, view=None): self.wview('footer', rset=self.cw_rset) - self.w(u'</div>\n') # closes id="page" - self.w(u'</body>\n') - # main header