Mercurial > hg
changeset 35219:5857eb81c1f3
paper: render changesets server-side on /graph page
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Mon, 04 Dec 2017 16:21:15 +0800 |
parents | d61f2a3d5e53 |
children | dc623009e0b0 |
files | contrib/wix/templates.wxs mercurial/templates/paper/graph.tmpl mercurial/templates/paper/graphentry.tmpl mercurial/templates/paper/map tests/test-hgweb-empty.t tests/test-hgweb-symrev.t |
diffstat | 6 files changed, 28 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/wix/templates.wxs Fri Dec 01 16:00:40 2017 +0800 +++ b/contrib/wix/templates.wxs Mon Dec 04 16:21:15 2017 +0800 @@ -143,6 +143,7 @@ <File Id="paper.filerevision.tmpl" Name="filerevision.tmpl" /> <File Id="paper.footer.tmpl" Name="footer.tmpl" /> <File Id="paper.graph.tmpl" Name="graph.tmpl" /> + <File Id="paper.graphentry.tmpl" Name="graphentry.tmpl" /> <File Id="paper.header.tmpl" Name="header.tmpl" /> <File Id="paper.index.tmpl" Name="index.tmpl" /> <File Id="paper.manifest.tmpl" Name="manifest.tmpl" />
--- a/mercurial/templates/paper/graph.tmpl Fri Dec 01 16:00:40 2017 +0800 +++ b/mercurial/templates/paper/graph.tmpl Mon Dec 04 16:21:15 2017 +0800 @@ -52,7 +52,7 @@ <div id="wrapper"> <ul id="nodebgs" class="stripes2"></ul> <canvas id="graph" width="{canvaswidth}" height="{canvasheight}"></canvas> -<ul id="graphnodes"></ul> +<ul id="graphnodes">{nodes%graphentry}</ul> </div> <script type="text/javascript"{if(nonce, ' nonce="{nonce}"')}> @@ -71,38 +71,13 @@ var bg = '<li class="bg"></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])) \{ - tagspan = '<span class="logtags">'; - if (cur[6][1]) \{ - tagspan += '<span class="branchhead" title="' + cur[6][0] + '">'; - tagspan += cur[6][0] + '</span> '; - } else if (!cur[6][1] && cur[6][0] != 'default') \{ - tagspan += '<span class="branchname" 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="tag">' + tag + '</span> '; - } - } - if (cur[8].length) \{ - for (var b in cur[8]) \{ - var bookmark = cur[8][b]; - tagspan += '<span class="tag">' + bookmark + '</span> '; - } - } - tagspan += '</span>'; + var item = document.querySelector('[data-node="' + cur.node + '"]'); + if (item) \{ + item.style.paddingLeft = left + 'px'; } - - 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 + '<span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>'; - return [bg, item]; + return [bg, '']; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mercurial/templates/paper/graphentry.tmpl Mon Dec 04 16:21:15 2017 +0800 @@ -0,0 +1,7 @@ +<li data-node="{node|short}"> + <span class="desc"> + <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a> + </span> + {alltags} + <span class="info"><span class="age">{date|rfc822date}</span>, by {author|person}</span> +</li>
--- a/mercurial/templates/paper/map Fri Dec 01 16:00:40 2017 +0800 +++ b/mercurial/templates/paper/map Mon Dec 04 16:21:15 2017 +0800 @@ -9,6 +9,7 @@ shortlog = shortlog.tmpl shortlogentry = shortlogentry.tmpl graph = graph.tmpl +graphentry = graphentry.tmpl help = help.tmpl helptopics = helptopics.tmpl
--- a/tests/test-hgweb-empty.t Fri Dec 01 16:00:40 2017 +0800 +++ b/tests/test-hgweb-empty.t Mon Dec 04 16:21:15 2017 +0800 @@ -315,38 +315,13 @@ var bg = '<li class="bg"></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])) { - tagspan = '<span class="logtags">'; - if (cur[6][1]) { - tagspan += '<span class="branchhead" title="' + cur[6][0] + '">'; - tagspan += cur[6][0] + '</span> '; - } else if (!cur[6][1] && cur[6][0] != 'default') { - tagspan += '<span class="branchname" 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="tag">' + tag + '</span> '; - } - } - if (cur[8].length) { - for (var b in cur[8]) { - var bookmark = cur[8][b]; - tagspan += '<span class="tag">' + bookmark + '</span> '; - } - } - tagspan += '</span>'; + var item = document.querySelector('[data-node="' + cur.node + '"]'); + if (item) { + item.style.paddingLeft = left + 'px'; } - - var item = '<li style="' + nstyle + '"><span class="desc">'; - item += '<a href="/rev/' + cur[0] + '" title="' + cur[0] + '">' + cur[3] + '</a>'; - item += '</span>' + tagspan + '<span class="info">' + cur[5] + ', by ' + cur[4] + '</span></li>'; - return [bg, item]; + return [bg, '']; }
--- a/tests/test-hgweb-symrev.t Fri Dec 01 16:00:40 2017 +0800 +++ b/tests/test-hgweb-symrev.t Mon Dec 04 16:21:15 2017 +0800 @@ -59,6 +59,9 @@ <a href="/graph/tip?revcount=30&style=paper">less</a> <a href="/graph/tip?revcount=120&style=paper">more</a> | rev 2: <a href="/graph/43c799df6e75?style=paper">(0)</a> <a href="/graph/tip?style=paper">tip</a> + <a href="/rev/9d8c40cba617?style=paper">third</a> + <a href="/rev/a7c1559b7bba?style=paper">second</a> + <a href="/rev/43c799df6e75?style=paper">first</a> <a href="/graph/tip?revcount=30&style=paper">less</a> <a href="/graph/tip?revcount=120&style=paper">more</a> | rev 2: <a href="/graph/43c799df6e75?style=paper">(0)</a> <a href="/graph/tip?style=paper">tip</a> @@ -123,6 +126,8 @@ <a href="/graph/xyzzy?revcount=30&style=paper">less</a> <a href="/graph/xyzzy?revcount=120&style=paper">more</a> | rev 1: <a href="/graph/43c799df6e75?style=paper">(0)</a> <a href="/graph/tip?style=paper">tip</a> + <a href="/rev/a7c1559b7bba?style=paper">second</a> + <a href="/rev/43c799df6e75?style=paper">first</a> <a href="/graph/xyzzy?revcount=30&style=paper">less</a> <a href="/graph/xyzzy?revcount=120&style=paper">more</a> | rev 1: <a href="/graph/43c799df6e75?style=paper">(0)</a> <a href="/graph/tip?style=paper">tip</a> @@ -254,6 +259,9 @@ <a href="/graph/tip?revcount=30&style=coal">less</a> <a href="/graph/tip?revcount=120&style=coal">more</a> | rev 2: <a href="/graph/43c799df6e75?style=coal">(0)</a> <a href="/graph/tip?style=coal">tip</a> + <a href="/rev/9d8c40cba617?style=coal">third</a> + <a href="/rev/a7c1559b7bba?style=coal">second</a> + <a href="/rev/43c799df6e75?style=coal">first</a> <a href="/graph/tip?revcount=30&style=coal">less</a> <a href="/graph/tip?revcount=120&style=coal">more</a> | rev 2: <a href="/graph/43c799df6e75?style=coal">(0)</a> <a href="/graph/tip?style=coal">tip</a> @@ -318,6 +326,8 @@ <a href="/graph/xyzzy?revcount=30&style=coal">less</a> <a href="/graph/xyzzy?revcount=120&style=coal">more</a> | rev 1: <a href="/graph/43c799df6e75?style=coal">(0)</a> <a href="/graph/tip?style=coal">tip</a> + <a href="/rev/a7c1559b7bba?style=coal">second</a> + <a href="/rev/43c799df6e75?style=coal">first</a> <a href="/graph/xyzzy?revcount=30&style=coal">less</a> <a href="/graph/xyzzy?revcount=120&style=coal">more</a> | rev 1: <a href="/graph/43c799df6e75?style=coal">(0)</a> <a href="/graph/tip?style=coal">tip</a>