Download:
child 19:1d308b29151a
parent 17:84e3983ef532
18:305bd086b730
Anton Shestakov <av6@dwimlabs.net>, Wed, 07 Feb 2018 12:01:22 +0800
graph: port graph changes from hg 4.5

4 файлов изменено, 28 вставок(+), 68 удалений(-) [+]
templates/kit/graph.tmpl file | annotate | diff | comparison | revisions
templates/kit/graphentry.tmpl file | annotate | diff | comparison | revisions
templates/kit/map file | annotate | diff | comparison | revisions
templates/static/style-kit.css file | annotate | diff | comparison | revisions
--- a/templates/kit/graph.tmpl Wed Feb 07 11:59:16 2018 +0800
+++ b/templates/kit/graph.tmpl Wed Feb 07 12:01:22 2018 +0800
@@ -3,7 +3,6 @@
<title>Graph at {symrev|escape} · {repo|escape}</title>
<link rel="alternate" type="application/atom+xml" href="{url|urlescape}atom-log" title="Atom feed for {repo|escape}">
<link rel="alternate" type="application/rss+xml" href="{url|urlescape}rss-log" title="RSS feed for {repo|escape}">
- <!--[if IE]><script type="text/javascript" src="{staticurl|urlescape}excanvas.js"></script><![endif]-->
</head>
<body>
@@ -42,9 +41,8 @@
</ul>
<div class="uk-position-relative" data-scroll-target>
- <ul id="nodebgs"></ul>
- <canvas id="graph" width="{canvaswidth}" height="{canvasheight}"></canvas>
- <ul id="graphnodes"></ul>
+ <canvas id="graph"></canvas>
+ <ul id="graphnodes" class="uk-list">{nodes%graphentry}</ul>
</div>
<ul class="uk-pagination">
@@ -55,65 +53,20 @@
</div>
<script>
-<!-- hide script content
-
var data = {jsdata|json};
var graph = new Graph();
graph.scale({bg_height});
-
-graph.vertex = function(x, y, color, parity, cur) \{
-
- this.ctx.beginPath();
- color = this.setColor(color, 0.25, 0.75);
- this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
- this.ctx.fill();
-
- var bg = '<li class="bg parity' + parity + '"></li>';
- var left = (this.bg_height - this.box_size) + (this.columns + 1) * this.box_size;
- var nstyle = 'padding-left: ' + left + 'px;';
-
- var tagspan = '';
- if (cur[7].length || cur[8].length || (cur[6][0] != 'default' || cur[6][1])) \{
- if (cur[6][1]) \{
- tagspan += '<span class="uk-badge kit-badge-branch-head" title="' + cur[6][0] + '">';
- tagspan += cur[6][0] + '</span> ';
- } else if (!cur[6][1] && cur[6][0] != 'default') \{
- tagspan += '<span class="uk-badge kit-badge-branch" title="' + cur[6][0] + '">';
- tagspan += cur[6][0] + '</span> ';
- }
- if (cur[7].length) \{
- for (var t in cur[7]) \{
- var tag = cur[7][t];
- tagspan += '<span class="uk-badge kit-badge-tag">' + tag + '</span> ';
- }
- }
- if (cur[8].length) \{
- for (var t in cur[8]) \{
- var bookmark = cur[8][t];
- tagspan += '<span class="uk-badge kit-badge-bookmark">' + bookmark + '</span> ';
- }
- }
- }
-
- var item = '<li style="' + nstyle + '"><span class="desc">';
- item += '<a href="{url|urlescape}rev/' + cur[0] + '{sessionvars%urlparameter}" title="' + cur[0] + '">' + cur[3] + '</a>';
- item += '</span> ' + tagspan;
- item += '<span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>';
-
- return [bg, item];
-
-}
-
graph.render(data);
-
-// stop hiding script -->
</script>
<script type="text/javascript">
ajaxScrollInit(
- '{url|urlescape}graph/{rev}?revcount=%next%&style={style}',
- {revcount}+60,
- function (htmlText, previousVal) \{ return previousVal + 60; },
+ '{url|urlescape}graph/%next%{graphvars%urlparameter}',
+ '{nextentry%"{node}"}', <!-- NEXTHASH
+ function (htmlText) \{
+ var m = htmlText.match(/'(\w+)', <!-- NEXTHASH/);
+ return m ? m[1] : null;
+ },
'[data-scroll-target]',
'<div class="%class%" style="text-align: center;">%text%</div>',
'graph'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/kit/graphentry.tmpl Wed Feb 07 12:01:22 2018 +0800
@@ -0,0 +1,7 @@
+<li data-node="{node|short}">
+ <div class="fg">
+ <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a>
+ {alltags}
+ <div>{date|age}, by {author|person}</div>
+ </div>
+</li>
--- a/templates/kit/map Wed Feb 07 11:59:16 2018 +0800
+++ b/templates/kit/map Wed Feb 07 12:01:22 2018 +0800
@@ -253,6 +253,7 @@
</tr>'
shortlog = shortlog.tmpl
graph = graph.tmpl
+graphentry = graphentry.tmpl
tagtag = '<a href="{url|urlescape}rev/{name|revescape}{sessionvars%urlparameter}"><span class="uk-badge kit-badge-tag" title="Tag: {name|escape}">{name|escape}</span></a> '
branchtag = '<a href="{url|urlescape}shortlog/{name|revescape}{sessionvars%urlparameter}"><span class="uk-badge kit-badge-branch-head" title="A head of branch: {name|escape}">{name|escape}</span></a> '
inbranchtag = '<a href="{url|urlescape}shortlog/{name|revescape}{sessionvars%urlparameter}"><span class="uk-badge kit-badge-branch" title="Branch: {name|escape}">{name|escape}</span></a> '
--- a/templates/static/style-kit.css Wed Feb 07 11:59:16 2018 +0800
+++ b/templates/static/style-kit.css Wed Feb 07 12:01:22 2018 +0800
@@ -1,25 +1,24 @@
-#graph {
+canvas#graph {
position: absolute;
z-index: 5;
- top: -0.9em;
+ top: -10px;
+ margin: 0;
+}
+
+ul#graphnodes {
margin: 0;
}
-ul#graphnodes,
-ul#nodebgs {
- list-style: none inside none;
+ul#graphnodes li {
+ position: relative;
+ height: 37px;
+ overflow: visible;
+ padding-top: 2px;
}
-ul#graphnodes {
+ul#graphnodes li .fg {
position: absolute;
z-index: 10;
- top: -0.8em;
- padding: 0;
-}
-
-ul#graphnodes li,
-ul#nodebgs li {
- height: 39px;
}
pre {