[Bps-public-commit] rt-extension-formtools branch dynamic-forms-from-config updated. 0.53-48-gc5dbf54
BPS Git Server
git at git.bestpractical.com
Wed Oct 11 22:26:49 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-extension-formtools".
The branch, dynamic-forms-from-config has been updated
via c5dbf54e18b8e5c8dd845d5252018091ab0e34cb (commit)
via 863cec90d45c0b691a8dad6fc159ea022e32833e (commit)
from ca165b2f231ead2a88b2ae5862463807cc163ad8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c5dbf54e18b8e5c8dd845d5252018091ab0e34cb
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Oct 11 17:36:54 2023 -0400
Make sure orders are sorted on page create
The sort order of the new page depends on the second to last item.
diff --git a/html/Admin/FormTools/Modify.html b/html/Admin/FormTools/Modify.html
index 7015b90..daf4440 100644
--- a/html/Admin/FormTools/Modify.html
+++ b/html/Admin/FormTools/Modify.html
@@ -418,7 +418,7 @@ if ( $AddPage ) {
Abort( loc('Permission Denied') )
unless $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'SuperUser' );
- my @orders = map { $form->{'formtools-pages'}{$_}{sort_order} } keys %{$form->{'formtools-pages'}};
+ my @orders = sort { $a <=> $b } map { $form->{'formtools-pages'}{$_}{sort_order} } keys %{$form->{'formtools-pages'}};
my $new_page = RT::Extension::FormTools->GeneratePageId($form);
$form->{'formtools-pages'}{$new_page} = {
commit 863cec90d45c0b691a8dad6fc159ea022e32833e
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Oct 11 17:23:17 2023 -0400
Add tooltip support to core and custom fields
diff --git a/html/Admin/FormTools/Modify.html b/html/Admin/FormTools/Modify.html
index d242379..7015b90 100644
--- a/html/Admin/FormTools/Modify.html
+++ b/html/Admin/FormTools/Modify.html
@@ -85,6 +85,9 @@
<&| /Elements/LabeledValue, Label => loc('Default Value') &>
<input name="default" type="text" class="form-control" placeholder="<% $default_values{$item} %>" value="" />
</&>
+ <&| /Elements/LabeledValue, Label => loc('Tooltip') &>
+ <input name="tooltip" type="text" class="form-control" value="" />
+ </&>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary button form-control"><% loc('Save') %></button>
@@ -126,6 +129,9 @@
<&| /Elements/LabeledValue, Label => loc('Default Value') &>
<input name="default" type="text" class="form-control" placeholder="<% $default_values{$item} %>" value="" />
</&>
+ <&| /Elements/LabeledValue, Label => loc('Tooltip') &>
+ <input name="tooltip" type="text" class="form-control" placeholder="<% $tooltips{$item} // '' %>" value="" />
+ </&>
<&| /Elements/LabeledValue, Label => '' &>
<div class="custom-control custom-checkbox">
<input class="custom-control-input" id="<% CSSClass($item) %>-validation" type="checkbox" name="show_validation" value="1" checked="checked" />
@@ -328,6 +334,10 @@
<&| /Elements/LabeledValue, Label => loc('Default Value') &>
<input name="default" type="text" class="form-control" placeholder="<% $default_values{$item->{arguments}{name}} %>" value="<% $item->{arguments}{default} // '' %>" />
</&>
+
+ <&| /Elements/LabeledValue, Label => loc('Tooltip') &>
+ <input name="tooltip" type="text" class="form-control" placeholder="<% $tooltips{$item->{arguments}{name}} // '' %>" value="<% $item->{arguments}{tooltip} // '' %>" />
+ </&>
% if ( !RT::Extension::FormTools::is_core_field($item->{arguments}{name}) ) {
<&| /Elements/LabeledValue, Label => '' &>
<div class="custom-control custom-checkbox">
@@ -493,6 +503,7 @@ $queue->Load($form->{queue});
my $cfs = $queue->TicketCustomFields;
my @custom_fields;
my %default_values;
+my %tooltips;
while ( my $cf = $cfs->Next ) {
push @custom_fields, $cf->Name;
@@ -501,6 +512,7 @@ while ( my $cf = $cfs->Next ) {
$default_values{$cf->Name} = ref $default_values eq 'ARRAY' ? join(', ', @$default_values) : $default_values;
}
}
+ $tooltips{$cf->Name} = $cf->EntryHint // '';
}
my %other_components = (
diff --git a/html/FormTools/Field b/html/FormTools/Field
index 2699834..f7694be 100644
--- a/html/FormTools/Field
+++ b/html/FormTools/Field
@@ -1,6 +1,7 @@
<%args>
$name
$label => undef
+$tooltip => undef
$item_labels => {}
$render_as => 'normal'
$default => undef
@@ -59,6 +60,7 @@ if ( RT::Extension::FormTools::is_core_field($name) ) {
$m->notes( cfs_on_page => [ @{$m->notes('cfs_on_page')||[]}, $cf->id ] );
$field_label ||= $cf->Name;
+ $tooltip ||= $cf->EntryHint;
if ($ticket) {
@values = map { $_->Content } @{ $cf->ValuesForObject($ticket)->ItemsArrayRef };
@@ -125,7 +127,7 @@ $default = '' unless defined $default;
% if ($render_as ne 'hidden' && $show_label) { # no label if hidden
-<&| /Elements/LabeledValue, RawLabel => $m->interp->apply_escapes($field_label, 'h') . $after_label &>
+<&| /Elements/LabeledValue, RawLabel => $m->interp->apply_escapes($field_label, 'h') . $after_label, LabelTooltip => $tooltip &>
<& SELF:Value, %ARGS, input_name => $input_name, field_type => $field_type, default => $default, values => \@values, cf => $cf &>
<% $after_input |n %>
</&>
diff --git a/static/js/rt-extension-formtools.js b/static/js/rt-extension-formtools.js
index 8e9644c..3b0fa87 100644
--- a/static/js/rt-extension-formtools.js
+++ b/static/js/rt-extension-formtools.js
@@ -111,6 +111,15 @@ formTools = {
delete value.arguments.default;
}
+ const tooltip = form.find(':input[name=tooltip]').val();
+
+ if ( tooltip.length ) {
+ value.arguments.tooltip = tooltip;
+ }
+ else {
+ delete value.arguments.tooltip;
+ }
+
const validation = form.find(':input[name=show_validation]');
if ( validation.length ) {
if ( validation.is(':checked') ) {
-----------------------------------------------------------------------
Summary of changes:
html/Admin/FormTools/Modify.html | 14 +++++++++++++-
html/FormTools/Field | 4 +++-
static/js/rt-extension-formtools.js | 9 +++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
hooks/post-receive
--
rt-extension-formtools
More information about the Bps-public-commit
mailing list