File Coverage

blib/lib/Kwiki/Widgets/RecentChanges.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package Kwiki::Widgets::RecentChanges;
2 1     1   1033 use Kwiki::Plugin -Base;
  0            
  0            
3             use mixin 'Kwiki::Installer';
4             our $VERSION = '0.01';
5              
6             const class_id => 'widgets_recent_changes';
7             const class_title => 'Widgets Recent Changes';
8              
9             sub register {
10             my $registry = shift;
11             $registry->add(widget => 'recent_changes',
12             template => 'widgets_recent_changes.html');
13             $registry->add(preference => $self->recent_changes_numbers);
14             }
15              
16             sub recent_changes_numbers {
17             my $p = $self->new_preference('widget_recent_changes_numbers');
18             $p->query('How many recent changed pages to display in the widget ?');
19             $p->type('pulldown');
20             my $choices = [ qw(5 5 10 10 15 15 20 20) ];
21             $p->choices($choices);
22             $p->default(5);
23             return $p;
24             }
25              
26             sub get_pages {
27             my $number = $self->preferences->widget_recent_changes_numbers->value;
28             my @pages = sort {
29             $b->modified_time <=> $a->modified_time
30             } $self->pages->recent_by_count($number);
31             return \@pages;
32             }
33              
34             __DATA__