]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1380389 - autosize comments should be a user pref (default: on)
authorMary Umoh <umohm12@gmail.com>
Mon, 17 Jul 2017 22:06:23 +0000 (18:06 -0400)
committerDylan William Hardison <dylan@hardison.net>
Mon, 17 Jul 2017 22:06:23 +0000 (18:06 -0400)
Bugzilla/Install.pm
extensions/BugModal/template/en/default/bug_modal/header.html.tmpl
extensions/BugModal/web/bug_modal.js
template/en/default/global/setting-descs.none.tmpl

index 885571020b94d32f57900ee976c04b762d83c8de..3f8d4bdfb43bf953099a33e8d89cf38a5f42a904 100644 (file)
@@ -181,6 +181,12 @@ sub SETTINGS {
         default  => 'off',
         category => 'Searching'
     },
+    {
+        name     => 'autosize_comments',
+        options  => ['on', 'off'],
+        default  => 'on',
+        category => 'User Interface'
+    },
     ];
 };
 
index db9bbeb7a27ae9e4e9dacac9947fcfc393ca8a48..a91d1157638add559e79cf662a8144e10a4dc806 100644 (file)
     settings: {
       quote_replies: '[% user.settings.quote_replies.value FILTER js %]',
       zoom_textareas: [% user.settings.zoom_textareas.value == "on" ? "true" : "false" %],
-      remember_collapsed: [% user.settings.ui_remember_collapsed.value == "on" ? "true" : "false" %]
+      remember_collapsed: [% user.settings.ui_remember_collapsed.value == "on" ? "true" : "false" %],
+      autosize_comments: [% user.settings.autosize_comments.value == "on" ? "true" : "false" %]
     }
   };
   [% IF user.id %]
index 6004c255b514fa6437ba5f4197165089fe1d6a2b..5ca0148e7564eb643a0c164dbc55004cad520322 100644 (file)
@@ -458,7 +458,7 @@ $(function() {
     var rbs = $("#readable-bug-status");
     var rbs_text = bugzillaReadableStatus.readable(rbs.data('readable-bug-status'));
     rbs.text(rbs_text);
-    
+
     if (BUGZILLA.user.id === 0) return;
 
     //
@@ -853,8 +853,7 @@ $(function() {
             if (BUGZILLA.user.settings.quote_replies == 'quoted_reply') {
                 var text = $('#ct-' + comment_id).text();
                 reply_text = prefix + wrapReplyText(text);
-            }
-            else if (BUGZILLA.user.settings.quote_replies == 'simply_reply') {
+            } else if (BUGZILLA.user.settings.quote_replies == 'simply_reply') {
                 reply_text = prefix;
             }
 
@@ -868,12 +867,22 @@ $(function() {
             if ($('#comment').val() != reply_text) {
                 $('#comment').val($('#comment').val() + reply_text);
             }
-            autosize.update($('#comment'));
-            $.scrollTo($('#comment'), function() { $('#comment').focus(); });
+            if (BUGZILLA.user.settings.autosize_comments) {
+                autosize.update($('#comment'));
+            }
+            $.scrollTo($('#comment'), function() {
+                $('#comment').focus();
+            });
         });
 
-    // auto-enlarge comment area (up to its max-height)
-    autosize($('#comment'));
+    if (BUGZILLA.user.settings.autosize_comments) {
+        autosize($('#comment'));
+    } else if (BUGZILLA.user.settings.zoom_textareas) {
+        // add comment --> enlarge on focus
+        $('#comment').focus(function(event) {
+            $(event.target).attr('rows', 25);
+        });
+    }
 
     // add comment --> private
     $('#add-comment-private-cb')
index ba001ab6d193d102df3441384107a193768ffd8f..b6800d22d28b417c66ba5778a7f7bfefd832a718 100644 (file)
@@ -18,7 +18,7 @@
 
 [% PROCESS global/variables.none.tmpl %]
 
-[% setting_descs = { 
+[% setting_descs = {
    "comment_sort_order"               => "When viewing $terms.abug, show comments in this order",
    "csv_colsepchar"                   => "Field separator character for CSV files",
    "display_quips"                    => "Show a quip at the top of each $terms.bug list",
@@ -43,6 +43,7 @@
    "quote_replies"                    => "Quote the associated comment when you click on its reply link",
    "quoted_reply"                     => "Quote the full comment",
    "simple_reply"                     => "Reference the comment number only",
+   "autosize_comments"                => "Expand the comment box dynamically",
    "comment_box_position"             => "Position of the Additional Comments box",
    "before_comments"                  => "Before other comments",
    "after_comments"                   => "After other comments",