From: Joey Hess <joey@kitenet.net>
Date: Sat, 15 May 2010 01:45:22 +0000 (-0400)
Subject: allow misctemplate callers to pass params to suppress actions etc
X-Git-Tag: 3.20100515~13
X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/c8b34aa31c7d146adf4210c6171dfea2988a7688?ds=inline;hp=--cc

allow misctemplate callers to pass params to suppress actions etc

Suppress disiplay of small search for on search results page, and of
Prefrences link on prefs page.
---

c8b34aa31c7d146adf4210c6171dfea2988a7688
diff --git a/IkiWiki.pm b/IkiWiki.pm
index a42f56bf0..699ad13da 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1745,6 +1745,7 @@ sub misctemplate ($$;@) {
 	run_hooks(pagetemplate => sub {
 		shift->(page => "", destpage => "", template => $template);
 	});
+	templateactions($template, "");
 
 	$template->param(
 		dynamic => 1,
@@ -1755,8 +1756,6 @@ sub misctemplate ($$;@) {
 		html5 => $config{html5},
 		@_,
 	);
-
-	templateactions($template, "");
 	
 	return $template->output;
 }
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index b98e9e0a1..28020b500 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -247,7 +247,9 @@ sub cgi_prefs ($$) {
 		$form->text(gettext("Preferences saved."));
 	}
 	
-	showform($form, $buttons, $session, $q);
+	showform($form, $buttons, $session, $q,
+		prefsurl => "", # avoid showing the preferences link
+	);
 }
 
 sub cgi_custom_failure ($$$) {
diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm
index a9089620b..ff5d0ccbe 100644
--- a/IkiWiki/Plugin/search.pm
+++ b/IkiWiki/Plugin/search.pm
@@ -229,7 +229,8 @@ sub setupfiles () {
 		# Avoid omega interpreting anything in the misctemplate
 		# as an omegascript command.
 		my $misctemplate=IkiWiki::misctemplate(gettext("search"), "\0",
-			searching => 1);
+			searchform => "", # avoid showing the small search form
+		);
 		eval q{use HTML::Entities};
 		error $@ if $@;
 		$misctemplate=encode_entities($misctemplate, '\$');
diff --git a/templates/page.tmpl b/templates/page.tmpl
index a7d200466..f7944e40e 100644
--- a/templates/page.tmpl
+++ b/templates/page.tmpl
@@ -48,11 +48,9 @@
 </TMPL_IF>
 </span>
 </span>
-<TMPL_UNLESS SEARCHING>
 <TMPL_IF SEARCHFORM>
 <TMPL_VAR SEARCHFORM>
 </TMPL_IF>
-</TMPL_UNLESS>
 <TMPL_IF HTML5></header><TMPL_ELSE></div></TMPL_IF>
 
 <TMPL_IF HAVE_ACTIONS>