comparison templates/graph.tmpl @ 6693:7f58dec6aeb7

hgweb: Fix up non-coal styles to support graph.
author Augie Fackler <durin42@gmail.com>
date Wed, 18 Jun 2008 10:05:43 +0200
parents
children bf72e756c98b
comparison
equal deleted inserted replaced
6691:0dba955c2636 6693:7f58dec6aeb7
1 #header#
2 <title>#repo|escape#: graph</title>
3 <link rel="alternate" type="application/atom+xml"
4 href="#url#atom-tags" title="Atom feed for #repo|escape#: tags">
5 <link rel="alternate" type="application/rss+xml"
6 href="#url#rss-tags" title="RSS feed for #repo|escape#: tags">
7 </head>
8 <body>
9
10 <div class="buttons">
11 <a href="#url#log{sessionvars%urlparameter}">changelog</a>
12 <a href="#url#shortlog{sessionvars%urlparameter}">shortlog</a>
13 <a href="#url#tags{sessionvars%urlparameter}">tags</a>
14 <a href="#url#file/#node|short#/{sessionvars%urlparameter}">files</a>
15 </div>
16
17 <h2>graph</h2>
18
19 <form action="#url#log">
20 {sessionvars%hiddenformentry}
21 <p>
22 <label for="search1">search:</label>
23 <input name="rev" id="search1" type="text" size="30">
24 navigate: <small class="navigate">#changenav%navshortentry#</small>
25 </p>
26 </form>
27
28 <div id="noscript">The revision graph only works with JavaScript-enabled browsers.</div>
29
30 <div id="wrapper">
31 <ul id="nodebgs"></ul>
32 <canvas id="graph" width="224" height="#canvasheight#"></canvas>
33 <ul id="graphnodes"></ul>
34 </div>
35
36 <script type="text/javascript" src="#staticurl#graph.js"></script>
37 <script>
38
39 document.getElementById('noscript').style.visibility = 'hidden';
40
41 data = {jsdata|json};
42 graph = new Graph();
43 graph.scale({bg_height});
44
45 graph.edge = function(x0, y0, x1, y1, color) {
46
47 this.setColor(color, 0.0, 0.65);
48 this.ctx.beginPath();
49 this.ctx.moveTo(x0, y0);
50 this.ctx.lineTo(x1, y1);
51 this.ctx.stroke();
52
53 }
54
55 var nodes = document.getElementById('graphnodes');
56 var nodebgs = document.getElementById('nodebgs');
57
58 var revlink = '<li style="_STYLE"><span class="desc">';
59 revlink += '<a href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID">_DESC</a>';
60 revlink += '</span><span class="info">_DATE ago, by _USER</span></li>';
61
62 graph.vertex = function(x, y, color, parity, cur) {
63
64 this.ctx.beginPath();
65 color = this.setColor(color, 0.25, 0.75);
66 this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
67 this.ctx.fill();
68
69 var bg = '<li class="bg parity' + parity + '"></li>';
70 nodebgs.innerHTML += bg;
71
72 var left = (this.columns + 1) * this.bg_height;
73 var nstyle = 'padding-left: ' + left + 'px;';
74 var item = revlink.replace(/_STYLE/, nstyle);
75 item = item.replace(/_PARITY/, 'parity' + parity);
76 item = item.replace(/_NODEID/, cur[0]);
77 item = item.replace(/_NODEID/, cur[0]);
78 item = item.replace(/_DESC/, cur[3]);
79 item = item.replace(/_USER/, cur[4]);
80 item = item.replace(/_DATE/, cur[5]);
81 nodes.innerHTML += item;
82
83 }
84
85 graph.render(data);
86 </script>
87
88 <br />
89 <small class="navigate">
90 <a href="{url}graph/{uprev}{sessionvars%urlparameter}?revcount={revcountless}">less</a>
91 <a href="{url}graph/{uprev}{sessionvars%urlparameter}?revcount={revcountmore}">more</a>
92 | {changenav%navshortentry}
93 </small>
94
95 #footer#