# HG changeset patch # User Anton Shestakov # Date 1515151325 -28800 # Node ID bb5a03dfd7ff16ab1df784a5cd26669463e5cb4f # Parent 6c2264732dc5ab3fdb3340090a46edf4b801875c 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 element. This prioritizes text information, so that even if it somehow gets close to the graph drawn on (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. diff -r 6c2264732dc5 -r bb5a03dfd7ff mercurial/templates/spartan/graph.tmpl --- 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 @@
-
      {nodes%graphentry}
    @@ -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 ['
  • ', '']; -} - graph.render(data); diff -r 6c2264732dc5 -r bb5a03dfd7ff mercurial/templates/spartan/graphentry.tmpl --- 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 @@ -
  • - - {desc|strip|firstline|escape|nonempty} - -
    {date|rfc822date}, by {author|person}
    +
  • +
    + + {desc|strip|firstline|escape|nonempty} + +
    {date|rfc822date}, by {author|person}
    +
  • diff -r 6c2264732dc5 -r bb5a03dfd7ff mercurial/templates/static/style.css --- 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 { diff -r 6c2264732dc5 -r bb5a03dfd7ff tests/test-hgweb-commands.t --- 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 { diff -r 6c2264732dc5 -r bb5a03dfd7ff tests/test-hgweb-symrev.t --- 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 @@ shortlog files navigate: (0) tip - third - second - first + third + second + first navigate: (0) tip $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'tags?style=spartan' | egrep $REVLINKS @@ -1026,8 +1026,8 @@ shortlog files navigate: (0) tip - second - first + second + first navigate: (0) tip $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'file/xyzzy?style=spartan' | egrep $REVLINKS