[Rt-commit] rt branch, 4.2/fix-cf-display-in-search-builder, created. rt-4.2.1-37-g0de57ec

? sunnavy sunnavy at bestpractical.com
Tue Nov 26 11:35:24 EST 2013


The branch, 4.2/fix-cf-display-in-search-builder has been created
        at  0de57ec3c025f1799140ed2c655ed265ee8b2127 (commit)

- Log -----------------------------------------------------------------
commit ab2d740129b2525e676578b0ed26c19beb647bc0
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Nov 27 00:17:29 2013 +0800

    show custom field names only and stop localizing them in search builder too
    
    take cf "foobar" for example, in "Add Criteria", it's shown as "foobar",
    but in "Sorting" and "Display Columns", it's shown as "CustomField.{foobar}".
    
    this commit makes it show as "foobar" consistently and also removed localization.

diff --git a/share/html/Search/Elements/EditFormat b/share/html/Search/Elements/EditFormat
index c3491fc..c1927ac 100644
--- a/share/html/Search/Elements/EditFormat
+++ b/share/html/Search/Elements/EditFormat
@@ -59,7 +59,7 @@
 <td valign="top"><select size="6" name="SelectDisplayColumns" multiple="multiple">
 % my %seen;
 % foreach my $field ( grep !$seen{lc $_}++, @$AvailableColumns) {
-<option value="<% $field %>"><% loc($field) %></option>
+<option value="<% $field %>"><% $field =~ /^CustomField\.{(.*)}$/ ? $1 : loc($field) %></option>
 % }
 </select></td>
 <td>
@@ -106,7 +106,7 @@
 <select size="4" name="CurrentDisplayColumns">
 % my $i=0;
 % foreach my $field ( @$CurrentFormat ) {
-<option value="<% $i++ %>><% $field->{Column} %>"><% loc( $field->{Column} ) %></option>
+<option value="<% $i++ %>><% $field->{Column} %>"><% $field->{Column} =~ /^CustomField\.{(.*)}$/ ? $1 : loc( $field->{Column} ) %></option>
 % }
 </select>
 <br />
diff --git a/share/html/Search/Elements/EditSort b/share/html/Search/Elements/EditSort
index ff1dc40..8cd296d 100644
--- a/share/html/Search/Elements/EditSort
+++ b/share/html/Search/Elements/EditSort
@@ -68,7 +68,7 @@
 % if (defined $OrderBy[$o] and $fieldval eq $OrderBy[$o]) {
 selected="selected"
 % }
-><% loc($field) %></option>
+><% $field =~ /^CustomField\.{(.*)}$/ ? $1 : loc($field) %></option>
 % }
 </select>
 <select name="Order">

commit 0de57ec3c025f1799140ed2c655ed265ee8b2127
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Nov 27 00:26:43 2013 +0800

    stop localizing custom field names in table header of search result page.

diff --git a/share/html/Elements/CollectionAsTable/Header b/share/html/Elements/CollectionAsTable/Header
index ffb7441..5194921 100644
--- a/share/html/Elements/CollectionAsTable/Header
+++ b/share/html/Elements/CollectionAsTable/Header
@@ -95,6 +95,7 @@ foreach my $col ( @Format ) {
         if $span;
     $m->out('>');
 
+    my $loc_title;
     # if title is not defined then use defined attribute or last
     # one we saw in the format
     unless ( defined $col->{'title'} ) {
@@ -109,8 +110,9 @@ foreach my $col ( @Format ) {
         # in case title is not defined in ColumnMap 
         # the following regex changes $attr like from "ReferredToBy" to "Referred To By"
         $title = join ' ', split /(?<=[a-z])(?=[A-Z])/, $attr unless defined $title;
+        $loc_title = $attr =~ /^CustomField\.{.*}$/ ? $title : loc($title);
     } else {
-        $title = $m->comp('/Elements/ScrubHTML', Content => $title);
+        $loc_title = loc($m->comp('/Elements/ScrubHTML', Content => $title));
     }
 
     if ( $AllowSorting and $col->{'attribute'}
@@ -134,11 +136,11 @@ foreach my $col ( @Format ) {
                 %$generic_query_args,
                 OrderBy => $attr, Order => $new_order
             ), 'h')
-            . '">'. loc($title) .'</a>'
+            . '">'. $loc_title .'</a>'
         );
     }
     else {
-        $m->out( loc($title) );
+        $m->out( $loc_title );
     }
     $m->out('</th>');
 }

-----------------------------------------------------------------------


More information about the rt-commit mailing list