[Rt-commit] rt branch 5.0/fix-user-sig-spacing-issues created. rt-5.0.2-260-gd00c2ec929

BPS Git Server git at git.bestpractical.com
Wed Jun 1 17:44:09 UTC 2022


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/fix-user-sig-spacing-issues has been created
        at  d00c2ec929c55e1b1ec27e465c43d92061064e14 (commit)

- Log -----------------------------------------------------------------
commit d00c2ec929c55e1b1ec27e465c43d92061064e14
Author: Brian Conry <bconry at bestpractical.com>
Date:   Wed May 25 08:51:59 2022 -0500

    Allow CKEDITOR (rich text) boxes to vary in height
    
    Set the height of CKEDITOR based on context.
    
    For ones with the "messagebox" class continue to use
    MessageBoxRichTextHeight.
    
    For others use the "rows" attribute of the original textarea to
    calculate a height that is approximately equivalent in editable area.

diff --git a/share/static/js/util.js b/share/static/js/util.js
index e5e93311e0..02c4981a29 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -374,7 +374,29 @@ function ReplaceAllTextareas() {
             // Set the type
             type.val("text/html");
 
-            CKEDITOR.replace(textArea.name,{ width: '100%', height: RT.Config.MessageBoxRichTextHeight });
+            if (jQuery(textArea).hasClass("messagebox")) {
+                // * the "messagebox" class is used for ticket correspondence/comment content.
+                // * for a long time this was the only use of the CKEDITOR and it was given its own
+                //   user/system configuration option.
+                // * continue using this config option for those CKEDITOR instances
+                CKEDITOR.replace(textArea.name,{ width: '100%', height: RT.Config.MessageBoxRichTextHeight });
+            }
+            else {
+                // * for all CKEDITOR instances without the "messagebox" class we instead base the
+                //   (editable) height on the size of the textarea element it's replacing.
+                //   (the height does not include any toolbars, the status bar, or other "overhead")
+                // * the complication is that textarea sizes are given in "rows" while the CSS sizes
+                //   don't support "rows" as a unit of measure.  the closest CSS measure is "em", which
+                //   is based on the font characteristics of the element, but where "rows" includes all
+                //   applicable padding between the rows and margin around the block of rows, "em"
+                //   doesn't include any of those things.
+                // * the formula below seems to be a pretty decent approximation on my system with my
+                //   current browser - but there may be a better approximation, or things may change,
+                //   or the best calculation may be browser/os dependent.  YMMV
+                // * the thinking is:
+                //     N+rows + (N - 1)+gaps + 1.5 top margin + 1.5 bottom margin = 2*N + 2
+                CKEDITOR.replace(textArea.name,{ width: '100%', height: (textArea.rows * 2 + 2) + 'em' });
+            }
 
             jQuery('[name="' + textArea.name + '___Frame"]').addClass("richtext-editor");
         }

commit b8d8663e84a17fe82b2b316a79222a0a6a3dbf9e
Author: Brian Conry <bconry at bestpractical.com>
Date:   Tue May 31 09:46:40 2022 -0500

    Move user custom fields on prefs page
    
    Move the general custom fields on /Prefs/AboutMe.html
    (/Prefs/Elements/EditAboutMe) from the bottom of the page at full page
    width to the bottom of the right column at half page width.
    
    This matches the placement of the custom fields on
    /Admin/Users/Modify.html and is a better use of space.

diff --git a/share/html/Prefs/Elements/EditAboutMe b/share/html/Prefs/Elements/EditAboutMe
index 09b4d5a86b..35f364492c 100644
--- a/share/html/Prefs/Elements/EditAboutMe
+++ b/share/html/Prefs/Elements/EditAboutMe
@@ -258,14 +258,18 @@
       </div>
     </&>
 
+    <div class="form-row">
+      <div class="col-12">
+        <& /Elements/EditCustomFieldCustomGroupings, Object => $UserObj &>
+      </div>
+    </div>
+
 % $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormRightColumn' );
 
 %### End right column ###
   </div>
 </div>
 
-<& /Elements/EditCustomFieldCustomGroupings, Object => $UserObj &>
-
 <div class="form-row">
   <div class="col-12">
     <& /Elements/Submit, Label => loc('Save Preferences') &>

commit fabf45b78a27489ac4af7335231bcd21147d0117
Author: Brian Conry <bconry at bestpractical.com>
Date:   Wed May 25 08:40:22 2022 -0500

    Adjust spacing around user signature edit boxes
    
    In the conversion to bootstrap commits 0f5854a8f2 and 37a20a4581 moved
    the comment and signature boxes from the left column to the full width
    of the page on the /Admin/Users/Modify and /Prefs/Elements/EditAboutMe
    pages (respectively).
    
    This isn't called out as an intentional change, but it creates an odd
    gap on the page when the right column is longer than the left column,
    and neither field needs the full page width for content, so the previous
    layout (left column) has been restored.

diff --git a/share/html/Admin/Users/Modify.html b/share/html/Admin/Users/Modify.html
index b322f839c0..7b66ed4541 100644
--- a/share/html/Admin/Users/Modify.html
+++ b/share/html/Admin/Users/Modify.html
@@ -166,6 +166,32 @@
 <& /Elements/EditCustomFields, Object => $UserObj, Grouping => 'Access control' &>
 
 </&>
