aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-05-14 20:20:41 -0400
committerJoey Hess <joey@kitenet.net>2010-05-14 20:20:41 -0400
commitbbe971881a7a3c03dfdb5312215c434e35eff94e (patch)
treeba57cfc88103d80c76e62c97110e0e4c70951187 /IkiWiki.pm
parent377e82b16c95833a37c1f87e57122e8b44c187cb (diff)
downloadikiwiki-bbe971881a7a3c03dfdb5312215c434e35eff94e.tar
ikiwiki-bbe971881a7a3c03dfdb5312215c434e35eff94e.tar.gz
refactor template actions
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm22
1 files changed, 18 insertions, 4 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 46c29abe3..a42f56bf0 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1755,18 +1755,32 @@ sub misctemplate ($$;@) {
html5 => $config{html5},
@_,
);
+
+ templateactions($template, "");
+ return $template->output;
+}
+
+sub templateactions ($$) {
+ my $template=shift;
+ my $page=shift;
+
+ my $have_actions=0;
my @actions;
run_hooks(pageactions => sub {
push @actions, map { { action => $_ } }
- grep { defined } shift->(page => "");
+ grep { defined } shift->(page => $page);
});
$template->param(actions => \@actions);
- if (@actions) {
- $template->param(have_actions => 1);
+
+ if ($config{cgiurl} && exists $hooks{auth}) {
+ $template->param(prefsurl => cgiurl(do => "prefs"));
+ $have_actions=1;
}
- return $template->output;
+ if ($have_actions || @actions) {
+ $template->param(have_actions => 1);
+ }
}
sub hook (@) {