Christoph Zwerschke avatar Christoph Zwerschke committed 38447bb

Make templates more Genshidiomatic.

Comments (0)

Files changed (9)

tgext/debugbar/sections/templates/controllers.html

 		<th>Controller</th>
 		<th>Exposed Methods</th>
 	</tr>
-	<tr py:for="i, entry in enumerate(controllers.iteritems())" class="${'tgdb_row_odd' if i%2 else 'tgdb_row_even'} tgdb_row">
-		<td><strong>${entry[0]}</strong></td>
-		<td>${entry[1]['controller']}</td>
-		<td>${', '.join(entry[1]['exposed_methods'])}</td>
+	<tr py:for="i, entry in enumerate(controllers.iteritems())"
+			class="${'tgdb_row_odd' if i%2 else 'tgdb_row_even'} tgdb_row">
+		<td><strong py:content="entry[0]" /></td>
+		<td py:content="entry[1]['controller']" />
+		<td py:content="', '.join(entry[1]['exposed_methods'])" />
 	</tr>
 </table>
 </html>

tgext/debugbar/sections/templates/logging.html

 		<th>Message</th>
 		<th>Location</th>
 	</tr>
-	<tr py:for="i, record in enumerate(records)" class="${'tgdb_row_odd' if i%2 else 'tgdb_row_even'} tgdb_row">
-		<td><strong>${record['level']}</strong></td>
-		<td>${record['time']}</td>
-		<td>${record['message']}</td>
-		<td title="${record['file_long']}:${record['line']}">${record['file']}:${record['line']}</td>
+	<tr py:for="i, record in enumerate(records)"
+			class="${'tgdb_row_odd' if i%2 else 'tgdb_row_even'} tgdb_row">
+		<td><strong py:content="record['level']" /></td>
+		<td py:content="record['time']" />
+		<td py:content="record['message']" />
+		<td title="${u'%s:%s' % (record['file_long'], record['line'])}"
+			py:content="u'%s:%s' % (record['file'], record['line'])" />
 	</tr>
 </table>
 </html>

tgext/debugbar/sections/templates/ming.html

 		<tr>
 			<th>Command</th>
 			<th>Params</th>
-			<th>Time&nbsp;(ms)</th>
+			<th>Time</th>
 			<th>Actions</th>
 		</tr>
 	</thead>
 	<tbody>
 		<tr py:for="i, query in enumerate(queries)" style="background-color:#f8f8f8;"
 				class="${'tgdb_row_odd' if i%2 else 'tgdb_row_even'} tgdb_row">
-			<td><strong>${Markup(query['collection'])}</strong>.<em>${Markup(query['command'])}</em></td>
-			<td>${Markup(query['filter'])}</td>
-			<td>${'%.4f' % query['duration']}</td>
+			<td><strong py:content="Markup(query['collection'])" />.<em py:content="Markup(query['command'])" /></td>
+			<td py:content="Markup(query['filter'])" />
+			<td py:content="u'%.4f\xa0ms' % query['duration']" />
 			<td>
 				<p class="tgdb_query">
 					<a href="${tg.url('/_debugbar/perform_ming', params=dict(collection=query['collection'], command=query['command'], params=query['params'], duration=query['duration']))}">Results</a>

tgext/debugbar/sections/templates/request.html

 	xmlns:py="http://genshi.edgewall.org/"
 	py:strip="True">
 <div py:for="title, entries in vars.iteritems()">
-	<h1>${title}</h1>
+	<h1 py:content="title" />
+	<p py:if="not entries">Nothing here.</p>
 	<table class="tgdb_table" py:if="entries">
 		<tr>
 			<th>Name</th>
 			<th>Value</th>
 		</tr>
