File Coverage

blib/lib/Kwiki/ListPages.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::ListPages;
2              
3 1     1   31367 use Kwiki::Plugin -Base;
  0            
  0            
4             use mixin 'Kwiki::Installer';
5              
6             our $VERSION = '0.11';
7              
8             const class_title => 'List Pages';
9             const class_id => 'list_pages';
10             const css_file => 'list_pages.css';
11              
12             sub register
13             {
14             my $registry = shift;
15             $registry->add( action => 'list_pages' );
16             $registry->add( toolbar => 'ListPages',
17             template => 'list_pages_button.html' );
18             }
19              
20             sub list_pages
21             {
22             my $pages = {};
23             my $all_pages = [];
24             $pages->{$_} = [] foreach( 'A'..'Z', 0..9 );
25             @$all_pages = sort $self->pages->all;
26             foreach my $page (@$all_pages) {
27             push(@{$pages->{ uc(substr($page->{id},0,1)) }}, $page);
28             }
29             $self->render_screen( pages => $pages );
30             }
31              
32             __DATA__