Edgewall Software

Changeset 6696

Show
Ignore:
Timestamp:
03/14/2008 08:59:34 PM (7 months ago)
Author:
nkantrowitz
Message:

Add a new 'theme' variable to req.chrome. This is intended to be the name of a
template file containing py:match blocks to apply the visual style elements.
This can be used by plugins to provide hooks for modifiying style and theme
elements.

Location:
trunk/trac
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/trac/templates/layout.html

    r6654 r6696  
    3535    </ul> 
    3636  </div> 
    37  
     37   
    3838  <py:match path="body" once="true"><body> 
    39     <div id="banner"> 
    40       <div id="header" py:choose=""> 
    41         <a py:when="chrome.logo.src" id="logo" href="${chrome.logo.link or href.wiki('TracIni')+'#header_logo-section'}"><img 
    42           src="${chrome.logo.src}" alt="${chrome.logo.alt}" 
    43           height="${chrome.logo.height or None}" width="${chrome.logo.width or None}" /></a> 
    44         <h1 py:otherwise=""><a href="${chrome.logo.link}">${project.name}</a></h1> 
    45       </div> 
    46       <form id="search" action="${href.search()}" method="get"> 
    47         <div py:if="'SEARCH_VIEW' in perm"> 
    48           <label for="proj-search">Search:</label> 
    49           <input type="text" id="proj-search" name="q" size="18" accesskey="f" value="" /> 
    50           <input type="submit" value="Search" /> 
    51         </div> 
    52       </form> 
    53       ${navigation('metanav')} 
    54     </div> 
    55     ${navigation('mainnav')} 
    56  
    57     <div id="main"> 
    58       <div id="ctxtnav" class="nav"> 
    59         <h2>Context Navigation</h2> 
    60           <ul> 
    61             <li py:for="i, elm in enumerate(chrome.ctxtnav)" class="${i == 0 and 'first ' or None}${i+1 == len(chrome.ctxtnav) and 'last' or None}">$elm</li> 
    62           </ul> 
    63         <hr /> 
    64       </div> 
    65       <div id="warning" py:if="chrome.warnings" class="system-message"> 
    66         <py:choose test="len(chrome.warnings)"> 
    67           <py:when test="1"> 
    68             <strong>Warning:</strong> ${chrome.warnings[0]} 
    69           </py:when> 
    70           <py:otherwise> 
    71             <strong>Warnings:</strong> 
    72             <ul><li py:for="w in chrome.warnings">$w</li></ul> 
    73           </py:otherwise> 
    74         </py:choose> 
    75       </div> 
    76       <div id="notice" py:if="chrome.notices" class="system-message"> 
    77         <py:choose test="len(chrome.notices)"> 
    78           <py:when test="1"> 
    79             <strong>Notice:</strong> ${chrome.notices[0]} 
    80           </py:when> 
    81           <py:otherwise> 
    82             <strong>Notices:</strong> 
    83             <ul><li py:for="w in chrome.notices">$w</li></ul> 
    84           </py:otherwise> 
    85         </py:choose> 
    86       </div> 
    87  
    88       ${select('*|text()')} 
    89  
     39    ${select('*|text()')} 
     40     
    9041      <script type="text/javascript" py:if="chrome.late_links"> 
    9142        <py:for each="link in chrome.late_links.get('stylesheet')"> 
     
    10657        </ul> 
    10758      </div> 
    108     </div> 
    109  
    110     <div id="footer" xml:lang="en"><hr/> 
    111       <a id="tracpowered" href="http://trac.edgewall.org/"><img 
    112         src="${chrome.htdocs_location}trac_logo_mini.png" height="30" 
    113         width="107" alt="Trac Powered"/></a> 
    114       <p class="left"> 
    115         Powered by <a href="${href.about()}"><strong>Trac ${trac.version}</strong></a><br /> 
    116         By <a href="http://www.edgewall.org/">Edgewall Software</a>. 
    117       </p> 
    118       <p class="right">${chrome.footer}</p> 
    119     </div> 
    120   </body></py:match> 
    121  
     59    </body></py:match> 
     60     
     61  <xi:include href="$chrome.theme"><xi:fallback /></xi:include> 
    12262  <xi:include href="site.html"><xi:fallback /></xi:include> 
    12363 
  • trunk/trac/web/chrome.py

    r6692 r6696  
    501501 
    502502        chrome['nav'] = nav 
     503         
     504        # Default theme file 
     505        chrome['theme'] = 'theme.html' 
    503506 
    504507        return chrome