[Bps-public-commit] rt-extension-formtools branch dynamic-forms-from-config updated. 0.53-39-g745ef34

BPS Git Server git at git.bestpractical.com
Fri Oct 6 20:06:34 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  745ef34354f4c10e4cb8de0115818cbfad47473e (commit)
      from  2dff55212f2f659cbce609bf7a46c78f7657caa7 (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 745ef34354f4c10e4cb8de0115818cbfad47473e
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Oct 6 15:56:36 2023 -0400

    Convert page basics form to modal to save space

diff --git a/html/Admin/FormTools/Modify.html b/html/Admin/FormTools/Modify.html
index 82162a2..d242379 100644
--- a/html/Admin/FormTools/Modify.html
+++ b/html/Admin/FormTools/Modify.html
@@ -216,34 +216,52 @@
     <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">
-        <&| /Widgets/TitleBox, title => loc('Basic Info'), titleright_raw => qq{} &>
-        <form>
-          <&| /Elements/LabeledValue, Label => loc('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>
-          </&>
+        <div class="modal fade formtools-element-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">
+                <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">
+                    <span aria-hidden="true">×</span>
+                  </a>
+                </div>
+                <div class="modal-body">
+                  <form>
+                    <&| /Elements/LabeledValue, Label => loc('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>
-          </&>
-%         }
-        </form>
-        </&>
+%                   # 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>
+                    </&>
+%                   }
+                  </form>
+                </div>
+                <div class="modal-footer">
+                  <button type="submit" class="btn btn-primary button form-control" data-dismiss="modal"><% loc('Save') %></button>
+                </div>
+              </form>
+            </div>
+          </div>
+        </div>
 
-        <&| /Widgets/TitleBox, title => loc('Content') &>
-          <div class="formtools-content w-100 border rounded" data-page="<% $page_name %>" data-page-id="<% $form_page_id{$page_name} %>" ondrop="formTools.drop(event);" ondragover="formTools.dragover(event);" ondragend="formTools.dragend(event);">
+%       my $loc_basics = loc('Basics');
+        <&| /Widgets/TitleBox, title => loc('Content'), titleright_raw => qq{<a href="#" data-toggle="modal" data-target="#formtools-element-$form_page_id{$page_name}-basics-modal"><span class="fas fa-cog icon-bordered fa-2x" alt="$loc_basics" data-toggle="tooltip" data-placement="top" data-original-title="$loc_basics"></span></a>} &>
+          <div class="formtools-content w-100 border rounded mt-3" data-page="<% $page_name %>" data-page-id="<% $form_page_id{$page_name} %>" ondrop="formTools.drop(event);" ondragover="formTools.dragover(event);" ondragend="formTools.dragend(event);">
 %         my $i = 0;
 %         for my $item ( grep { $_->{type} ne 'hidden' || $_->{'input-name'} ne 'create_ticket' } @{$form->{'formtools-pages'}{$page_name}{content} || []} ) {
             <div id="formtools-element-<% $form_page_id{$page_name} %>-<% $i %>" class="formtools-element" draggable="true" ondragstart="formTools.dragstart(event);" ondragend="formTools.dragend(event);" ondragenter="formTools.dragenter(event)" ondragleave="formTools.dragleave(event)" data-value="<% JSON($item) %>">
diff --git a/static/js/rt-extension-formtools.js b/static/js/rt-extension-formtools.js
index d8055b7..8e9644c 100644
--- a/static/js/rt-extension-formtools.js
+++ b/static/js/rt-extension-formtools.js
@@ -156,12 +156,13 @@ formTools = {
     },
 
     deletePage: function() {
+        jQuery('.formtools-element-modal.show').modal('hide');
         const tab = jQuery(this).closest('.tab-pane');
-
         tab.fadeOut(function() {
             jQuery('#formtools-pages').find('a.nav-link[href="#' + tab.attr('id') + '"]').closest('li').remove();
             jQuery('#formtools-pages').find('li:first a.nav-link').tab('show');
-        }).remove();
+            tab.remove();
+        });
         return false;
     }
 };

-----------------------------------------------------------------------

Summary of changes:
 html/Admin/FormTools/Modify.html    | 70 +++++++++++++++++++++++--------------
 static/js/rt-extension-formtools.js |  5 +--
 2 files changed, 47 insertions(+), 28 deletions(-)


hooks/post-receive
-- 
rt-extension-formtools


More information about the Bps-public-commit mailing list