[Bps-public-commit] r13956 - in sd/trunk: .

sartak at bestpractical.com sartak at bestpractical.com
Thu Jul 10 15:21:30 EDT 2008


Author: sartak
Date: Thu Jul 10 15:21:27 2008
New Revision: 13956

Modified:
   sd/trunk/   (props changed)
   sd/trunk/Makefile.PL
   sd/trunk/lib/App/SD/Model/Ticket.pm

Log:
 r64063 at onn:  sartak | 2008-07-10 15:21:20 -0400
 Color ticket status in "ticket show"


Modified: sd/trunk/Makefile.PL
==============================================================================
--- sd/trunk/Makefile.PL	(original)
+++ sd/trunk/Makefile.PL	Thu Jul 10 15:21:27 2008
@@ -9,6 +9,8 @@
 requires('Clone');
 requires('Moose'); # Moose::Role
 requires('DateTime');
+requires('Term::ANSIColor');
+
 features(
     'RT sync' => [
         -default => 1,

Modified: sd/trunk/lib/App/SD/Model/Ticket.pm
==============================================================================
--- sd/trunk/lib/App/SD/Model/Ticket.pm	(original)
+++ sd/trunk/lib/App/SD/Model/Ticket.pm	Thu Jul 10 15:21:27 2008
@@ -1,6 +1,9 @@
 package App::SD::Model::Ticket;
 use Moose;
 extends 'App::SD::Record';
+
+use Term::ANSIColor;
+
 use constant collection_class => 'App::SD::Collection::Ticket';
 use constant record_type => 'ticket';
 
@@ -29,6 +32,19 @@
 
 }
 
+sub color_prop_status {
+    my ($self, $value) = @_;
+
+    # these colors were picked out of a hat
+    my $color = $value eq 'new'     ? 'red'
+              : $value eq 'open'    ? 'yellow'
+              : $value eq 'closed'  ? 'green'
+              : $value eq 'stalled' ? 'blue'
+                                    : '';
+
+    return colored($value, $color);
+}
+
 __PACKAGE__->register_reference( comments => 'App::SD::Collection::Comment', by => 'ticket');
 __PACKAGE__->register_reference( attachments => 'App::SD::Collection::Attachment', by => 'ticket');
 



More information about the Bps-public-commit mailing list