+
+<&| /Widgets/TitleBox, title => loc('Comments about this user'), class => 'user-info-comments' &>
+<div class="form-row">
+  <div class="col-12">
+    <textarea class="comments form-control" name="Comments" cols="80" rows="5" wrap="virtual"><%$UserObj->Comments//$ARGS{Comments}//''%></textarea>
+  </div>
+</div>
+</&>
+
+%if (!$Create && $UserObj->Privileged) {
+%   my $sig = $UserObj->Signature//$ARGS{Signature}//'';
+%   my $richtext = '';
+<&| /Widgets/TitleBox, title => loc('Signature'), class => 'user-info-signature' &>
+<div class="form-row">
+  <div class="col-12">
+%   if (RT->Config->Get('MessageBoxRichText', $UserObj )) {
+%       # allow for a smooth transition from a plain text signature, with or without HTML content, to an HTML signature
+        <input type="text" style="display:none" name="SignatureType" id="SignatureType" value="<%$sig =~ /<.{1,5}>/ ? "text/html" : 'text/plain'%>"/>
+%       $richtext = ' richtext';
+%   }
+    <textarea class="signature form-control<%$richtext%>" rows="5" name="Signature" wrap="hard"><%$sig%></textarea>
+  </div>
+</div>
+</&>
+% }
+
 % $m->callback( %ARGS, CallbackName => 'LeftColumnBottom', UserObj => $UserObj );
 
   </div>  <!-- boxcontainer -->
@@ -291,27 +317,6 @@
   </div> <!-- boxcontainer -->
 </div>   <!-- row -->
 
-<&| /Widgets/TitleBox, title => loc('Comments about this user'), class => 'user-info-comments' &>
-<textarea class="comments form-control" name="Comments" cols="80" rows="5" wrap="virtual"><%$UserObj->Comments//$ARGS{Comments}//''%></textarea>
-</&>
-
-%if (!$Create && $UserObj->Privileged) { 
-%   my $sig = $UserObj->Signature//$ARGS{Signature}//'';
-%   my $richtext = '';
-<&| /Widgets/TitleBox, title => loc('Signature'), class => 'user-info-signature' &>
-<div class="form-row">
-  <div class="col-12">
-%   if (RT->Config->Get('MessageBoxRichText', $UserObj )) {
-%       # allow for a smooth transition from a plain text signature, with or without HTML content, to an HTML signature
-        <input type="text" style="display:none" name="SignatureType" id="SignatureType" value="<%$sig =~ /<.{1,5}>/ ? "text/html" : 'text/plain'%>"/>
-%       $richtext = ' richtext';
-%   }
-    <textarea class="signature form-control<%$richtext%>" rows="5" name="Signature" wrap="hard"><%$sig%></textarea>
-  </div>
-</div>
-</&>
-% }
-
 % if ( $Create ) {
   <div class="form-row">
     <div class="col-12">
diff --git a/share/html/Prefs/Elements/EditAboutMe b/share/html/Prefs/Elements/EditAboutMe
index d13f161a26..09b4d5a86b 100644
--- a/share/html/Prefs/Elements/EditAboutMe
+++ b/share/html/Prefs/Elements/EditAboutMe
@@ -147,6 +147,23 @@
       </div>
     </&>
 
+%if ($UserObj->Privileged) {
+%   my $sig = $UserObj->Signature || '';
+%   my $richtext = '';
+    <&| /Widgets/TitleBox, title => loc('Signature'), id => "user-prefs-signature" &>
+      <div class="form-row">
+        <div class="col-12">
+%   if (RT->Config->Get('MessageBoxRichText', $session{'CurrentUser'})) {
+%       # allow for a smooth transition from a plain text signature, with or without HTML content, to an HTML signature
+        <input type="text" style="display:none" name="SignatureType" id="SignatureType" value="<%$sig =~ /<.{1,5}>/ ? "text/html" : 'text/plain'%>"/>
+%       $richtext = ' richtext';
+%   }
+            <textarea class="form-control signature<%$richtext%>" cols="80" rows="5" name="Signature" wrap="hard"><%$sig%></textarea>
+        </div>
+      </div>
+    </&>
+% }
+
 % $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormLeftColumn' );
 
 %### End left column ###
@@ -247,23 +264,6 @@
   </div>
 </div>
 
-%if ($UserObj->Privileged) {
-%   my $sig = $UserObj->Signature || '';
-%   my $richtext = '';
-<div class="form-row">
-  <div class="col-6">
-    <&| /Widgets/TitleBox, title => loc('Signature'), id => "user-prefs-signature" &>
-%   if (RT->Config->Get('MessageBoxRichText', $session{'CurrentUser'})) {
-%       # allow for a smooth transition from a plain text signature, with or without HTML content, to an HTML signature
-        <input type="text" style="display:none" name="SignatureType" id="SignatureType" value="<%$sig =~ /<.{1,5}>/ ? "text/html" : 'text/plain'%>"/>
-%       $richtext = ' richtext';
-%   }
-      <textarea class="form-control signature<%$richtext%>" cols="80" rows="5" name="Signature" wrap="hard"><%$sig%></textarea>
-    </&>
-  </div>
-</div>
-% }
-
 <& /Elements/EditCustomFieldCustomGroupings, Object => $UserObj &>
 
 <div class="form-row">

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list