doc/book/en/intro/tutorial/maintemplate.rst
brancholdstable
changeset 4985 02b52bf9f5f8
parent 4751 1a9d2c3c7f0c
equal deleted inserted replaced
4563:c25da7573ebd 4985:02b52bf9f5f8
    50 
    50 
    51       def main_header(self, view):
    51       def main_header(self, view):
    52           """build the top menu with authentification info and the rql box"""
    52           """build the top menu with authentification info and the rql box"""
    53           self.w(u'<table id="header"><tr>\n')
    53           self.w(u'<table id="header"><tr>\n')
    54           self.w(u'<td id="firstcolumn">')
    54           self.w(u'<td id="firstcolumn">')
    55           self.vreg.select_component('logo', self.req, self.rset).dispatch(w=self.w)
    55           self._cw.vreg.select_component('logo', self._cw, self.cw_rset).dispatch(w=self.w)
    56           self.w(u'</td>\n')
    56           self.w(u'</td>\n')
    57           # appliname and breadcrumbs
    57           # appliname and breadcrumbs
    58           self.w(u'<td id="headtext">')
    58           self.w(u'<td id="headtext">')
    59           comp = self.vreg.select_component('appliname', self.req, self.rset)
    59           comp = self._cw.vreg.select_component('appliname', self._cw, self.cw_rset)
    60           if comp and comp.propval('visible'):
    60           if comp and comp.propval('visible'):
    61               comp.dispatch(w=self.w)
    61               comp.dispatch(w=self.w)
    62           comp = self.vreg.select_component('breadcrumbs', self.req, self.rset, view=view)
    62           comp = self._cw.vreg.select_component('breadcrumbs', self._cw, self.cw_rset, view=view)
    63           if comp and comp.propval('visible'):
    63           if comp and comp.propval('visible'):
    64               comp.dispatch(w=self.w, view=view)
    64               comp.dispatch(w=self.w, view=view)
    65           self.w(u'</td>')
    65           self.w(u'</td>')
    66           # logged user and help
    66           # logged user and help
    67           #self.w(u'<td>\n')
    67           #self.w(u'<td>\n')
    68           #comp = self.vreg.select_component('loggeduserlink', self.req, self.rset)
    68           #comp = self._cw.vreg.select_component('loggeduserlink', self._cw, self.cw_rset)
    69           #comp.dispatch(w=self.w)
    69           #comp.dispatch(w=self.w)
    70           #self.w(u'</td><td>')
    70           #self.w(u'</td><td>')
    71 
    71 
    72           self.w(u'<td>')
    72           self.w(u'<td>')
    73           helpcomp = self.vreg.select_component('help', self.req, self.rset)
    73           helpcomp = self._cw.vreg.select_component('help', self._cw, self.cw_rset)
    74           if helpcomp: # may not be available if Card is not defined in the schema
    74           if helpcomp: # may not be available if Card is not defined in the schema
    75               helpcomp.dispatch(w=self.w)
    75               helpcomp.dispatch(w=self.w)
    76           self.w(u'</td>')
    76           self.w(u'</td>')
    77           # lastcolumn
    77           # lastcolumn
    78           self.w(u'<td id="lastcolumn">')
    78           self.w(u'<td id="lastcolumn">')
    79           self.w(u'</td>\n')
    79           self.w(u'</td>\n')
    80           self.w(u'</tr></table>\n')
    80           self.w(u'</tr></table>\n')
    81           self.template('logform', rset=self.rset, id='popupLoginBox', klass='hidden',
    81           self.template('logform', rset=self.cw_rset, id='popupLoginBox', klass='hidden',
    82                         title=False, message=False)
    82                         title=False, message=False)
    83 
    83 
    84 
    84 
    85 
    85 
    86 .. image:: ../../images/lax-book.06-header-no-login.en.png
    86 .. image:: ../../images/lax-book.06-header-no-login.en.png
   114 The MainTemplate is a bit complex as it tries to accomodate many
   114 The MainTemplate is a bit complex as it tries to accomodate many
   115 different cases. We are now about to go through it and cutomize entirely
   115 different cases. We are now about to go through it and cutomize entirely
   116 our application.
   116 our application.
   117 
   117 
   118 TheMainTemplate is responsible for the general layout of the entire application.
   118 TheMainTemplate is responsible for the general layout of the entire application.
   119 It defines the template of ``id = main`` that is used by the application. Is
   119 It defines the template of ``__regid__ = main`` that is used by the application. Is
   120 also defined in ``cubicweb/web/views/basetemplates.py`` another template that can
   120 also defined in ``cubicweb/web/views/basetemplates.py`` another template that can
   121 be used based on TheMainTemplate called SimpleMainTemplate which does not have
   121 be used based on TheMainTemplate called SimpleMainTemplate which does not have
   122 a top section.
   122 a top section.
   123 
   123 
   124 .. image:: ../../images/lax-book.06-simple-main-template.en.png
   124 .. image:: ../../images/lax-book.06-simple-main-template.en.png