Skip to content

Commit ff815a8

Browse files
committed
Merge branch '6.0/cf-widget-layout' into 6.0-trunk
2 parents 410cc5e + eb01560 commit ff815a8

16 files changed

Lines changed: 170 additions & 47 deletions

File tree

etc/RT_Config.pm.in

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2481,7 +2481,7 @@ E.g.
24812481
Title => 'Ticket metadata', # loc
24822482
Layout => 'col-4',
24832483
Elements => [
2484-
[ 'Basics', 'CustomFieldCustomGroupings' ],
2484+
[ 'Basics', { Name => 'CustomFieldCustomGroupings' } ],
24852485
[ 'Dates', 'LinkedQueues', 'Links' ],
24862486
['Attachments'],
24872487
],
@@ -2507,7 +2507,7 @@ E.g.
25072507
Title => 'Ticket metadata', # loc
25082508
Layout => 'col-lg-4 col-md-6, col-lg-8 col-md-6',
25092509
Elements => [
2510-
[ 'Basics', 'CustomFieldCustomGroupings:Specs' ], # Show Specs custom field grouping
2510+
[ 'Basics', { Name => 'CustomFieldCustomGroupings', Groupings => 'Specs', ColumnWidth => 'sm' } ], # Narrow columns for Specs grouping
25112511
[ 'People', 'Dates', 'Links' ],
25122512
],
25132513
},
@@ -2522,7 +2522,7 @@ E.g.
25222522
Layout => 'col-md-6',
25232523
Title => 'Ticket metadata', # loc
25242524
Elements => [
2525-
[ 'Basics', 'CustomFieldCustomGroupings', 'People', 'Attachments', 'Requestors' ],
2525+
[ 'Basics', { Name => 'CustomFieldCustomGroupings' }, 'People', 'Attachments', 'Requestors' ],
25262526
[ 'Reminders', 'Articles', 'Dates', 'LinkedQueues', 'Assets', 'Links' ],
25272527
],
25282528
},
@@ -2538,7 +2538,7 @@ E.g.
25382538
Layout => 'col-md-7,col-md-5',
25392539
Elements => [
25402540
[ 'Message', 'Submit' ],
2541-
[ 'Basics', 'Assets', 'CustomFieldCustomGroupings', 'Dates', 'Links' ],
2541+
[ 'Basics', 'Assets', { Name => 'CustomFieldCustomGroupings' }, 'Dates', 'Links' ],
25422542
],
25432543
},
25442544
],
@@ -2557,7 +2557,7 @@ E.g.
25572557
Layout => 'col-md-6',
25582558
Title => 'Ticket metadata', # loc
25592559
Elements => [
2560-
[ 'Basics', 'CustomFieldCustomGroupings' ],
2560+
[ 'Basics', { Name => 'CustomFieldCustomGroupings' } ],
25612561
[ 'Dates', 'Assets', ],
25622562
],
25632563
},
@@ -2591,7 +2591,7 @@ E.g.
25912591
Title => 'Asset metadata', # loc
25922592
Layout => 'col-6',
25932593
Elements => [
2594-
[ 'Basics', 'Dates', 'CustomFieldCustomGroupings' ],
2594+
[ 'Basics', 'Dates', { Name => 'CustomFieldCustomGroupings' } ],
25952595
[ 'People', 'Links' ],
25962596
],
25972597
},
@@ -2607,7 +2607,7 @@ E.g.
26072607
Layout => 'col-4',
26082608
Elements => [
26092609
[ 'Basics', 'Links' ],
2610-
[ 'People', 'CustomFieldCustomGroupings' ],
2610+
[ 'People', { Name => 'CustomFieldCustomGroupings' } ],
26112611
[ 'Dates' ],
26122612
],
26132613
},
@@ -2622,7 +2622,7 @@ E.g.
26222622
{
26232623
Layout => 'col-6',
26242624
Elements => [
2625-
[ 'Basics', 'CustomFieldCustomGroupings' ],
2625+
[ 'Basics', { Name => 'CustomFieldCustomGroupings' } ],
26262626
[ 'People', 'Links', 'Submit' ]
26272627
],
26282628
},
@@ -2634,7 +2634,7 @@ E.g.
26342634
Layout => 'col-md-4',
26352635
Elements => [
26362636
[ 'Basics', 'Links' ],
2637-
[ 'People', 'CustomFieldCustomGroupings' ],
2637+
[ 'People', { Name => 'CustomFieldCustomGroupings' } ],
26382638
[ 'Dates' ],
26392639
],
26402640
},
@@ -2654,7 +2654,7 @@ Set(
26542654
Layout => 'col-md-6',
26552655
Title => 'Ticket metadata', # loc
26562656
Elements => [
2657-
[ 'Basics', 'Times', 'CustomFieldCustomGroupings', 'People', 'Attachments', 'Requestors' ],
2657+
[ 'Basics', 'Times', { Name => 'CustomFieldCustomGroupings' }, 'People', 'Attachments', 'Requestors' ],
26582658
[ 'Reminders', 'Articles', 'Dates', 'LinkedQueues', 'Assets', 'Links' ],
26592659
],
26602660
},
@@ -2670,15 +2670,15 @@ Set(
26702670
Layout => 'col-md-7,col-md-5',
26712671
Elements => [
26722672
[ 'Message', 'Submit' ],
2673-
[ 'Basics', 'Assets', 'CustomFieldCustomGroupings', 'Times', 'Dates', 'Links' ],
2673+
[ 'Basics', 'Assets', { Name => 'CustomFieldCustomGroupings' }, 'Times', 'Dates', 'Links' ],
26742674
],
26752675
},
26762676
],
26772677
'One Column' => [
26782678
{
26792679
Layout => 'col-12',
26802680
Elements => [
2681-
[ 'Basics', 'Times', 'Assets', 'CustomFieldCustomGroupings', 'Message', 'Dates', 'Links', 'Submit' ],
2681+
[ 'Basics', 'Times', 'Assets', { Name => 'CustomFieldCustomGroupings' }, 'Message', 'Dates', 'Links', 'Submit' ],
26822682
],
26832683
},
26842684
],
@@ -2703,7 +2703,7 @@ Set(
27032703
Layout => 'col-md-6',
27042704
Title => 'Ticket metadata', # loc
27052705
Elements => [
2706-
[ 'Basics', 'CustomFieldCustomGroupings' ],
2706+
[ 'Basics', { Name => 'CustomFieldCustomGroupings' } ],
27072707
[ 'Dates', 'Assets', ],
27082708
],
27092709
},
@@ -2738,7 +2738,7 @@ Set(
27382738
Layout => 'col-md-4',
27392739
Elements => [
27402740
[ 'Basics', 'Links' ],
2741-
[ 'People', 'CustomFieldCustomGroupings' ],
2741+
[ 'People', { Name => 'CustomFieldCustomGroupings' } ],
27422742
[ 'Dates' ],
27432743
],
27442744
},
@@ -2753,7 +2753,7 @@ Set(
27532753
{
27542754
Layout => 'col-md-6',
27552755
Elements => [
2756-
[ 'Basics', 'CustomFieldCustomGroupings' ],
2756+
[ 'Basics', { Name => 'CustomFieldCustomGroupings' } ],
27572757
[ 'People', 'Links', 'Submit' ],
27582758
],
27592759
},
@@ -2765,7 +2765,7 @@ Set(
27652765
Layout => 'col-md-4',
27662766
Elements => [
27672767
[ 'Basics', 'Links' ],
2768-
[ 'People', 'CustomFieldCustomGroupings' ],
2768+
[ 'People', { Name => 'CustomFieldCustomGroupings' } ],
27692769
[ 'Dates' ],
27702770
],
27712771
},

share/html/Asset/Widgets/Create/CustomFieldCustomGroupings

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@
5353
KeepValue => 1,
5454
CustomFieldGenerator => sub { $CatalogObj->AssetCustomFields },
5555
ForCreation => 1,
56-
$ARGS{Argument} ? ( Groupings => [ map { $_ eq 'Default' ? '' : $_ } split /\s*,\s*/, $ARGS{Argument} ] ) : (),
56+
# Groupings: hash format key; Argument: legacy "Name:value" string format
57+
( $ARGS{Groupings} // $ARGS{Argument} ) ? ( Groupings => [ map { $_ eq 'Default' ? '' : $_ } split /\s*,\s*/, ( $ARGS{Groupings} // $ARGS{Argument} ) ] ) : (),
58+
$ARGS{ColumnWidth} ? ( ColumnWidth => $ARGS{ColumnWidth} ) : (),
5759
&>
5860

5961
% $m->callback( %ARGS, CallbackName => 'AfterWidget' );

share/html/Asset/Widgets/Display/CustomFieldCustomGroupings

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
Object => $AssetObj,
5252
title_href => ( $can_modify || $can_modify_cf ) ? RT->Config->Get('WebPath') . "/Asset/Modify.html" : "",
5353
InlineEdit => ( $can_modify || $can_modify_cf ) ? RT->Config->Get( 'InlineEdit', $session{CurrentUser} ) : 0,
54-
$ARGS{Argument} ? ( Groupings => [ map { $_ eq 'Default' ? '' : $_ } split /\s*,\s*/, $ARGS{Argument} ] ) : (),
54+
# Groupings: hash format key; Argument: legacy "Name:value" string format
55+
( $ARGS{Groupings} // $ARGS{Argument} ) ? ( Groupings => [ map { $_ eq 'Default' ? '' : $_ } split /\s*,\s*/, ( $ARGS{Groupings} // $ARGS{Argument} ) ] ) : (),
56+
$ARGS{ColumnWidth} ? ( ColumnWidth => $ARGS{ColumnWidth} ) : (),
5557
ActionURL => RT->Config->Get('WebPath') . '/Helpers/AssetUpdate',
5658
&>
5759

share/html/Elements/EditPageLayout

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,9 @@ $Content => []
381381
% if ( ref $Widget && $Widget->{tooltip} ) {
382382
<% GetSVGImage( Name => 'info', Title => $Widget->{tooltip} ) |n %>
383383
% } elsif ( $widget_name =~ /^CustomFieldCustomGroupings\b/ ) {
384-
<% GetSVGImage( Name => 'info', $Widget =~ /.*:(.+)/ ? ( Title => $1 ) : ( Title => ' ', ExtraClasses => 'hidden' ) ) |n %>
384+
% # Support legacy "Name:Groupings" string format and current hash format
385+
% my $grouping_text = ref $Widget ? $Widget->{Groupings} : ($Widget =~ /.*:(.+)/ ? $1 : undef);
386+
<% GetSVGImage( Name => 'info', $grouping_text ? ( Title => $grouping_text ) : ( Title => ' ', ExtraClasses => 'hidden' ) ) |n %>
385387
<a href="#" class="edit" data-bs-toggle="modal" data-bs-target="#pagelayout-widget-<% $Index %>-modal">
386388
<% GetSVGImage( Name => 'pencil', Title => loc('Edit') ) |n %></a>
387389
% } elsif ( ( $widget_name eq 'History' && $Page !~ /^SelfService / ) || ( $Class eq 'RT::Ticket' && ( $widget_name =~ /^(?:People|Basics)$/ || ( $Page eq 'Create' && $widget_name eq 'Message' ) ) ) ) {
@@ -443,6 +445,22 @@ $Page => undef
443445
% }
444446
</select>
445447
</&>
448+
<& /Widgets/Form/Select,
449+
Name => 'ColumnWidth',
450+
Description => loc('Column Width'),
451+
Tooltip => loc('Minimum width for each column in the multi-column layout'),
452+
CurrentValue => ( ref $Widget && $Widget->{ColumnWidth} ) // '',
453+
DefaultLabel => loc('Medium (default)'),
454+
Values => [qw(xs sm lg xl)],
455+
ValuesLabel => {
456+
xs => loc('Extra narrow'),
457+
sm => loc('Narrow'),
458+
lg => loc('Wide'),
459+
xl => loc('Extra wide'),
460+
},
461+
LabeledValue => 1,
462+
defined $Index ? () : ( InputClass => 'form-select' ),
463+
&>
446464
</div>
447465
<div class="modal-footer">
448466
<& /Elements/Submit, Label => loc('Update') &>
@@ -453,8 +471,10 @@ $Page => undef
453471
</div>
454472
<%INIT>
455473
my %selected;
456-
if ( $Widget =~ /^CustomFieldCustomGroupings\b:(.+)/ ) {
457-
%selected = map { $_ => 1 } split /\s*,\s*/, $1 // ();
474+
# Support legacy "Name:Groupings" string format and current hash format
475+
my $groupings = ref $Widget ? $Widget->{Groupings} : ($Widget =~ /^CustomFieldCustomGroupings\b:(.+)/ ? $1 : undef);
476+
if ( $groupings ) {
477+
%selected = map { $_ => 1 } split /\s*,\s*/, $groupings;
458478
}
459479
</%INIT>
460480
<%ARGS>

share/html/Elements/ShowCustomFieldCustomGroupings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ for my $group ( @Groupings ) {
9494

9595
<&| /Widgets/TitleBox, %grouping_args &>
9696
% unless ($modify_behavior eq 'always') {
97-
<div class="inline-edit-display show-custom-fields-container" hx-trigger="none" hx-get="<% RT->Config->Get('WebPath') %>/Views/Component/ShowCustomFields?ObjectType=<% ref $Object %>&ObjectId=<% $Object->Id %>&Grouping=<% $group %>">
97+
<div class="inline-edit-display show-custom-fields-container" hx-trigger="none" hx-get="<% RT->Config->Get('WebPath') %>/Views/Component/ShowCustomFields?ObjectType=<% ref $Object %>&ObjectId=<% $Object->Id %>&Grouping=<% $group %><% $ARGS{ColumnWidth} ? "&ColumnWidth=$ARGS{ColumnWidth}" : '' %>">
9898
<& ShowCustomFields, %ARGS, Object => $Object, Grouping => $group &>
9999
</div>
100100
% }

share/html/Elements/ShowCustomFields

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
% $m->callback( CallbackName => 'BeforeCustomFields', Object => $Object,
4949
% Grouping => $Grouping, ARGSRef => \%ARGS, CustomFields => $CustomFields, Table => $Table );
5050
% if ($Table) {
51-
<div>
51+
<div class="show-custom-fields<% $ColumnWidth ? " cf-columns-$ColumnWidth" : '' %>">
5252
% }
5353
% while ( my $CustomField = $CustomFields->Next ) {
5454
<%perl>
@@ -168,6 +168,7 @@ $CustomFields => $Object->CustomFields
168168
$Grouping => undef
169169
$Table => 1
170170
$HideEmpty => 0
171+
$ColumnWidth => undef
171172
$LabelCols => 3
172173
$ValueCols => 9
173174
</%ARGS>

share/html/SelfService/Asset/Widgets/Display/CustomFieldCustomGroupings

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
<& /Elements/ShowCustomFieldCustomGroupings,
5151
Object => $AssetObj,
5252
InlineEdit => 0,
53-
$ARGS{Argument} ? ( Groupings => [ map { $_ eq 'Default' ? '' : $_ } split /\s*,\s*/, $ARGS{Argument} ] ) : (),
53+
# Groupings: hash format key; Argument: legacy "Name:value" string format
54+
( $ARGS{Groupings} // $ARGS{Argument} ) ? ( Groupings => [ map { $_ eq 'Default' ? '' : $_ } split /\s*,\s*/, ( $ARGS{Groupings} // $ARGS{Argument} ) ] ) : (),
55+
$ARGS{ColumnWidth} ? ( ColumnWidth => $ARGS{ColumnWidth} ) : (),
5456
&>
5557

5658
% $m->callback( %ARGS, CallbackName => 'AfterWidget' );

share/html/SelfService/Ticket/Widgets/Display/CustomFieldCustomGroupings

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
<& /Elements/ShowCustomFieldCustomGroupings,
5151
Object => $TicketObj,
5252
InlineEdit => 0,
53-
$ARGS{Argument} ? ( Groupings => [ map { $_ eq 'Default' ? '' : $_ } split /\s*,\s*/, $ARGS{Argument} ] ) : (),
53+
# Groupings: hash format key; Argument: legacy "Name:value" string format
54+
( $ARGS{Groupings} // $ARGS{Argument} ) ? ( Groupings => [ map { $_ eq 'Default' ? '' : $_ } split /\s*,\s*/, ( $ARGS{Groupings} // $ARGS{Argument} ) ] ) : (),
55+
$ARGS{ColumnWidth} ? ( ColumnWidth => $ARGS{ColumnWidth} ) : (),
5456
&>
5557

5658
% $m->callback( %ARGS, CallbackName => 'AfterWidget' );

share/html/Ticket/Widgets/Create/CustomFieldCustomGroupings

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@
5353
CategoryObj => $QueueObj,
5454
CustomFieldGenerator => sub { $QueueObj->TicketCustomFields },
5555
ForCreation => 1,
56-
$ARGS{Argument} ? ( Groupings => [ map { $_ eq 'Default' ? '' : $_ } split /\s*,\s*/, $ARGS{Argument} ] ) : (),
56+
# Groupings: hash format key; Argument: legacy "Name:value" string format
57+
( $ARGS{Groupings} // $ARGS{Argument} ) ? ( Groupings => [ map { $_ eq 'Default' ? '' : $_ } split /\s*,\s*/, ( $ARGS{Groupings} // $ARGS{Argument} ) ] ) : (),
58+
$ARGS{ColumnWidth} ? ( ColumnWidth => $ARGS{ColumnWidth} ) : (),
5759
&>
5860

5961
% $m->callback( %ARGS, CallbackName => 'AfterWidget' );

share/html/Ticket/Widgets/Display/CustomFieldCustomGroupings

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
<& /Elements/ShowCustomFieldCustomGroupings,
5151
Object => $TicketObj,
5252
InlineEdit => ( $can_modify || $can_modify_cf ) ? RT->Config->Get( 'InlineEdit', $session{CurrentUser} ) : 0,
53-
$ARGS{Argument} ? ( Groupings => [ map { $_ eq 'Default' ? '' : $_ } split /\s*,\s*/, $ARGS{Argument} ] ) : (),
53+
# Groupings: hash format key; Argument: legacy "Name:value" string format
54+
( $ARGS{Groupings} // $ARGS{Argument} ) ? ( Groupings => [ map { $_ eq 'Default' ? '' : $_ } split /\s*,\s*/, ( $ARGS{Groupings} // $ARGS{Argument} ) ] ) : (),
55+
$ARGS{ColumnWidth} ? ( ColumnWidth => $ARGS{ColumnWidth} ) : (),
5456
&>
5557

5658
% $m->callback( %ARGS, CallbackName => 'AfterWidget' );

0 commit comments

Comments
 (0)