doc/book/en/A02c-maintemplate.en.txt
author Sandrine Ribeau <sandrine.ribeau@logilab.fr>
Tue, 23 Dec 2008 13:15:23 -0800
changeset 286 451a74c5652c
parent 280 ce829abf7c29
child 293 a21688a55d21
permissions -rw-r--r--
[doc] Renaming for data model thematic.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     1
.. -*- coding: utf-8 -*-
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     2
280
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
     3
Templates
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
     4
---------
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     5
280
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
     6
Look at ``cubicweb/web/views/basetemplates.py`` and you will
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     7
find the base templates used to generate HTML for your application.
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     8
81
f5886815126b punctuation stuff
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 74
diff changeset
     9
A page is composed as indicated on the schema below:
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    10
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    11
.. image:: images/lax-book.06-main-template-layout.en.png
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    12
280
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    13
In this section we will demonstrate a change in one of the main
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    14
interesting template from the three you will look for, 
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    15
that is to say, the HTMLPageHeader, the HTMLPageFooter 
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    16
and the TheMainTemplate.
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    17
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    18
280
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    19
Customize a template
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    20
~~~~~~~~~~~~~~~~~~~~
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    21
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    22
Based on the diagram below, each template can be overriden
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    23
by your customized template. To do so, we recommand you create
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    24
a Python module ``blog.views.templates`` to keep it organized.
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    25
In this module you will have to import the parent class you are
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    26
interested as follows: ::
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    27
  
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    28
  from cubicweb.web.views.basetemplates import HTMLPageHeader, \
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    29
                                    HTMLPageFooter, TheMainTemplate
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    30
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    31
and then create your sub-class::
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    32
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    33
  class MyBlogHTMLPageHeader(HTMLPageHeader):
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    34
      ...  
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    35
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    36
Customize header
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 115
diff changeset
    37
`````````````````
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    38
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    39
Let's now move the search box in the header and remove the login form
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    40
from the header. We'll show how to move it to the left column of the application.
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    41
280
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    42
Let's say we do not want anymore the login menu to be in the header
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    43
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    44
First, to remove the login menu, we just need to comment out the display of the
280
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    45
login graphic component such as follows: ::
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    46
280
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    47
  class MyBlogHTMLPageHeader(HTMLPageHeader):
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    48
    
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    49
      def main_header(self, view):
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    50
          """build the top menu with authentification info and the rql box"""
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    51
          self.w(u'<table id="header"><tr>\n')
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    52
          self.w(u'<td id="firstcolumn">')
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    53
          self.vreg.select_component('logo', self.req, self.rset).dispatch(w=self.w)
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    54
          self.w(u'</td>\n')
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    55
          # appliname and breadcrumbs
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    56
          self.w(u'<td id="headtext">')
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    57
          comp = self.vreg.select_component('appliname', self.req, self.rset)
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    58
          if comp and comp.propval('visible'):
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    59
              comp.dispatch(w=self.w)
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    60
          comp = self.vreg.select_component('breadcrumbs', self.req, self.rset, view=view)
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    61
          if comp and comp.propval('visible'):
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    62
              comp.dispatch(w=self.w, view=view)
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    63
          self.w(u'</td>')
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    64
          # logged user and help
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    65
          #self.w(u'<td>\n')
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    66
          #comp = self.vreg.select_component('loggeduserlink', self.req, self.rset)
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    67
          #comp.dispatch(w=self.w)
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    68
          #self.w(u'</td><td>')
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    69
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    70
          self.w(u'<td>')
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    71
          helpcomp = self.vreg.select_component('help', self.req, self.rset)
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    72
          if helpcomp: # may not be available if Card is not defined in the schema
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    73
              helpcomp.dispatch(w=self.w)
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    74
          self.w(u'</td>')
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    75
          # lastcolumn
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    76
          self.w(u'<td id="lastcolumn">')
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    77
          self.w(u'</td>\n')
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    78
          self.w(u'</tr></table>\n')
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    79
          self.template('logform', rset=self.rset, id='popupLoginBox', klass='hidden',
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    80
                        title=False, message=False)
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    81
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    82
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    83
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    84
.. image:: images/lax-book.06-header-no-login.en.png
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    85
280
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    86
Customize footer
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
    87
````````````````
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    88
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    89
If you want to change the footer for example, look
81
f5886815126b punctuation stuff
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents: 74
diff changeset
    90
for HTMLPageFooter and override it in your views file as in: 
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    91
::
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    92
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    93
  form ginco.web.views.basetemplates import HTMLPageFooter
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    94
  class MyHTMLPageFooter(HTMLPageFooter):
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    95
      def call(self, **kwargs):
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    96
          self.w(u'<div class="footer">')
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    97
          self.w(u'This website has been created with <a href="http://lax.logilab.org">LAX</a>.')
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    98
          self.w(u'</div>')
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    99
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   100
Updating a view does not require any restart of the server. By reloading
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   101
the page you can see your new page footer.
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   102
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   103
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   104
TheMainTemplate
280
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
   105
```````````````
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 115
diff changeset
   106
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   107
.. _TheMainTemplate:
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   108
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   109
The MainTemplate is a bit complex as it tries to accomodate many
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   110
different cases. We are now about to go through it and cutomize entirely
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   111
our application.
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   112
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   113
TheMainTemplate is responsible for the general layout of the entire application. 
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   114
It defines the template of ``id = main`` that is used by the application. Is 
280
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
   115
also defined in ``cubicweb/web/views/basetemplates.py`` another template that can
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   116
be used based on TheMainTemplate called SimpleMainTemplate which does not have 
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   117
a top section.
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   118
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   119
.. image:: images/lax-book.06-simple-main-template.en.png
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   120
280
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
   121
XXX
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
   122
[WRITE ME]
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
   123
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
   124
* customize MainTemplate and show that everything in the user
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
   125
  interface can be changed
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
   126
* Add login menu in left column ?
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
   127
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   128
CSS changes
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 115
diff changeset
   129
~~~~~~~~~~~
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   130
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   131
We cannot modify the order in which the application is reading the CSS. In
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   132
the case we want to create new CSS style, the best is to define it a in a new
280
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
   133
CSS located under ``myapp/data/`` and use those new styles while writing
ce829abf7c29 [doc] Improved tutoriel. Moved appropriate content to cubicweb foundations chapter. Adds section to fill about cubicweb-ctl shell.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 273
diff changeset
   134
customized views and templates.
74
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   135
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   136
If you want to modify an existing CSS styling property, you will have to use
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   137
``!important`` declaration to override the existing property. The application
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   138
apply a higher priority on the default CSS and you can not change that. 
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   139
Customized CSS will not be read first.
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   140
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   141
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   142
9a9fe515934d [doc] reuse the lax book
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   143