[Bps-public-commit] r17383 - sd/trunk/lib/App/SD/Server

jesse at bestpractical.com jesse at bestpractical.com
Sat Dec 27 16:04:28 EST 2008


Author: jesse
Date: Sat Dec 27 16:04:28 2008
New Revision: 17383

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

Log:
* component / milestone / no_milestone / no_component ui in the webui

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 27 16:04:28 2008
@@ -16,14 +16,21 @@
     my $self = shift;
     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 $milestones = $issues->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);
     }
+    
+    my $components = $issues->child( components => label => 'Components', url => '/components');
+    my $items = $self->server->app_handle->setting( label => 'components' )->get();
+    foreach my $item (@$items) {
+        $components->child( $item => label => $item, url => '/component/'.$item);
+    }
+
+
     $self->server->nav->child( create => label => 'New issue', url => '/issue/new');
     $self->server->nav->child( home => label => 'Home', url => '/');
 
@@ -41,10 +48,10 @@
 
 
 under 'GET' => sub {
-    on qr'^milestone/([\w\d-]+)$' => sub {
-        my $milestone = $1;
-        shift->show_template( 'milestone', $milestone );
-
+    on qr'^(milestone|component)/([\w\d-]+)$' => sub {
+        my $name = $1;
+        my $type = $2;
+        shift->show_template( $name => $type );
     };
 
     on qr'^issue/new' => sub {

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 27 16:04:28 2008
@@ -215,15 +215,41 @@
 
 };
 
-template 'milestone' => page { 'Milestone: '.$_[1] } content {
-    my $self = shift;
+template 'no_component' => sub {show 'component' => undef};
+
+template 'component' => page { 'Component: ' . ( $_[1] || '<i>none</i>' ) }
+content {
+    my $self      = shift;
+    my $component = shift;
+
+    h2 {'Open issues for this component'};
+
+    $self->show_issues(
+        sub {my $item = shift;
+            ( ( $item->prop('component') || '' ) eq $component && $item->has_active_status )
+                ? 1
+                : 0;
+        }
+    );
+};
+
+template 'no_milestone' => sub { show 'milestone' => undef };
+template 'milestone' => page { 'Milestone: ' . ( $_[1] || '<i>none</i>' ) }
+content {
+    my $self      = shift;
     my $milestone = shift;
 
-    h2 { 'Open issues for this milestone' } ;
+    h2 {'Open issues for this milestone'};
 
-    $self->show_issues(sub { (shift->prop('milestone')||'') eq $milestone}); 
-    
-    };
+    $self->show_issues(
+        sub {my $item = shift;
+            ( ( $item->prop('milestone') || '' ) eq ($milestone || '') && $item->has_active_status )
+                ? 1
+                : 0;
+        }
+    );
+
+};
 
 sub show_issues {
     my $self     = shift;



More information about the Bps-public-commit mailing list