Changeset 12458

Show
Ignore:
Timestamp:
05/26/08 21:41:03 (5 years ago)
Author:
tokuhirom
Message:

refactoring

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/mobirc/trunk/lib/App/Mobirc/HTTPD/Template/PC.pm

    r12457 r12458  
    1111 
    1212    div { 
    13         if ($keyword_recent_num > 0) { 
    14             div { attr { class => 'keyword_recent_notice' } 
    15                 a { attr { href => '#' } 
    16                     "Keyword($keyword_recent_num)" 
    17                 } 
    18             }; 
    19         } 
    20  
    21         for my $channel ( $server->channels ) { 
    22             my $class = $channel->unread_lines ? 'unread channel' : 'channel'; 
    23             div { attr { class => $class } 
    24                 a { attr { 'href' => '#' } 
    25                     $channel->name 
    26                 } 
    27             } 
    28         } 
     13        show 'keyword_channel', $keyword_recent_num; 
     14        show 'channel_list', $server; 
    2915    }; 
    3016}; 
    3117 
     18template 'keyword_channel' => sub { 
     19    my ($self, $keyword_recent_num) = validate_pos(@_, OBJECT, SCALAR); 
     20 
     21    if ($keyword_recent_num > 0) { 
     22        div { attr { class => 'keyword_recent_notice' } 
     23            a { attr { href => '#' } 
     24                "Keyword($keyword_recent_num)" 
     25            } 
     26        }; 
     27    } 
     28}; 
     29 
     30template 'channel_list' => sub { 
     31    my ($self, $server) = validate_pos(@_, OBJECT, { 'isa' => 'App::Mobirc::Model::Server' }); 
     32 
     33    for my $channel ( $server->channels ) { 
     34        my $class = $channel->unread_lines ? 'unread channel' : 'channel'; 
     35        div { attr { class => $class } 
     36            a { attr { 'href' => '#' } 
     37                $channel->name 
     38            } 
     39        } 
     40    } 
     41}; 
     42 
    32431;