[Rt-commit] rt branch 4.4/cfv-order-by-category created. rt-4.4.5-23-ga7a9e51e5b
BPS Git Server
git at git.bestpractical.com
Wed Jan 26 16:51:24 UTC 2022
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 4.4/cfv-order-by-category has been created
at a7a9e51e5b5c6ca0a8844285a4a1849f41534c04 (commit)
- Log -----------------------------------------------------------------
commit a7a9e51e5b5c6ca0a8844285a4a1849f41534c04
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Jan 26 00:42:53 2022 +0800
Update tests for the default order change of custom field values
diff --git a/t/customfields/combo_cascade.t b/t/customfields/combo_cascade.t
index fba2fac868..4278bc8240 100644
--- a/t/customfields/combo_cascade.t
+++ b/t/customfields/combo_cascade.t
@@ -19,15 +19,15 @@ works($id,$msg);
sub add_works {
works(
- $cf->AddValue(Name => $_[0], Description => $_[0], Category => $_[1])
+ $cf->AddValue(Name => $_[0], Description => $_[0], Category => $_[1], SortOrder => $_[2])
);
};
-add_works('value1', '1. Category A');
-add_works('value2');
-add_works('value3', '1.1. A-sub one');
-add_works('value4', '1.2. A-sub two');
-add_works('value5', '');
+add_works('value1', '1. Category A', 1);
+add_works('value2', '', 2);
+add_works('value3', '1.1. A-sub one', 3);
+add_works('value4', '1.2. A-sub two', 4);
+add_works('value5', '', 5);
my $cfv = $cf->Values->First;
is($cfv->Category, '1. Category A');
commit e9fc3d72831b26405f52343e5c914757d76d911f
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Jan 25 21:28:01 2022 +0800
Group custom field values by category
Categories are shown as optgroup labels, previously the select input
could look like:
Bar
1 bar
Foo
1 foo
Bar
2 bar
Foo
2 foo
With this commit, the UI is like:
Bar
1 bar
2 bar
Foo
1 foo
2 foo
It's more compact and less confusing.
This change also gets around the limitation that current cascaded.js
doesn't support multiple optgroups sharing the same label(only the first
one is shown).
diff --git a/lib/RT/CustomFieldValues.pm b/lib/RT/CustomFieldValues.pm
index 73cee9e0d9..e1855f68e9 100644
--- a/lib/RT/CustomFieldValues.pm
+++ b/lib/RT/CustomFieldValues.pm
@@ -65,6 +65,9 @@ sub _Init {
{ ALIAS => 'main',
FIELD => 'SortOrder',
ORDER => 'ASC' },
+ { ALIAS => 'main',
+ FIELD => 'Category',
+ ORDER => 'ASC' },
{ ALIAS => 'main',
FIELD => 'Name',
ORDER => 'ASC' },
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list