-		<tr py:for="i, entry in enumerate(entries)" class="${'tgdb_row_odd' if i%2 else 'tgdb_row_even'} tgdb_row">
-			<td><strong>${entry[0]}</strong></td>
-			<td>${entry[1]}</td>
+		<tr py:for="i, entry in enumerate(entries)"
+				class="${'tgdb_row_odd' if i%2 else 'tgdb_row_even'} tgdb_row">
+			<td><strong py:content="entry[0]" /></td>
+			<td py:content="entry[1]" />
 		</tr>
 	</table>
 </div>

tgext/debugbar/sections/templates/sqla.html

 		<tr>
 			<th>Query</th>
 			<th>Params</th>
-			<th>Time&nbsp;(ms)</th>
+			<th>Time</th>
 			<th>Actions</th>
 		</tr>
 	</thead>
 	<tbody>
 		<tr py:for="query in queries" class="tgdb_row">
-			<td>${Markup(query['sql'])}</td>
-			<td>${Markup(query['params'])}</td>
-			<td>${'%.4f' % query['duration']}</td>
+			<td py:content="Markup(query['sql'])" />
+			<td py:content="Markup(query['params'])" />
+			<td py:content="u'%.4f\xa0ms' % query['duration']" />
 			<td>
 				<div py:if="query['is_select']">
 					<p class="tgdb_query">

tgext/debugbar/sections/templates/timing.html

 		<th>Action</th>
 		<th>Time Spent</th>
 	</tr>
-	<tr py:for="i, entry in enumerate(vars.iteritems())" class="${'tgdb_row_even' if i%2 else 'tgdb_row_odd'} tgdb_row">
-		<td><strong>${entry[0]}</strong></td>
-		<td>${'%.4f' % entry[1]}&nbsp;ms</td>
+	<tr py:for="i, entry in enumerate(vars.iteritems())"
+			class="${'tgdb_row_even' if i%2 else 'tgdb_row_odd'} tgdb_row">
+		<td><strong py:content="entry[0]" /></td>
+		<td py:content="u'%.4f\xa0ms' % entry[1]" />
 	</tr>
 </table>
 
 		<th>Content Type</th>
 	</tr>
 	<tr class="tgdb_row tgdb_row_odd">
-		<td>${'%.4f' % vars['Render Time']}&nbsp;ms</td>
-		<td>${render_info.get('engine_name')}</td>
-		<td>${render_info.get('template_name')}</td>
-		<td>${render_info.get('content_type')}</td>
+		<td py:content="u'%.4f\xa0ms' % vars['Render Time']" />
+		<td py:content="render_info.get('engine_name')" />
+		<td py:content="render_info.get('template_name')" />
+		<td py:content="render_info.get('content_type')" />
 	</tr>
 </table>
 
 		</tr>
 	</thead>
 	<tbody>
-		<tr py:for="i, row in enumerate(function_calls)" class="${i%2 and 'tgdb_row_even' or 'tgdb_row_odd'} tgdb_row">
-			<td>${row['ncalls']}</td>
-			<td>${row['tottime']}</td>
-			<td>${'%.4f' % row['percall']}</td>
-			<td>${row['cumtime']}</td>
-			<td>${'%.4f' % row['percall_cum']}</td>
-			<td title="${row['filename_long']}">${row['filename']}</td>
+		<tr py:for="i, row in enumerate(function_calls)"
+				class="${i%2 and 'tgdb_row_even' or 'tgdb_row_odd'} tgdb_row">
+			<td py:content="row['ncalls']" />
+			<td py:content="row['tottime']" />
+			<td py:content="u'%.4f' % row['percall']" />
+			<td py:content="row['cumtime']" />
+			<td py:content="'%.4f' % row['percall_cum']" />
+			<td title="${row['filename_long']}" py:content="row['filename']" />
 		</tr>
 	</tbody>
 </table>

tgext/debugbar/templates/debugbar.html

 	xmlns:py="http://genshi.edgewall.org/"
 	py:strip="True">
 
