[Bps-public-commit] r17212 - in sd/trunk/lib/App/SD: .

jesse at bestpractical.com jesse at bestpractical.com
Sat Dec 13 15:07:36 EST 2008


Author: jesse
Date: Sat Dec 13 15:07:36 2008
New Revision: 17212

Added:
   sd/trunk/lib/App/SD/Server.pm
Modified:
   sd/trunk/lib/App/SD/Server/Dispatcher.pm
   sd/trunk/lib/App/SD/Server/View.pm

Log:
* progressive work on a webui

Added: sd/trunk/lib/App/SD/Server.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/Server.pm	Sat Dec 13 15:07:36 2008
@@ -0,0 +1,12 @@
+package App::SD::Server;
+use base 'Prophet::Server';
+
+sub css {
+    return shift->SUPER::css(@_), "/css/sd.css";
+}
+
+sub js {
+    return shift->SUPER::js(@_);
+}
+1;
+

Modified: sd/trunk/lib/App/SD/Server/Dispatcher.pm
==============================================================================
--- sd/trunk/lib/App/SD/Server/Dispatcher.pm	(original)
+++ sd/trunk/lib/App/SD/Server/Dispatcher.pm	Sat Dec 13 15:07:36 2008
@@ -3,9 +3,20 @@
 
 on qr'.' => sub {
     my $self = shift;
-    $self->server->nav->child( home => label => 'Home', url => '/');
+    my $issues = $self->server->nav->child( issues => label => 'Issues', url => '/issues');
+    $issues->child( go => label => '<form method="GET" action="/issue"><a href="#">Show issue # <input type=text name=id size=3></a></form>', escape_label => 0);
+    my $milestones = $self->server->nav->child( milestones => label => 'Milestones', url => '/milestones');
+    
+
+    my $items = $self->server->app_handle->setting( label => 'milestones' )->get();
+    
+    foreach my $item (@$items) {
+        $milestones->child( $item => label => $item, url => '/milestone/'.$item);
+    }
     $self->server->nav->child( create => label => 'New issue', url => '/issue/new');
-    $self->server->nav->child( milestones => label => 'Milestones', url => '/milestones');
+    $self->server->nav->child( home => label => 'Home', url => '/');
+
+
     next_rule;
 
 };
@@ -16,6 +27,16 @@
         shift->show_template( 'milestone', $milestone );
 
     };
+    on qr'^issue/?$' => sub {
+        my $self = shift;
+        my $id = $self->server->cgi->param('id');
+        if ($id) {
+            $self->server->_send_redirect( to => "/issue/$id" );
+
+        } else {
+            next_rule;
+        }
+    };
 
     on qr'^issue/([\w\d-]+)' => sub {
         my $self = shift;

Modified: sd/trunk/lib/App/SD/Server/View.pm
==============================================================================
--- sd/trunk/lib/App/SD/Server/View.pm	(original)
+++ sd/trunk/lib/App/SD/Server/View.pm	Sat Dec 13 15:07:36 2008
@@ -2,32 +2,27 @@
 use strict;
 
 package App::SD::Server::View;
+use base 'Prophet::Server::View';
+
 use Template::Declare::Tags;
 use Prophet::Server::ViewHelpers;
-use base 'Prophet::Server::View';
-use Prophet::Web::Menu;
 
 use App::SD::Model::Ticket;
 use App::SD::Collection::Ticket;
 
-template head => sub {
-    my $self = shift;
-    my $args = shift;
-    head {
-        title { shift @$args };
-        show('style');
-    }
 
-};
+template '/css/sd.css' => sub {
 
-template 'style' => sub {
-
-    style {
         outs_raw( '
-    body {
+
+
+body {
   font-family: sans-serif;
 }
 
+h1 {
+    clear: both;
+}
 div.issue_list {
 
  border: 1px solid grey;
@@ -72,19 +67,32 @@
 
 }
 
+ul.page-nav {
+    float: right;
+}
+
+ul.page-nav a {
+
+}
+
+
 ' );
-    }
 };
 
 template '/' => page {'SD'}
 content {
     p {'sd is a P2P issue tracking system.'};
-    show('milestones');
+    show('milestone_list');
     show('/issues/open');
 
 };
 
-template 'milestones' => sub {
+template 'milestones' => page {
+    show 'milestone_list';
+    }
+
+
+template 'milestone_list' => sub {
     my $self = shift;
     my $milestones = $self->app_handle->setting( label => 'milestones' )->get();
 
@@ -101,17 +109,12 @@
         }
     }
 
-
-
-
-
 };
 
 template 'milestone' => page { 'Milestone: '.$_[1] } content {
     my $self = shift;
     my $milestone = shift;
 
-    h1 { $milestone };
     h2 { 'Open issues for this milestone' } ;
 
     $self->show_issues(sub { (shift->prop('milestone')||'') eq $milestone}); 
@@ -132,13 +135,13 @@
 
 
 
-template footer => sub { "SD $SD::VERSION - Issue tracking for the distributed age"};
+template footer => sub { "SD $App::SD::VERSION - Issue tracking for the distributed age"};
 
 template header => sub {
     my $self = shift;
     my $args = shift;
     my $title = shift @$args;
-    outs_raw($self->nav->render_as_yui_menubar);
+    outs_raw($self->nav->render_as_menubar);
     h1 { $title };
 };
 
@@ -182,7 +185,7 @@
             app_handle => $self->app_handle,
             handle     => $self->app_handle->handle
         );
-        $issue->load(uuid =>$id);
+        $issue->load(($id =~ /^\d+$/ ? 'luid' : 'uuid') =>$id);
 
        $issue->luid.": ".$issue->prop('summary');
     } content {
@@ -192,7 +195,7 @@
             app_handle => $self->app_handle,
             handle     => $self->app_handle->handle
         );
-        $issue->load(uuid => $id);
+        $issue->load(($id =~ /^\d+$/ ? 'luid' : 'uuid') =>$id);
         p {$issue->prop('summary')};
 
 



More information about the Bps-public-commit mailing list