From: Joey Hess <joey@kitenet.net>
Date: Sun, 2 May 2010 17:49:56 +0000 (-0400)
Subject: Add placeholder text in search form (in html5 mode only).
X-Git-Tag: 3.20100504~38
X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/b21df5029b94c5680d8a3e5f0c1ed40a660a1594

Add placeholder text in search form (in html5 mode only).
---

diff --git a/IkiWiki/Plugin/google.pm b/IkiWiki/Plugin/google.pm
index 85467fa0b..68cde261c 100644
--- a/IkiWiki/Plugin/google.pm
+++ b/IkiWiki/Plugin/google.pm
@@ -42,6 +42,7 @@ sub pagetemplate (@) {
 		if (! defined $form) {
 			my $searchform = template("googleform.tmpl", blind_cache => 1);
 			$searchform->param(url => $config{url});
+			$searchform->param(html5 => $config{html5});
 			$form=$searchform->output;
 		}
 
diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm
index be39fdf1e..9e875c79c 100644
--- a/IkiWiki/Plugin/search.pm
+++ b/IkiWiki/Plugin/search.pm
@@ -58,6 +58,7 @@ sub pagetemplate (@) {
 		if (! defined $form) {
 			my $searchform = template("searchform.tmpl", blind_cache => 1);
 			$searchform->param(searchaction => $config{cgiurl});
+			$searchform->param(html5 => $config{html5});
 			$form=$searchform->output;
 		}
 
diff --git a/debian/changelog b/debian/changelog
index 8158429a0..c9fc2e657 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ ikiwiki (3.20100502) UNRELEASED; urgency=low
 
   * Add parameter to displaytime to specify that it is a pubdate,
     and in html5 mode, use time tag.
+  * Add placeholder text in search form (in html5 mode only).
 
  -- Joey Hess <joeyh@debian.org>  Sun, 02 May 2010 13:22:50 -0400
 
diff --git a/doc/bugs/html5_support.mdwn b/doc/bugs/html5_support.mdwn
index 386a3094a..5530b29db 100644
--- a/doc/bugs/html5_support.mdwn
+++ b/doc/bugs/html5_support.mdwn
@@ -64,11 +64,8 @@ HTML5](http://www.w3.org/TR/html5-diff/).
 > 
 > Other ideas:
 > 
-> * Add pubdate attribute to time elements as appropriate.
 > * Use aside for the sidebar? Or for the [[templates/note]] template?
 > * Use nav for the actionbar
-> * Use placeholder in the search box. Allows closing
->   [[this_todo|Add_label_to_search_form_input_field]]
 > * Use details tag instead of the javascript in the toggle plugin. 
 >   (Need to wait on browser support probably.)
 > 
diff --git a/doc/todo/Add_label_to_search_form_input_field.mdwn b/doc/todo/Add_label_to_search_form_input_field.mdwn
index 281ab48e2..514108fba 100644
--- a/doc/todo/Add_label_to_search_form_input_field.mdwn
+++ b/doc/todo/Add_label_to_search_form_input_field.mdwn
@@ -51,4 +51,6 @@ The patch below adds a label for the field to improve usability:
 > element. already works in eg, chromium. However, ikiwiki does not use
 > html5 yet. --[[Joey]] 
 
+>> [[Done]], placeholder added, in html5 mode only.
+
 [[!tag wishlist bugs/html5_support]]
diff --git a/templates/googleform.tmpl b/templates/googleform.tmpl
index bcf1004a4..f39b46540 100644
--- a/templates/googleform.tmpl
+++ b/templates/googleform.tmpl
@@ -1,6 +1,7 @@
 <form method="get" action="http://www.google.com/search" id="searchform">
  <div>
   <input name="sitesearch" value="<TMPL_VAR URL>" type="hidden" />
-  <input name="q" value="" id="searchbox" size="16" maxlength="255" type="text" />
+  <input name="q" value="" id="searchbox" size="16" maxlength="255" type="text"
+  <TMPL_IF HTML5>placeholder="search"</TMPL_IF> />
  </div>
 </form>
diff --git a/templates/searchform.tmpl b/templates/searchform.tmpl
index afae2ebf5..cb65d124c 100644
--- a/templates/searchform.tmpl
+++ b/templates/searchform.tmpl
@@ -1,5 +1,6 @@
 <form method="get" action="<TMPL_VAR SEARCHACTION>" id="searchform">
 <div>
-<input type="text" id="searchbox" name="P" value="" size="16" />
+<input type="text" id="searchbox" name="P" value="" size="16"
+<TMPL_IF HTML5>placeholder="search"</TMPL_IF> />
 </div>
 </form>