[Rt-commit] rt branch 5.0/checkbox-cf-indeterminate-state created. rt-5.0.5-156-g589138d25c
BPS Git Server
git at git.bestpractical.com
Tue Feb 6 16:24:38 UTC 2024
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/checkbox-cf-indeterminate-state has been created
at 589138d25cbb115d66e0a0a63a76b9f53a4736b5 (commit)
- Log -----------------------------------------------------------------
commit 589138d25cbb115d66e0a0a63a76b9f53a4736b5
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Feb 6 10:52:59 2024 -0500
Support indeterminate state for boolean(checkbox) cfs
Both checked/unchecked states update boolean custom fields, so we need an
indeterminate state to do nothing for pages like bulk update page.
diff --git a/share/html/Elements/EditCustomFieldSelect b/share/html/Elements/EditCustomFieldSelect
index 8559c2ea4a..005c5c6819 100644
--- a/share/html/Elements/EditCustomFieldSelect
+++ b/share/html/Elements/EditCustomFieldSelect
@@ -87,7 +87,11 @@
<div class="custom-control custom-checkbox">
<input id="<% $name . '-Display' %>" type="checkbox" class="custom-control-input" data-checked-value="<% $TrueValue %>" data-unchecked-value="<% $FalseValue %>" value-target="#<% $name %>" <% $isChecked ? "checked" : "" %> />
<label class="custom-control-label" for="<% $name . '-Display' %>"></label>
- <input type="hidden" id="<% $name %>" name="<% $name %>" class="custom-control" value="<% $isChecked ? $TrueValue : $FalseValue %>" />
+ <input type="hidden" id="<% $name %>" name="<% $name %>" class="custom-control"
+% if ( !$ARGS{ShowEmptyOption} ) {
+ value="<% $isChecked ? $TrueValue : $FalseValue %>"
+% }
+ />
</div>
<script type="text/javascript">
var id = <% $name |n,j %>;
@@ -95,7 +99,12 @@
jQuery('#' + id + '-Display').change(function() {
var target = jQuery(this).attr('id').replace(/-Display$/, '').replace(/:/g,'\\:');
jQuery('#' + target).val(jQuery(this).is(':checked') ? jQuery(this).data('checked-value') : jQuery(this).data('unchecked-value'));
+ jQuery('#' + target).prop('disabled', false);
});
+%# Show indeterminate status for pages like bulk update to not update values by default.
+% if ( $ARGS{ShowEmptyOption} ) {
+ jQuery('#' + id + '-Display').prop ('indeterminate', true);
+% }
</script>
% } else {
% if (@category) {
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list