-<script type="text/javascript" src="/_debugbar/statics/jquery.js"></script>
+<script type="text/javascript" src="${tg.url('/_debugbar/statics/jquery.js')}"></script>
 <script type="text/javascript">
 $(function($) {
 	var bar = $('#tgdb_debugbar');
 </script>
 
 <div id="tgdb_debugbar">
-	<div id="tgdb_button"></div>
+	<div id="tgdb_button" />
 	<div id="tgdb_barcontent">
 		<div class="tgdb_section" py:for="sect in sections" py:if="sect.is_active">
-			<div class="tgdb_title">${sect.title()}</div>
+			<div class="tgdb_title" py:content="sect.title()" />
 			<div class="tgdb_content">
-				<div class="tgdb_content_box">
-					${Markup(sect.content())}
-				</div>
-				<div class="tgdb_detail_box"></div>
+				<div class="tgdb_content_box" py:content="Markup(sect.content())" />
+				<div class="tgdb_detail_box" />
 			</div>
 		</div>
-		<div style="clear:both"></div>
+		<div style="clear:both" />
 	</div>
 </div>
 

tgext/debugbar/templates/perform_ming.html

 
 <h1>Executed Query</h1>
 <table class="tgdb_table">
-	<tr class="tgdb_row"><td><strong>Collection</strong></td><td>${collection}</td></tr>
-	<tr class="tgdb_row"><td><strong>Action</strong></td><td>${action}</td></tr>
-	<tr class="tgdb_row"><td><strong>Time</strong></td><td>${'%.4f' % (duration)} ms</td></tr>
-	<tr class="tgdb_row"><td><strong>Parameters</strong></td><td>${Markup(params)}</td></tr>
+	<tr class="tgdb_row"><td><strong>Collection</strong></td><td py:content="collection" /></tr>
+	<tr class="tgdb_row"><td><strong>Action</strong></td><td py:content="action" /></tr>
+	<tr class="tgdb_row"><td><strong>Time</strong></td><td py:content="u'%.4f\xa0ms' % duration" /></tr>
+	<tr class="tgdb_row"><td><strong>Parameters</strong></td><td py:content="Markup(params)" /></tr>
 </table>
 
 <h1>Query Results</h1>
 	<tbody>
 		<tr py:for="i, row in enumerate(result)"
 				class="${i%2 and 'tgdb_row_even' or 'tgdb_row_odd'} tgdb_row">
-			<td py:content="row"/>
+			<td py:content="row" />
 		</tr>
 	</tbody>
 </table>

tgext/debugbar/templates/perform_sql.html

 
 <h1>Executed SQL</h1>
 <table class="tgdb_table">
-	<tr class="tgdb_row"><td><strong>Statement</strong></td><td>${Markup(sql)}</td></tr>
-	<tr class="tgdb_row"><td><strong>Time</strong></td><td>${'%.4f' % (duration)} ms</td></tr>
-	<tr class="tgdb_row"><td><strong>Parameters</strong></td><td>${params}</td></tr>
+	<tr class="tgdb_row"><td><strong>Statement</strong></td><td py:content="Markup(sql)" /></tr>
+	<tr class="tgdb_row"><td><strong>Time</strong></td><td py:content="u'%.4f\xa0ms' % duration" /></tr>
+	<tr class="tgdb_row"><td><strong>Parameters</strong></td><td py:content="params" /></tr>
 </table>
 
 <h1 py:content="title">Results</h1>
 <table py:if="result" class="tgdb_table">
 	<thead>
 		<tr>
-			<th py:for="h in headers">${h.upper()}</th>
+			<th py:for="header in headers" py:content="header.upper()" />
 		</tr>
 	</thead>
 	<tbody>
 		<tr py:for="i, row in enumerate(result)"
 				class="${i%2 and 'tgdb_row_even' or 'tgdb_row_odd'} tgdb_row">
-			<td py:for="column in row" py:content="column"/>
+			<td py:for="column in row" py:content="column" />
 		</tr>
 	</tbody>
 </table>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.