Mercurial > hg
changeset 35532:bb5a03dfd7ff
spartan: make actual changeset entries have backgrounds on /graph
This patch removes a separate container for backgrounds only and puts
backgrounds on changeset elements themselves. This makes it so that JS code
doesn't need to create background elements separately anymore.
There's a bit of manipulating positions of elements: every changeset entry has
a "fg" element that gets a higher z-index than <canvas> element. This
prioritizes text information, so that even if it somehow gets close to the
graph drawn on <canvas> (which has z-index of 5), it'll still be on top of it.
This can happen if commit message has a long first line and browser window is
narrow, for example.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Fri, 05 Jan 2018 19:22:05 +0800 |
parents | 6c2264732dc5 |
children | 8b958d21b19d |
files | mercurial/templates/spartan/graph.tmpl mercurial/templates/spartan/graphentry.tmpl mercurial/templates/static/style.css tests/test-hgweb-commands.t tests/test-hgweb-symrev.t |
diffstat | 5 files changed, 28 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templates/spartan/graph.tmpl Fri Jan 05 19:16:08 2018 +0800 +++ b/mercurial/templates/spartan/graph.tmpl Fri Jan 05 19:22:05 2018 +0800 @@ -31,7 +31,6 @@ <noscript>The revision graph only works with JavaScript-enabled browsers.</noscript> <div id="wrapper"> -<ul id="nodebgs"></ul> <canvas id="graph"></canvas> <ul id="graphnodes">{nodes%graphentry}</ul> </div> @@ -40,12 +39,6 @@ var data = {jsdata|json}; var graph = new Graph(); graph.scale({bg_height}); - -graph.vertex = function(x, y, radius, color, parity, cur) \{ - Graph.prototype.vertex.apply(this, arguments); - return ['<li class="bg parity' + parity + '"></li>', '']; -} - graph.render(data); </script>
--- a/mercurial/templates/spartan/graphentry.tmpl Fri Jan 05 19:16:08 2018 +0800 +++ b/mercurial/templates/spartan/graphentry.tmpl Fri Jan 05 19:22:05 2018 +0800 @@ -1,6 +1,8 @@ -<li data-node="{node|short}"> - <span class="desc"> - <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a> - </span> - <div class="info"><span class="age">{date|rfc822date}</span>, by {author|person}</div> +<li class="parity{parity}" data-node="{node|short}"> + <div class="fg"> + <span class="desc"> + <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}</a> + </span> + <div class="info"><span class="age">{date|rfc822date}</span>, by {author|person}</div> + </div> </li>
--- a/mercurial/templates/static/style.css Fri Jan 05 19:16:08 2018 +0800 +++ b/mercurial/templates/static/style.css Fri Jan 05 19:22:05 2018 +0800 @@ -95,23 +95,21 @@ margin: 0; } -ul#nodebgs { +ul#graphnodes { list-style: none inside none; padding: 0; margin: 0; - top: -0.7em; -} - -ul#graphnodes li, ul#nodebgs li { - height: 39px; } -ul#graphnodes { +ul#graphnodes li { + height: 37px; + overflow: visible; + padding-top: 2px; +} + +ul#graphnodes li .fg { position: absolute; z-index: 10; - top: -0.85em; - list-style: none inside none; - padding: 0; } ul#graphnodes li .info {
--- a/tests/test-hgweb-commands.t Fri Jan 05 19:16:08 2018 +0800 +++ b/tests/test-hgweb-commands.t Fri Jan 05 19:22:05 2018 +0800 @@ -2060,23 +2060,21 @@ margin: 0; } - ul#nodebgs { + ul#graphnodes { list-style: none inside none; padding: 0; margin: 0; - top: -0.7em; - } - - ul#graphnodes li, ul#nodebgs li { - height: 39px; } - ul#graphnodes { + ul#graphnodes li { + height: 37px; + overflow: visible; + padding-top: 2px; + } + + ul#graphnodes li .fg { position: absolute; z-index: 10; - top: -0.85em; - list-style: none inside none; - padding: 0; } ul#graphnodes li .info {
--- a/tests/test-hgweb-symrev.t Fri Jan 05 19:16:08 2018 +0800 +++ b/tests/test-hgweb-symrev.t Fri Jan 05 19:22:05 2018 +0800 @@ -946,9 +946,9 @@ <a href="/shortlog/tip?style=spartan">shortlog</a> <a href="/file/tip/?style=spartan">files</a> navigate: <small class="navigate"><a href="/graph/43c799df6e75?style=spartan">(0)</a> <a href="/graph/tip?style=spartan">tip</a> </small> - <a href="/rev/9d8c40cba617?style=spartan">third</a> - <a href="/rev/a7c1559b7bba?style=spartan">second</a> - <a href="/rev/43c799df6e75?style=spartan">first</a> + <a href="/rev/9d8c40cba617?style=spartan">third</a> + <a href="/rev/a7c1559b7bba?style=spartan">second</a> + <a href="/rev/43c799df6e75?style=spartan">first</a> navigate: <small class="navigate"><a href="/graph/43c799df6e75?style=spartan">(0)</a> <a href="/graph/tip?style=spartan">tip</a> </small> $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'tags?style=spartan' | egrep $REVLINKS @@ -1026,8 +1026,8 @@ <a href="/shortlog/xyzzy?style=spartan">shortlog</a> <a href="/file/xyzzy/?style=spartan">files</a> navigate: <small class="navigate"><a href="/graph/43c799df6e75?style=spartan">(0)</a> <a href="/graph/tip?style=spartan">tip</a> </small> - <a href="/rev/a7c1559b7bba?style=spartan">second</a> - <a href="/rev/43c799df6e75?style=spartan">first</a> + <a href="/rev/a7c1559b7bba?style=spartan">second</a> + <a href="/rev/43c799df6e75?style=spartan">first</a> navigate: <small class="navigate"><a href="/graph/43c799df6e75?style=spartan">(0)</a> <a href="/graph/tip?style=spartan">tip</a> </small> $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'file/xyzzy?style=spartan' | egrep $REVLINKS