[Rt-commit] rt branch 5.0/remove-cf-dropdown-render-type created. rt-5.0.4-179-g00ef6d423f
BPS Git Server
git at git.bestpractical.com
Tue Sep 5 15:57:36 UTC 2023
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, 5.0/remove-cf-dropdown-render-type has been created
at 00ef6d423f27546283ae42ca4e6b5e58886a2a91 (commit)
- Log -----------------------------------------------------------------
commit 00ef6d423f27546283ae42ca4e6b5e58886a2a91
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Sep 5 11:50:21 2023 -0400
Drop size attribute for cf selects
It has no effects since we use selectpicker for all select cfs.
diff --git a/share/html/Elements/EditCustomFieldSelect b/share/html/Elements/EditCustomFieldSelect
index 73c2ebdb98..bcf7bcd1a5 100644
--- a/share/html/Elements/EditCustomFieldSelect
+++ b/share/html/Elements/EditCustomFieldSelect
@@ -107,7 +107,6 @@
% $m->out($out);
</select>
% }
-% my $size = ($Rows && ( $Multiple || !@category || $RenderType eq 'Select box')) ? $Rows : 1;
<select
name="<%$name%>" id="<%$name%>"
@@ -120,9 +119,6 @@
% if ($CustomField->BasedOnObj->id) {
data-cascade-based-on-name="<% $BasedOnName || $NamePrefix . $CustomField->BasedOnObj->id . '-Value' |n %>"
% }
-% if ( $size > 1 ) {
- size="<% $Rows %>"
-% }
<% $Multiple && qq[multiple="multiple"] |n %> >
% if ( $show_empty_option ) {
<option value=""<% !$selected && qq[ selected="selected"] |n %>><&|/l&>(no value)</&></option>
@@ -183,7 +179,6 @@ $BasedOnName => undef
$Default => undef
$Values => undef
$Multiple => 0
-$Rows => undef
$HideCategory => 0
$RenderType => undef
$MaxValues => 1
commit 8757b18e2de8978726852f1e5e0200a2eecb613b
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Sep 5 11:29:10 2023 -0400
Remove Dropdown render type for select custom fields
Both "Dropdown" and "Select box" are rendered with selectpicker, as they
behave exactly in the same way, there is no need to keep both.
Default render types are saved as 0 or NULL, as the previous default
"Dropdown" has been removed, "Select box" becomes the new default render
type for single-value selects, which means the data in old db is still
correct, there is no need to update database.
diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
index 79c1f1f5a5..2b3617a428 100644
--- a/lib/RT/CustomField.pm
+++ b/lib/RT/CustomField.pm
@@ -85,7 +85,7 @@ our %FieldTypes = (
'Select box', # loc
'List', # loc
],
- single => [ 'Dropdown', # loc
+ single => [
'Select box', # loc
'List', # loc
'Checkbox', # loc
@@ -2419,8 +2419,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
(In the database, RenderType will be stored as a varchar(64).)
Only valid when C<Type> is "Select". Controls how the CF is displayed when
-editing it. Valid values are: C<Select box>, C<List>, C<Dropdown>, and
-C<Checkbox>.
+editing it. Valid values are: C<Select box>, C<List>, and C<Checkbox>.
C<List> is rendered as radio buttons when MaxValues is 1 (accepts one value)
or as checkboxes when MaxValues is 0 (accepts multiple values).
diff --git a/share/html/Elements/EditCustomFieldSelect b/share/html/Elements/EditCustomFieldSelect
index 9921e5e965..73c2ebdb98 100644
--- a/share/html/Elements/EditCustomFieldSelect
+++ b/share/html/Elements/EditCustomFieldSelect
@@ -133,10 +133,6 @@
<%init>
# Handle render types
$RenderType ||= $CustomField->RenderType;
-if ( $RenderType eq 'Dropdown' ) {
- # Turn it into a dropdown
- $Rows = 0;
-}
# Process scalar values for Default
if ( $Default and !@Default ){
diff --git a/t/api/cf_render_type.t b/t/api/cf_render_type.t
index b9681d006e..0769166975 100644
--- a/t/api/cf_render_type.t
+++ b/t/api/cf_render_type.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use RT::Test tests => 13;
+use RT::Test tests => undef;
my $cf = RT::CustomField->new($RT::SystemUser);
my ( $id, $ret, $msg );
@@ -15,10 +15,7 @@ diag "single select";
);
ok( $id, $msg );
-is( $cf->RenderType, 'Dropdown', 'default render type is Dropdown' );
-( $ret, $msg ) = $cf->SetRenderType('Select box');
-ok( $ret, 'changed to Select box' );
-is( $cf->RenderType, 'Select box', 'render type is indeed updated' );
+is( $cf->RenderType, 'Select box', 'default render type is Dropdown' );
( $ret, $msg ) = $cf->SetRenderType('List');
ok( $ret, 'changed to List' );
@@ -47,3 +44,4 @@ is( $cf->RenderType, 'List', 'render type is still List' );
ok( $ret, 'changed to Select box' );
is( $cf->RenderType, 'Select box', 'render type is indeed updated' );
+done_testing;
diff --git a/t/data/initialdata/initialdata.json b/t/data/initialdata/initialdata.json
index 027627a64e..6b700cb5f3 100644
--- a/t/data/initialdata/initialdata.json
+++ b/t/data/initialdata/initialdata.json
@@ -73,7 +73,7 @@
"Name":"Favorite Song",
"Type":"SelectSingle",
"LookupType":"RT::Queue-RT::Ticket",
- "RenderType":"Dropdown",
+ "RenderType":"Select box",
"Values":[
{"Name":"Never Gonna Give You Up - Rick Astley","Description":"Best Song Ever","SortOrder":1},
{"Name":"Nyan Cat","Description":"12 Hours Continuous","SortOrder":2}
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list