summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-05-14 20:04:02 -0400
committerJoey Hess <joey@kitenet.net>2010-05-14 20:04:02 -0400
commit5a4c95cc352d6895c11542245981c62a5c003370 (patch)
treeff0fef8712951354ba105608829398aaa182cd20 /IkiWiki/Plugin
parent8ff761afa24febdb280c672b3b31d6145990f050 (diff)
enable action bar on misctemplates
So RecentChanges shows on the action bar there, convert recentchanges to use new pageactions hook, with compatability code to avoid breaking old templates.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/recentchanges.pm18
1 files changed, 16 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm
index 5c7b71aaa..65044080f 100644
--- a/IkiWiki/Plugin/recentchanges.pm
+++ b/IkiWiki/Plugin/recentchanges.pm
@@ -11,6 +11,7 @@ sub import {
hook(type => "getsetup", id => "recentchanges", call => \&getsetup);
hook(type => "checkconfig", id => "recentchanges", call => \&checkconfig);
hook(type => "refresh", id => "recentchanges", call => \&refresh);
+ hook(type => "pageactions", id => "recentchanges", call => \&pageactions);
hook(type => "pagetemplate", id => "recentchanges", call => \&pagetemplate);
hook(type => "htmlize", id => "_change", call => \&htmlize);
# Load goto to fix up links from recentchanges
@@ -61,14 +62,27 @@ sub refresh ($) {
}
# Enable the recentchanges link on wiki pages.
+sub pageactions (@) {
+ my %params=@_;
+ my $page=$params{page};
+
+ if (defined $config{recentchangespage} && $config{rcs} &&
+ $page ne $config{recentchangespage}) {
+ return htmllink($page, $page, $config{recentchangespage},
+ gettext("RecentChanges"));
+ }
+}
+
+# Backwards compatability for templates still using
+# RECENTCHANGESURL.
sub pagetemplate (@) {
my %params=@_;
my $template=$params{template};
my $page=$params{page};
if (defined $config{recentchangespage} && $config{rcs} &&
- $page ne $config{recentchangespage} &&
- $template->query(name => "recentchangesurl")) {
+ $template->query(name => "recentchangesurl") &&
+ $page ne $config{recentchangespage}) {
$template->param(recentchangesurl => urlto($config{recentchangespage}, $page));
$template->param(have_actions => 1);
}