diff options
Diffstat (limited to '')
-rw-r--r-- | lib/jitterbug/Task.pm | 20 | ||||
-rw-r--r-- | views/task/index.tt | 3 |
2 files changed, 11 insertions, 12 deletions
diff --git a/lib/jitterbug/Task.pm b/lib/jitterbug/Task.pm index b435de3..6b49b47 100644 --- a/lib/jitterbug/Task.pm +++ b/lib/jitterbug/Task.pm @@ -4,23 +4,21 @@ use Dancer ':syntax'; use Dancer::Plugin::DBIC; use jitterbug::Plugin::Template; -get '/:task_id' => sub { - my $task_id = params->{task_id}; +get '/:id' => sub { + my $task = schema->resultset('Task')->find( params->{id} ); - my $task = schema->resultset('Task')->find($task_id); - my $commit = - schema->resultset('Commit')->find( { sha256 => $task->sha256 } ); - if (!$task) { + if ( !$task ) { send_error("task does not exist!", 404); } - if (!$commit){ - render_error("commit doesn't exists", 404); - } + my $commit = from_json( $task->commit->content ); - my $content = from_json($commit->content); - template 'task/index', {task => $task, commit => $content }; + template 'task/index', + { + task => { id => $task->id, started_when => $task->started_when }, + commit => $commit + }; }; 1; diff --git a/views/task/index.tt b/views/task/index.tt index ca9ba46..faf49cf 100644 --- a/views/task/index.tt +++ b/views/task/index.tt @@ -1,3 +1,4 @@ + <div id="page"> <div id="content"> <h2>Task <: $task.id :></h2> @@ -19,7 +20,7 @@ on <: $commit.ref :> <: } :> <br /> - <: if $commit.build.start_time { :> + <: if $task.started_when { :> started <: $task.started_when :> <: } :> <br /> |