The blob action now has simple (but functioning) syntax highlighting (thanks to jrock...
[catagits/Gitalist.git] / lib / Gitalist / Controller / Root.pm
index 10b8cb3..7f54f8c 100644 (file)
@@ -74,27 +74,18 @@ sub index :Path :Args(0) {
 sub blob : Local {
   my ( $self, $c ) = @_;
 
-  my $git      = $c->model('Git');
-  my $req      = $c->req;
-  my $proj     = $req->param('p');
-  my $filename = $req->param('f')  || $req->param('filename');
-  my $hash     = $req->param('hb') || $git->get_head_hash($proj);
-  my $filehash = $req->param('h')  || $git->get_hash_by_path($proj, $hash, $filename, 'blob');
-  
-  my $blob = $git->run_cmd('cat-file' => blob => $filehash);
-
   $c->stash(
-      blob   => $blob,
+      blob   => $c->model('GPP')->get_object($c->req->param('h'))->content,
       action => 'blob',
   );
+
+  $c->forward('View::Syntax');
 }
 
 sub reflog : Local {
   my ( $self, $c ) = @_;
 
   my @log = $c->model('Git')->reflog(
-      # XXX The project parameter should probably be passed into the Model.
-      $c->req->param('p'),
       '--since=yesterday'
   );
 
@@ -104,6 +95,15 @@ sub reflog : Local {
   );
 }
 
+sub commit : Local {
+  my ( $self, $c ) = @_;
+
+  $c->stash(
+      commit => $c->model('GPP')->get_object($c->req->param('h')),
+      action => 'commit',
+  );
+}
+
 sub auto : Private {
     my($self, $c) = @_;