Changeset 9874

Show
Ignore:
Timestamp:
04/19/08 15:48:13 (5 years ago)
Author:
vkgtaro
Message:

lang/perl/Chaostr:

  • Schema::Timeline に create_from_fv を生やした
  • Base::Controller 追加
  • Controller::Texts 追加
Location:
lang/perl/Chaostr/trunk
Files:
10 added
8 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Chaostr/trunk/lib/Chaostr/DB/Schema/Links.pm

    r9278 r9874  
    55 
    66__PACKAGE__->belongs_to( 
    7     'timeline_id', 
     7    'timeline', 
    88    'Chaostr::DB::Schema::Timeline', 
    9     { id => 'timeline' }, 
     9    { id => 'timeline_id' }, 
    1010); 
    1111 
  • lang/perl/Chaostr/trunk/lib/Chaostr/DB/Schema/Photos.pm

    r9278 r9874  
    55 
    66__PACKAGE__->belongs_to( 
    7     'timeline_id', 
     7    'timeline', 
    88    'Chaostr::DB::Schema::Timeline', 
    9     { id => 'timeline' }, 
     9    { id => 'timeline_id' }, 
    1010); 
    1111 
  • lang/perl/Chaostr/trunk/lib/Chaostr/DB/Schema/Quotes.pm

    r9278 r9874  
    55 
    66__PACKAGE__->belongs_to( 
    7     'timeline_id', 
     7    'timeline', 
    88    'Chaostr::DB::Schema::Timeline', 
    9     { id => 'timeline' }, 
     9    { id => 'timeline_id' }, 
    1010); 
    1111 
  • lang/perl/Chaostr/trunk/lib/Chaostr/DB/Schema/Texts.pm

    r9278 r9874  
    55 
    66__PACKAGE__->belongs_to( 
    7     'timeline_id', 
     7    'timeline', 
    88    'Chaostr::DB::Schema::Timeline', 
    9     { id => 'timeline' }, 
     9    { id => 'timeline_id' }, 
    1010); 
    1111 
  • lang/perl/Chaostr/trunk/lib/Chaostr/DB/Schema/Timeline.pm

    r9278 r9874  
    3939); 
    4040 
     41sub create_from_fv { 
     42    my ( $self, $results, $extra ) = @_; 
     43 
     44    $extra->{timeline_id} = $self->id; 
     45 
     46    my $type   = ucfirst $self->type; 
     47    my $schema = $self->result_source->schema; 
     48 
     49    return $schema->resultset($type)->create_from_fv($results, $extra); 
     50} 
     51 
    41521; 
    4253 
  • lang/perl/Chaostr/trunk/lib/Chaostr/DB/Schema/Videos.pm

    r9278 r9874  
    55 
    66__PACKAGE__->belongs_to( 
    7     'timeline_id', 
     7    'timeline', 
    88    'Chaostr::DB::Schema::Timeline', 
    9     { id => 'timeline' }, 
     9    { id => 'timeline_id' }, 
    1010); 
    1111 
  • lang/perl/Chaostr/trunk/lib/Chaostr/Web/Controller/Root.pm

    r8502 r9874  
    3434    } 
    3535 
     36    if ( $c->req->path !~ m{\A (?:login|logout) }xms 
     37             && ! $c->user_exists ) { 
     38        $c->res->redirect( $c->uri_for('/login') ); 
     39        return; 
     40    } 
     41 
    3642    return 1; 
     43} 
     44 
     45sub default : Private { 
     46    my ( $self, $c ) = @_; 
     47 
     48    my $template = $c->req->path . '.tts'; 
     49    if ( -s $c->path_to( '/root/src/' . $template ) ) { 
     50        $c->stash->{template} = $template; 
     51        return; 
     52    } 
     53 
     54    $c->res->status(404); 
     55    $c->error('指定された URL にリソースが見つかりませんでした。'); 
     56    return; 
    3757} 
    3858 
     
    5777 
    5878sub end : ActionClass('RenderView') { 
     79    my ( $self, $c ) = @_; 
     80 
     81    if ( scalar @ { $c->error } && ! $c->debug ) { 
     82        $c->stash->{error}    = $c->error; 
     83        $c->stash->{template} = 'error.tt'; 
     84        $c->forward('TT'); 
     85        $c->error(0); 
     86    } 
    5987} 
    6088 
  • lang/perl/Chaostr/trunk/root/src/error.tt

    r7658 r9874  
    77<p> 
    88  Here's the error message, on the off-chance that it means something 
    9   to you: <span class="error">[% error %]</span> 
     9  to you: 
    1010</p> 
     11 
     12<p> 
     13[% FOREACH msg = error %] 
     14 <span class="error">[% msg %]</span> 
     15[% END %] 
     16</p>