changeset 33543:58f3088aa2f5

hgweb: consolidate search form for gitweb
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 09 Jun 2017 13:42:38 -0700
parents 265196cd7d7f
children cb5123eff7d1
files 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
diffstat 7 files changed, 25 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- 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> |
--- 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> |
--- a/mercurial/templates/gitweb/map
+++ b/mercurial/templates/gitweb/map
@@ -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
+++ 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">
--- 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 |
--- 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">
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -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> |