hgweb: avoid invalid infinity scroll request when overwritten web.style

Infinity scroll is broken when you override the web.style in the following ways:

    $ hg --config='web.style=gitweb' serve
    $ open http://localhost:8080/shortlog?style=paper

ajaxScrollInit should use http://localhost:8080/shortlog/%next%?style=paper.
however, http://localhost:8080/shortlog/%next% is used actually.
It is missing style parameter.

This patch add style parameter to request url.
This commit is contained in:
Takumi IINO 2014-01-08 00:35:03 +09:00
parent 96e1c44734
commit db72b3b5e8
5 changed files with 7 additions and 4 deletions

View File

@ -373,6 +373,7 @@ class hgweb(object):
"motd": motd,
"sessionvars": sessionvars,
"pathdef": makebreadcrumb(req.url),
"style": style,
})
return tmpl

View File

@ -448,7 +448,9 @@ class hgwebdir(object):
"logourl": logourl,
"logoimg": logoimg,
"staticurl": staticurl,
"sessionvars": sessionvars})
"sessionvars": sessionvars,
"style": style,
})
return tmpl
def updatereqenv(self, env):

View File

@ -124,7 +124,7 @@ graph.render(data);
<script type="text/javascript">
ajaxScrollInit(
'{url|urlescape}graph/{rev}?revcount=%next%',
'{url|urlescape}graph/{rev}?revcount=%next%&style={style}',
{revcount}+60,
function (htmlText, previousVal) \{ return previousVal + 60; },
'#wrapper',

View File

@ -73,7 +73,7 @@
<script type="text/javascript">
ajaxScrollInit(
'{url|urlescape}shortlog/%next%',
'{url|urlescape}shortlog/%next%{sessionvars%urlparameter}',
'{nextentry%"{node}"}', <!-- NEXTHASH
function (htmlText, previousVal) \{
var m = htmlText.match(/'(\w+)', <!-- NEXTHASH/);

View File

@ -361,7 +361,7 @@ Some tests for hgweb in an empty repository
<script type="text/javascript">
ajaxScrollInit(
'/graph/-1?revcount=%next%',
'/graph/-1?revcount=%next%&style=paper',
60+60,
function (htmlText, previousVal) { return previousVal + 60; },
'#wrapper',