[Rt-commit] rt branch, 4.6/priority-as-string, repushed
Brian Duggan
brian at bestpractical.com
Wed Jun 13 09:36:27 EDT 2018
The branch 4.6/priority-as-string was deleted and repushed:
was feeff463a61d2b3507b5c97474d446294fc80697
now 17385e95ce31be16f9d835d039f2b25dd91bfd18
1: feeff463a ! 1: 17385e95c Core RT::Extension::PriorityAsString
@@ -179,28 +179,49 @@
--- a/share/html/Elements/RT__Ticket/ColumnMap
+++ b/share/html/Elements/RT__Ticket/ColumnMap
@@
- Priority => {
- title => 'Priority', # loc
- attribute => 'Priority',
-- value => sub { return $_[0]->Priority }
-+ value => sub { return $_[0]->PriorityAsString }
- },
- InitialPriority => {
- title => 'InitialPriority', # loc
- attribute => 'InitialPriority',
- name => 'Initial Priority',
-- value => sub { return $_[0]->InitialPriority }
-+ value => sub { return $_[0]->InitialPriorityAsString }
- },
- FinalPriority => {
- title => 'FinalPriority', # loc
- attribute => 'FinalPriority',
- name => 'Final Priority',
-- value => sub { return $_[0]->FinalPriority }
-+ value => sub { return $_[0]->FinalPriorityAsString }
- },
- EffectiveId => {
- title => 'EffectiveId', # loc
+ }
+ }
+
++my $printer = sub {
++ my ($class, $string) = @_;
++ return '' unless defined $string && length $string;
++
++ my $request_path = $HTML::Mason::Commands::r->path_info;
++ if ($request_path =~ /Results\.tsv/) {
++ return loc($string);
++ }
++
++ my $escaped = $m->interp->apply_escapes($string, 'h');
++ my $loc_escaped = $m->interp->apply_escapes(loc($string), 'h');
++ return \( qq{<span class="ticket-info-$class-}. lc($escaped) .qq{">$loc_escaped</span>} );
++
++};
++
++foreach my $field (qw(Priority InitialPriority FinalPriority)) {
++ $COLUMN_MAP->{ $field .'Number' } ||= $COLUMN_MAP->{ $field };
++
++ my $class = lc($field);
++ $class =~ s/(?=<.)(?=priority)/-/;
++
++ my $method = $field .'AsString';
++
++ my %queues = RT->Config->Get('PriorityAsStringQueues');
++ if (not keys %queues) {
++ $COLUMN_MAP->{ $field }{'value'} = sub {
++ return $printer->( $class, $_[0]->$method() );
++ };
++ } else {
++ $COLUMN_MAP->{ $field }{'value'} = sub {
++ return $queues{$_[0]->QueueObj->Name}
++ ? $printer->( $class, $_[0]->$method() )
++ : $_[0]->$field;
++ };
++ }
++}
++
+ $m->callback( GenericMap => $GenericMap, COLUMN_MAP => $COLUMN_MAP, CallbackName => 'Once', CallbackOnce => 1 );
+ return GetColumnMapEntry( Map => $COLUMN_MAP, Name => $Name, Attribute => $Attr );
+ </%init>
diff --git a/share/html/Elements/SelectPriority b/share/html/Elements/SelectPriority
--- a/share/html/Elements/SelectPriority
More information about the rt-commit
mailing list