[Rt-commit] rt branch, 5.0-trunk, updated. rt-5.0.0-67-g5e39893dd1

? sunnavy sunnavy at bestpractical.com
Fri Oct 30 15:18:11 EDT 2020


The branch, 5.0-trunk has been updated
       via  5e39893dd1e44116583a43d09faf91bfcba02db1 (commit)
       via  4cf001407568d6f4a6f2718ae1c446dd9d251530 (commit)
      from  b4711a59cbff17214171ecbd4303763691e23397 (commit)

Summary of changes:
 share/html/Elements/ColumnMap                | 9 +++++++++
 share/html/Search/Elements/BuildFormatString | 3 +++
 share/html/Search/Elements/EditSort          | 2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

- Log -----------------------------------------------------------------
commit 4cf001407568d6f4a6f2718ae1c446dd9d251530
Author: Dianne Skoll <dianne at bestpractical.com>
Date:   Mon Oct 5 09:18:30 2020 -0400

    Add "CustomFieldView" column type for view-only (non-editable) custom fields.
    
    The idea here is to allow inline editing, but have the ability to turn off
    inline editing on a per-custom-field basis for search results.  This will
    eliminate slowness for custom fields whose "edit" rendering is expensive
    to compute while still permitting inline editing.

diff --git a/share/html/Elements/ColumnMap b/share/html/Elements/ColumnMap
index 17a39a0ec5..1deadaa4ff 100644
--- a/share/html/Elements/ColumnMap
+++ b/share/html/Elements/ColumnMap
@@ -255,6 +255,15 @@ $WCOLUMN_MAP = $COLUMN_MAP = {
 
 $COLUMN_MAP->{'CF'} = $COLUMN_MAP->{'CustomField'};
 
+# Add a CustomFieldView column for custom fields, but with editing disabled
+$COLUMN_MAP->{'CustomFieldView'} = {};
+
+# We copy all keys from CF to CustomFieldView except for "edit"
+foreach my $key ( keys( %{ $COLUMN_MAP->{'CF'} } ) ) {
+    next if $key eq 'edit';
+    $COLUMN_MAP->{'CustomFieldView'}->{$key} = $COLUMN_MAP->{'CF'}->{$key};
+}
+
 Scalar::Util::weaken($WCOLUMN_MAP);
 
 my $ROLE_MAP = {};
diff --git a/share/html/Search/Elements/BuildFormatString b/share/html/Search/Elements/BuildFormatString
index 5e32941657..406ef9f791 100644
--- a/share/html/Search/Elements/BuildFormatString
+++ b/share/html/Search/Elements/BuildFormatString
@@ -106,6 +106,7 @@ if ( $Class eq 'RT::Transactions' ) {
 
     while ( my $CustomField = $CustomFields->Next ) {
         push @fields, "CustomField.{" . $CustomField->Name . "}";
+        push @fields, "CustomFieldView.{" . $CustomField->Name . "}";
     }
 }
 elsif ( $Class eq 'RT::Assets' ) {
@@ -140,6 +141,7 @@ elsif ( $Class eq 'RT::Assets' ) {
     $CustomFields->LimitToCatalog(0);
     while ( my $CustomField = $CustomFields->Next ) {
         push @fields, "CustomField.{" . $CustomField->Name . "}";
+        push @fields, "CustomFieldView.{" . $CustomField->Name . "}";
     }
 
 }
@@ -197,6 +199,7 @@ else {
 
     while ( my $CustomField = $CustomFields->Next ) {
         push @fields, "CustomField.{" . $CustomField->Name . "}";
+        push @fields, "CustomFieldView.{" . $CustomField->Name . "}";
     }
 
     my $CustomRoles = RT::CustomRoles->new( $session{'CurrentUser'} );
diff --git a/share/html/Search/Elements/EditSort b/share/html/Search/Elements/EditSort
index c4d9b2080c..e7bc7c8f53 100644
--- a/share/html/Search/Elements/EditSort
+++ b/share/html/Search/Elements/EditSort
@@ -120,7 +120,7 @@ elsif ( $Class eq 'RT::Assets' ) {
 }
 
 # Add all available CustomFields to the list of sortable columns.
-my @cfs = grep /^CustomField/, @{$ARGS{AvailableColumns}};
+my @cfs = grep /^CustomField(?!View)/, @{$ARGS{AvailableColumns}};
 $fields{$_} = $_ for @cfs;
 
 # Add all available CustomRoles to the list of sortable columns.

commit 5e39893dd1e44116583a43d09faf91bfcba02db1
Merge: b4711a59cb 4cf0014075
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Oct 31 02:26:26 2020 +0800

    Merge branch '5.0/add-viewonly-custom-field-column' into 5.0-trunk


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


More information about the rt-commit mailing list