hgweb: consolidate search form for gitweb
authorGregory Szorc <gregory.szorc@gmail.com>
Fri, 09 Jun 2017 13:42:38 -0700
changeset 32760 58f3088aa2f5
parent 32759 265196cd7d7f
child 32761 cb5123eff7d1
hgweb: consolidate search form for gitweb
mercurial/templates/gitweb/changelog.tmpl
mercurial/templates/gitweb/graph.tmpl
mercurial/templates/gitweb/map
mercurial/templates/gitweb/search.tmpl
mercurial/templates/gitweb/shortlog.tmpl
mercurial/templates/gitweb/summary.tmpl
tests/test-hgweb-commands.t
--- a/mercurial/templates/gitweb/changelog.tmpl	Fri Jun 09 13:41:10 2017 -0700
+++ b/mercurial/templates/gitweb/changelog.tmpl	Fri Jun 09 13:42:38 2017 -0700
@@ -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> |
--- a/mercurial/templates/gitweb/graph.tmpl	Fri Jun 09 13:41:10 2017 -0700
+++ b/mercurial/templates/gitweb/graph.tmpl	Fri Jun 09 13:42:38 2017 -0700
@@ -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> |
--- a/mercurial/templates/gitweb/map	Fri Jun 09 13:41:10 2017 -0700
+++ b/mercurial/templates/gitweb/map	Fri Jun 09 13:42:38 2017 -0700
@@ -323,3 +323,11 @@
 urlparameter = '{separator}{name}={value|urlescape}'
 hiddenformentry = '<input type="hidden" name="{name}" value="{value|escape}" />'
 breadcrumb = '&gt; <a href="{url|urlescape}">{name|escape}</a> '
+
+searchform = '
+  <form action="{url|urlescape}log">
+    {sessionvars%hiddenformentry}
+    <div class="search">
+      <input type="text" name="rev" value="{query|escape}" />
+    </div>
+  </form>'
--- a/mercurial/templates/gitweb/search.tmpl	Fri Jun 09 13:41:10 2017 -0700
+++ b/mercurial/templates/gitweb/search.tmpl	Fri Jun 09 13:42:38 2017 -0700
@@ -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">
--- a/mercurial/templates/gitweb/shortlog.tmpl	Fri Jun 09 13:41:10 2017 -0700
+++ b/mercurial/templates/gitweb/shortlog.tmpl	Fri Jun 09 13:42:38 2017 -0700
@@ -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 |
--- a/mercurial/templates/gitweb/summary.tmpl	Fri Jun 09 13:41:10 2017 -0700
+++ b/mercurial/templates/gitweb/summary.tmpl	Fri Jun 09 13:42:38 2017 -0700
@@ -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">
--- a/tests/test-hgweb-commands.t	Fri Jun 09 13:41:10 2017 -0700
+++ b/tests/test-hgweb-commands.t	Fri Jun 09 13:42:38 2017 -0700
@@ -1533,12 +1533,15 @@
   <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"  />
+  <input type="text" name="rev" value="" />
   </div>
   </form>
+  
   </div>
   
   <div class="page_nav">
@@ -1734,12 +1737,14 @@
   <a href="/">Mercurial</a>  / graph
   </div>
   
+  
   <form action="/log">
   <input type="hidden" name="style" value="gitweb" />
   <div class="search">
-  <input type="text" name="rev"  />
+  <input type="text" name="rev" value="" />
   </div>
   </form>
+  
   <div class="page_nav">
   <a href="/summary?style=gitweb">summary</a> |
   <a href="/shortlog/tip?style=gitweb">shortlog</a> |