about summary refs log tree commit diff
path: root/lib/jitterbug/Task.pm
blob: 6b49b474db2c48b0254dbe0617a85327d7a38d37 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package jitterbug::Task;

use Dancer ':syntax';
use Dancer::Plugin::DBIC;
use jitterbug::Plugin::Template;

get '/:id' => sub {
    my $task = schema->resultset('Task')->find( params->{id} );


    if ( !$task ) {
        send_error("task does not exist!", 404);
    }

    my $commit = from_json( $task->commit->content );

    template 'task/index',
      {
        task   => { id => $task->id, started_when => $task->started_when },
        commit => $commit
      };
};

1;