annotate templates/spartan/graph.tmpl @ 10277:17c6d5eab25d stable

templates: do not add "ago" twice After 1d75c683ada1, "ago" is added by the ago template filter.
author Martin Geisler <mg@lazybytes.net>
date Sat, 23 Jan 2010 16:54:53 +0100
parents 5c1aabc58004
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8431
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
1 {header}
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
2 <title>{repo|escape}: graph</title>
7338
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
3 <link rel="alternate" type="application/atom+xml"
8431
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
4 href="{url}atom-tags" title="Atom feed for {repo|escape}: tags">
7338
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
5 <link rel="alternate" type="application/rss+xml"
8431
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
6 href="{url}rss-tags" title="RSS feed for {repo|escape}: tags">
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
7 <!--[if IE]><script type="text/javascript" src="{staticurl}excanvas.js"></script><![endif]-->
7338
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
8 </head>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
9 <body>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
10
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
11 <div class="buttons">
8431
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
12 <a href="{url}log{sessionvars%urlparameter}">changelog</a>
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
13 <a href="{url}shortlog{sessionvars%urlparameter}">shortlog</a>
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
14 <a href="{url}tags{sessionvars%urlparameter}">tags</a>
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
15 <a href="{url}branches{sessionvars%urlparameter}">branches</a>
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
16 <a href="{url}file/{node|short}/{sessionvars%urlparameter}">files</a>
7338
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
17 </div>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
18
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
19 <h2>graph</h2>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
20
8431
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
21 <form action="{url}log">
7338
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
22 {sessionvars%hiddenformentry}
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
23 <p>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
24 <label for="search1">search:</label>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
25 <input name="rev" id="search1" type="text" size="30">
8431
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
26 navigate: <small class="navigate">{changenav%navgraphentry}</small>
7338
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
27 </p>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
28 </form>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
29
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
30 <noscript>The revision graph only works with JavaScript-enabled browsers.</noscript>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
31
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
32 <div id="wrapper">
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
33 <ul id="nodebgs"></ul>
8431
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
34 <canvas id="graph" width="224" height="{canvasheight}"></canvas>
7338
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
35 <ul id="graphnodes"></ul>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
36 </div>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
37
8431
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
38 <script type="text/javascript" src="{staticurl}graph.js"></script>
7338
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
39 <script type="text/javascript">
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
40 <!-- hide script content
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
41
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
42 var data = {jsdata|json};
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
43 var graph = new Graph();
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
44 graph.scale({bg_height});
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
45
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
46 graph.edge = function(x0, y0, x1, y1, color) {
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
47
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
48 this.setColor(color, 0.0, 0.65);
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
49 this.ctx.beginPath();
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
50 this.ctx.moveTo(x0, y0);
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
51 this.ctx.lineTo(x1, y1);
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
52 this.ctx.stroke();
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
53
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
54 }
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
55
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
56 var revlink = '<li style="_STYLE"><span class="desc">';
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
57 revlink += '<a href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID">_DESC</a>';
10277
17c6d5eab25d templates: do not add "ago" twice
Martin Geisler <mg@lazybytes.net>
parents: 8431
diff changeset
58 revlink += '</span><span class="info">_DATE, by _USER</span></li>';
7338
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
59
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
60 graph.vertex = function(x, y, color, parity, cur) {
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
61
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
62 this.ctx.beginPath();
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
63 color = this.setColor(color, 0.25, 0.75);
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
64 this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
65 this.ctx.fill();
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
66
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
67 var bg = '<li class="bg parity' + parity + '"></li>';
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
68 var left = (this.columns + 1) * this.bg_height;
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
69 var nstyle = 'padding-left: ' + left + 'px;';
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
70 var item = revlink.replace(/_STYLE/, nstyle);
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
71 item = item.replace(/_PARITY/, 'parity' + parity);
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
72 item = item.replace(/_NODEID/, cur[0]);
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
73 item = item.replace(/_NODEID/, cur[0]);
8236
9f53e203a09b webcommands: move nonempty logic from JavaScript to Python
Martin Geisler <mg@lazybytes.net>
parents: 8235
diff changeset
74 item = item.replace(/_DESC/, cur[3]);
7338
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
75 item = item.replace(/_USER/, cur[4]);
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
76 item = item.replace(/_DATE/, cur[5]);
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
77
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
78 return [bg, item];
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
79
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
80 }
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
81
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
82 graph.render(data);
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
83
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
84 // stop hiding script -->
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
85 </script>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
86
8431
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
87 <form action="{url}log">
7338
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
88 {sessionvars%hiddenformentry}
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
89 <p>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
90 <label for="search1">search:</label>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
91 <input name="rev" id="search1" type="text" size="30">
8431
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
92 navigate: <small class="navigate">{changenav%navgraphentry}</small>
7338
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
93 </p>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
94 </form>
fecfe4392e94 hgweb: move old style to spartan/
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
95
8431
5c1aabc58004 spartan: use newer template syntax everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8357
diff changeset
96 {footer}