[PATCH 3 of 5] hgweb: consolidate search form for gitweb
Gregory Szorc
gregory.szorc at gmail.com
Fri Jun 9 21:00:04 UTC 2017
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1497040958 25200
# Fri Jun 09 13:42:38 2017 -0700
# Node ID 47282854e7aff870a87c9e573d4ef5fdca5b894a
# Parent 08889384494e21be250fae4d9c7b8082df31c0b2
hgweb: consolidate search form for gitweb
diff --git a/mercurial/templates/gitweb/changelog.tmpl b/mercurial/templates/gitweb/changelog.tmpl
--- a/mercurial/templates/gitweb/changelog.tmpl
+++ b/mercurial/templates/gitweb/changelog.tmpl
@@ -12,12 +12,7 @@
<a href="/">Mercurial</a> {pathdef%breadcrumb} / changelog
</div>
-<form action="{url|urlescape}log">
-{sessionvars%hiddenformentry}
-<div class="search">
-<input type="text" name="rev" />
-</div>
-</form>
+{searchform}
<div class="page_nav">
<a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a> |
diff --git a/mercurial/templates/gitweb/graph.tmpl b/mercurial/templates/gitweb/graph.tmpl
--- a/mercurial/templates/gitweb/graph.tmpl
+++ b/mercurial/templates/gitweb/graph.tmpl
@@ -13,12 +13,8 @@
<a href="/">Mercurial</a> {pathdef%breadcrumb} / graph
</div>
-<form action="{url|urlescape}log">
-{sessionvars%hiddenformentry}
-<div class="search">
-<input type="text" name="rev" />
-</div>
-</form>
+{searchform}
+
<div class="page_nav">
<a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a> |
<a href="{url|urlescape}shortlog/{symrev}{sessionvars%urlparameter}">shortlog</a> |
diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map
--- a/mercurial/templates/gitweb/map
+++ b/mercurial/templates/gitweb/map
@@ -323,3 +323,11 @@ index = index.tmpl
urlparameter = '{separator}{name}={value|urlescape}'
hiddenformentry = '<input type="hidden" name="{name}" value="{value|escape}" />'
breadcrumb = '> <a href="{url|urlescape}">{name|escape}</a> '
+
+searchform = '
+ <form action="{url|urlescape}log">
+ {sessionvars%hiddenformentry}
+ <div class="search">
+ <input type="text" name="rev" />
+ </div>
+ </form>'
diff --git a/mercurial/templates/gitweb/search.tmpl b/mercurial/templates/gitweb/search.tmpl
--- a/mercurial/templates/gitweb/search.tmpl
+++ b/mercurial/templates/gitweb/search.tmpl
@@ -11,12 +11,8 @@
<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
<a href="/">Mercurial</a> {pathdef%breadcrumb} / search
-<form action="{url|urlescape}log">
-{sessionvars%hiddenformentry}
-<div class="search">
-<input type="text" name="rev" value="{query|escape}" />
-</div>
-</form>
+{searchform}
+
</div>
<div class="page_nav">
diff --git a/mercurial/templates/gitweb/shortlog.tmpl b/mercurial/templates/gitweb/shortlog.tmpl
--- a/mercurial/templates/gitweb/shortlog.tmpl
+++ b/mercurial/templates/gitweb/shortlog.tmpl
@@ -12,12 +12,8 @@
<a href="/">Mercurial</a> {pathdef%breadcrumb} / shortlog
</div>
-<form action="{url|urlescape}log">
-{sessionvars%hiddenformentry}
-<div class="search">
-<input type="text" name="rev" />
-</div>
-</form>
+{searchform}
+
<div class="page_nav">
<a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a> |
shortlog |
diff --git a/mercurial/templates/gitweb/summary.tmpl b/mercurial/templates/gitweb/summary.tmpl
--- a/mercurial/templates/gitweb/summary.tmpl
+++ b/mercurial/templates/gitweb/summary.tmpl
@@ -10,12 +10,9 @@
<div class="page_header">
<a href="{logourl}" title="Mercurial" style="float: right;">Mercurial</a>
<a href="/">Mercurial</a> {pathdef%breadcrumb} / summary
-<form action="{url|urlescape}log">
-{sessionvars%hiddenformentry}
-<div class="search">
-<input type="text" name="rev" />
-</div>
-</form>
+
+{searchform}
+
</div>
<div class="page_nav">
diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -1533,12 +1533,15 @@ Overviews
<div class="page_header">
<a href="https://mercurial-scm.org/" title="Mercurial" style="float: right;">Mercurial</a>
<a href="/">Mercurial</a> / summary
+
+
<form action="/log">
<input type="hidden" name="style" value="gitweb" />
<div class="search">
<input type="text" name="rev" />
</div>
</form>
+
</div>
<div class="page_nav">
@@ -1734,12 +1737,14 @@ Overviews
<a href="/">Mercurial</a> / graph
</div>
+
<form action="/log">
<input type="hidden" name="style" value="gitweb" />
<div class="search">
<input type="text" name="rev" />
</div>
</form>
+
<div class="page_nav">
<a href="/summary?style=gitweb">summary</a> |
<a href="/shortlog/tip?style=gitweb">shortlog</a> |
More information about the Mercurial-devel
mailing list