comparison pylons_app/templates/graph.html @ 106:a86c8de926b4

some fixes in graph tab. Little fixes in files
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 25 Apr 2010 23:26:14 +0200
parents
children 20dc7a5eb748
comparison
equal deleted inserted replaced
105:3ac4350b7848 106:a86c8de926b4
1 <%inherit file="base/base.html"/>
2
3 <%def name="title()">
4 ${_('Repository managment')}
5 </%def>
6 <%def name="breadcrumbs()">
7 ${h.link_to(u'Home',h.url('/'))}
8 /
9 ${h.link_to(c.repo_name,h.url('graph_home',repo_name=c.repo_name))}
10 /
11 ${_('graph')}
12 </%def>
13 <%def name="page_nav()">
14 <form action="log">
15 <dl class="search">
16 <dt><label>Search: </label></dt>
17 <dd><input type="text" name="rev" /></dd>
18 </dl>
19 </form>
20
21 ${self.menu('graph')}
22 </%def>
23
24 <%def name="main()">
25
26 <h2 class="no-link no-border">${_('Graph')} - ${_('showing ')} ${c.size} ${_('revisions')}</h2>
27 <noscript>${_('The revision graph only works with JavaScript-enabled browsers.')}</noscript>
28 <div>
29 ${h.form(h.url.current(),method='get')}
30 ${_('Show')}: ${h.text('size',size=10,value=c.size)} ${_('revisions')}
31 ${h.submit('','set')}
32 ${h.end_form()}
33 </div>
34 <div id="wrapper">
35 <ul id="nodebgs"></ul>
36 <canvas id="graph" width="224" height="${c.canvasheight}"></canvas>
37 <ul id="graphnodes"></ul>
38 </div>
39
40 <script type="text/javascript" src="/js/graph.js"></script>
41 <script>
42 <!-- hide script content
43
44 var data = ${c.jsdata|n};
45 var graph = new Graph();
46 graph.scale(39);
47
48 graph.edge = function(x0, y0, x1, y1, color) {
49
50 this.setColor(color, 0.0, 0.65);
51 this.ctx.beginPath();
52 this.ctx.moveTo(x0, y0);
53 this.ctx.lineTo(x1, y1);
54 this.ctx.stroke();
55
56 }
57
58 var revlink = '<li style="_STYLE"><span class="desc">';
59 revlink += '<a class="list" href="/${c.repo_name}/changeset/_NODEID" title="_NODEID"><b>_DESC</b></a>';
60 revlink += '</span> _TAGS';
61 revlink += '<span class="info">_DATE, by _USER</span></li>';
62
63 graph.vertex = function(x, y, color, parity, cur) {
64
65 this.ctx.beginPath();
66 color = this.setColor(color, 0.25, 0.75);
67 this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
68 this.ctx.fill();
69
70 var bg = '<li class="bg parity' + parity + '"></li>';
71 var left = (this.columns + 1) * this.bg_height;
72 var nstyle = 'padding-left: ' + left + 'px;';
73 var item = revlink.replace(/_STYLE/, nstyle);
74 item = item.replace(/_PARITY/, 'parity' + parity);
75 item = item.replace(/_NODEID/, cur[0]);
76 item = item.replace(/_NODEID/, cur[0]);
77 item = item.replace(/_DESC/, cur[3]);
78 item = item.replace(/_USER/, cur[4]);
79 item = item.replace(/_DATE/, cur[5]);
80
81 var tagspan = '';
82 if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) {
83 tagspan = '<span class="logtags">';
84 if (cur[6][1]) {
85 tagspan += '<span class="branchtag" title="' + cur[6][0] + '">';
86 tagspan += cur[6][0] + '</span> ';
87 } else if (!cur[6][1] && cur[6][0] != 'default') {
88 tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">';
89 tagspan += cur[6][0] + '</span> ';
90 }
91 if (cur[7].length) {
92 for (var t in cur[7]) {
93 var tag = cur[7][t];
94 tagspan += '<span class="tagtag">' + tag + '</span> ';
95 }
96 }
97 tagspan += '</span>';
98 }
99
100 item = item.replace(/_TAGS/, tagspan);
101 return [bg, item];
102
103 }
104
105 graph.render(data);
106
107 // stop hiding script -->
108 </script>
109 <div>
110 <h2>${c.pagination.pager('$link_previous ~2~ $link_next')}</h2>
111 </div>
112 </%def>