[Bps-public-commit] rt-extension-formtools branch dynamic-forms-from-config updated. 0.53-82-g487eba6
BPS Git Server
git at git.bestpractical.com
Tue Oct 31 18:38:01 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 487eba6b63c0ce300e0fab8328dcbe1128d378e7 (commit)
via c1fcb3459be344e521c52c0736ccf2754812fdc4 (commit)
via 49322225c0ac57d659b64eb48843bf53f799083f (commit)
via 2c1f2d6b3eab05129d9e95d4d0f087b1bf62efbf (commit)
via 25f8a41d340c4679e67b23ef101c29e7e8b57fbc (commit)
from 46a90dbd31df32ee385a3e66af91e6c888b0b58c (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 487eba6b63c0ce300e0fab8328dcbe1128d378e7
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Oct 31 14:34:38 2023 -0400
Add search support to source list
This is a simplified version of RT core selectionbox's search feature.
diff --git a/html/Admin/FormTools/Modify.html b/html/Admin/FormTools/Modify.html
index ea53511..3593552 100644
--- a/html/Admin/FormTools/Modify.html
+++ b/html/Admin/FormTools/Modify.html
@@ -6,6 +6,13 @@
<div class="row">
<div class="formtools-component-menu boxcontainer col-md-3" id="formtools-component-wrapper">
<&| /Widgets/TitleBox, title => loc('FormTools Components') &>
+ <div class="filters">
+ <div class="form-row">
+ <div class="col-12">
+ <input type="search" class="m-1 field form-control" name="search" placeholder="<&|/l&>Search...</&>" autocomplete="off">
+ </div>
+ </div>
+ </div>
<div class="d-block text-center">
% foreach my $item ( @html_components ) {
<div id="formtools-element-<% $item %>" class="formtools-element" draggable="true" ondragstart="formTools.dragstart(event);" ondragend="formTools.dragend(event);" data-value="<% JSON({ type => 'raw_html', html => "<$item>test</$item>"}) %>">
@@ -401,6 +408,7 @@ jQuery(function() {
jQuery('.formtools-element-form').on('submit', formTools.elementSubmit);
jQuery('.formtools-page-form').on('submit', formTools.pageSubmit);
jQuery('.formtools-delete-page').on('click', formTools.deletePage);
+ jQuery('.formtools-component-menu input[name=search]').on('propertychange change keyup paste input', formTools.refreshSource);
});
</script>
<%INIT>
diff --git a/static/js/rt-extension-formtools.js b/static/js/rt-extension-formtools.js
index 2e3ef2d..9ab0605 100644
--- a/static/js/rt-extension-formtools.js
+++ b/static/js/rt-extension-formtools.js
@@ -198,5 +198,26 @@ formTools = {
tab.remove();
});
return false;
+ },
+
+ refreshSource: function () {
+ var searchTerm = jQuery(this).val().toLowerCase();
+ if ( searchTerm.length ) {
+ // Hide the separator on search, considering some sections might not have any matched items.
+ jQuery('.formtools-component-menu').find('hr').hide();
+ jQuery('.formtools-component-menu').find('.formtools-element').each(function () {
+ var item = jQuery(this);
+ if (item.find('span.content').text().toLowerCase().indexOf(searchTerm) > -1) {
+ item.show();
+ }
+ else {
+ item.hide();
+ }
+ });
+ }
+ else {
+ jQuery('.formtools-component-menu').find('hr').show();
+ jQuery('.formtools-component-menu').find('.formtools-element').show();
+ }
}
};
commit c1fcb3459be344e521c52c0736ccf2754812fdc4
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Oct 31 14:33:17 2023 -0400
Wrap name to span.content for core and custom fields
This is consistent with HTML items, and then we can filter the source
list with span.content text.
diff --git a/html/Admin/FormTools/Modify.html b/html/Admin/FormTools/Modify.html
index 5150912..ea53511 100644
--- a/html/Admin/FormTools/Modify.html
+++ b/html/Admin/FormTools/Modify.html
@@ -60,7 +60,7 @@
<p class="formtools-element-placeholder m-1 p-2 border rounded"><% loc('Place here') %></p>
<p class="m-1 p-2 border rounded">
<span class="badge badge-primary"><% loc('Custom Field') %></span>
- <% $item %> <span class="label"></span>
+ <span class="content"><% $item %> <span class="label"></span></span>
<a href="#" class="edit" data-toggle="modal" data-target="#formtools-element-modal">
<span class="fas fa-pencil-alt" alt="<% loc('Edit') %>" data-toggle="tooltip" data-placement="top" data-original-title="<% loc('Edit') %>"></span>
</a>
@@ -104,7 +104,7 @@
<p class="formtools-element-placeholder m-1 p-2 border rounded"><% loc('Place here') %></p>
<p class="m-1 p-2 border rounded">
<span class="badge badge-primary"><% loc('Custom Field') %></span>
- <% $item %> <span class="label"></span>
+ <span class="content"><% $item %> <span class="label"></span></span>
<a href="#" class="edit" data-toggle="modal" data-target="#formtools-element-modal">
<span class="fas fa-pencil-alt" alt="<% loc('Edit') %>" data-toggle="tooltip" data-placement="top" data-original-title="<% loc('Edit') %>"></span>
</a>
commit 49322225c0ac57d659b64eb48843bf53f799083f
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Oct 31 10:52:30 2023 -0400
Sync page name and tab text on name update
diff --git a/html/Admin/FormTools/Modify.html b/html/Admin/FormTools/Modify.html
index a52db1e..5150912 100644
--- a/html/Admin/FormTools/Modify.html
+++ b/html/Admin/FormTools/Modify.html
@@ -221,10 +221,10 @@
<div class="tab-content">
% foreach my $page_name (@form_pages) {
<div id="formtools-content-<% $form_page_id{$page_name} %>" class="tab-pane <% $form_page_id{$page_name} eq $active_context->{tab} ? 'show active' : 'fade' %>" role="tabpanel">
- <div class="modal fade formtools-element-modal" id="formtools-element-<% $form_page_id{$page_name} %>-basics-modal" tabindex="-1" role="dialog">
+ <div class="modal fade formtools-page-modal" id="formtools-element-<% $form_page_id{$page_name} %>-basics-modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
- <form class="formtools-element-form">
+ <form class="formtools-page-form">
<div class="modal-header">
<h5 class="modal-title"><% loc('Modify Basics') %></h5>
<a href="javascript:void(0)" class="close" data-dismiss="modal" aria-label="Close">
@@ -399,6 +399,7 @@
jQuery(function() {
jQuery('#formtools-form-modify').on('submit', formTools.submit);
jQuery('.formtools-element-form').on('submit', formTools.elementSubmit);
+ jQuery('.formtools-page-form').on('submit', formTools.pageSubmit);
jQuery('.formtools-delete-page').on('click', formTools.deletePage);
});
</script>
diff --git a/static/js/rt-extension-formtools.js b/static/js/rt-extension-formtools.js
index a10d523..2e3ef2d 100644
--- a/static/js/rt-extension-formtools.js
+++ b/static/js/rt-extension-formtools.js
@@ -146,6 +146,13 @@ formTools = {
form.closest('.formtools-element-modal').modal('hide');
},
+ pageSubmit: function(e) {
+ e.preventDefault();
+ const form = jQuery(this);
+ jQuery('#formtools-pages a.nav-link.active').text(form.find('input[name=name]').val());
+ form.closest('.formtools-page-modal').modal('hide');
+ },
+
submit: function(e) {
const form = jQuery(this);
const content = {};
commit 2c1f2d6b3eab05129d9e95d4d0f087b1bf62efbf
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Oct 31 10:51:32 2023 -0400
Fix page form html: remove duplicate form tag and make "Update" button submit
diff --git a/html/Admin/FormTools/Modify.html b/html/Admin/FormTools/Modify.html
index 392efdb..a52db1e 100644
--- a/html/Admin/FormTools/Modify.html
+++ b/html/Admin/FormTools/Modify.html
@@ -232,32 +232,30 @@
</a>
</div>
<div class="modal-body">
- <form>
- <&| /Elements/LabeledValue, Label => loc('Page Name') &>
- <input name="name" class="form-control" value="<% $form->{'formtools-pages'}{$page_name}{name} %>" />
- </&>
- <&| /Elements/LabeledValue, Label => loc('Sort Order') &>
- <input name="sort_order" class="form-control" value="<% $form->{'formtools-pages'}{$page_name}{sort_order} %>" />
- </&>
- <&| /Elements/LabeledValue, Label => '' &>
- <div class="custom-control custom-checkbox">
- <input class="custom-control-input" id="<% $form_page_id{$page_name} %>-validation" type="checkbox" name="validation" value="1" <% $form->{'formtools-pages'}{$page_name}{validation} ? 'checked="checked"' : '' |n%> />
- <label class="custom-control-label" for="<% $form_page_id{$page_name} %>-validation">
- <&|/l&>Enable validation</&>
- </label>
- </div>
- </&>
+ <&| /Elements/LabeledValue, Label => loc('Page Name') &>
+ <input name="name" class="form-control" value="<% $form->{'formtools-pages'}{$page_name}{name} %>" />
+ </&>
+ <&| /Elements/LabeledValue, Label => loc('Sort Order') &>
+ <input name="sort_order" class="form-control" value="<% $form->{'formtools-pages'}{$page_name}{sort_order} %>" />
+ </&>
+ <&| /Elements/LabeledValue, Label => '' &>
+ <div class="custom-control custom-checkbox">
+ <input class="custom-control-input" id="<% $form_page_id{$page_name} %>-validation" type="checkbox" name="validation" value="1" <% $form->{'formtools-pages'}{$page_name}{validation} ? 'checked="checked"' : '' |n%> />
+ <label class="custom-control-label" for="<% $form_page_id{$page_name} %>-validation">
+ <&|/l&>Enable validation</&>
+ </label>
+ </div>
+ </&>
% # Do not delete the last one
% if ( $form->{'formtools-pages'}{$page_name}{next} ) {
- <&| /Elements/LabeledValue, Label => '' &>
- <a class="formtools-delete-page btn btn-primary button" data-page="<% $page_name %>" href="#"><% loc('Delete Page') %></a>
- </&>
+ <&| /Elements/LabeledValue, Label => '' &>
+ <a class="formtools-delete-page btn btn-primary button" data-page="<% $page_name %>" href="#"><% loc('Delete Page') %></a>
+ </&>
% }
- </form>
</div>
<div class="modal-footer">
- <button type="submit" class="btn btn-primary button form-control" data-dismiss="modal"><% loc('Update') %></button>
+ <button type="submit" class="btn btn-primary button form-control"><% loc('Update') %></button>
</div>
</form>
</div>
commit 25f8a41d340c4679e67b23ef101c29e7e8b57fbc
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Oct 31 10:02:03 2023 -0400
Put Select/Create under the same page menu like other pages
diff --git a/html/Callbacks/FormTools/Elements/Tabs/Privileged b/html/Callbacks/FormTools/Elements/Tabs/Privileged
index 0445206..dfab8df 100644
--- a/html/Callbacks/FormTools/Elements/Tabs/Privileged
+++ b/html/Callbacks/FormTools/Elements/Tabs/Privileged
@@ -14,8 +14,14 @@ if ( Menu->child('admin')
if ( $m->request_path =~ m{^/Admin/FormTools/} ) {
my $page = PageMenu();
- $page->child( select => title => loc('Select'), path => "/Admin/FormTools/index.html" );
- $page->child( create => title => loc('Create'), path => "/Admin/FormTools/Create.html" );
+ if ( $HTML::Mason::Commands::m->request_args->{'id'} && $HTML::Mason::Commands::m->request_args->{'id'} =~ /^\d+$/ ) {
+ my $forms = $page->child( forms => title => loc('Forms Tools'), path => "/Admin/FormTools/" );
+ $forms->child( select => title => loc('Select'), path => "/Admin/FormTools/index.html" );
+ $forms->child( create => title => loc('Create'), path => "/Admin/FormTools/Create.html" );
+ } else {
+ $page->child( select => title => loc('Select'), path => "/Admin/FormTools/index.html" );
+ $page->child( create => title => loc('Create'), path => "/Admin/FormTools/Create.html" );
+ }
if ( ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
my $id = $1;
-----------------------------------------------------------------------
Summary of changes:
html/Admin/FormTools/Modify.html | 55 +++++++++++++----------
html/Callbacks/FormTools/Elements/Tabs/Privileged | 10 ++++-
static/js/rt-extension-formtools.js | 28 ++++++++++++
3 files changed, 67 insertions(+), 26 deletions(-)
hooks/post-receive
--
rt-extension-formtools
More information about the Bps-public-commit
mailing list