[Rt-commit] rt branch, 4.6/inline-edit, updated. rt-4.4.1-137-g02bc760

Shawn Moore shawn at bestpractical.com
Mon Sep 12 17:05:15 EDT 2016


The branch, 4.6/inline-edit has been updated
       via  02bc760859b2d2828646289cc11fc91b2d3848fb (commit)
      from  d6dce030c8bcc08a0bd4ce1e2197e75f6bc3db11 (commit)

Summary of changes:
 share/static/js/util.js | 9 +++++++++
 1 file changed, 9 insertions(+)

- Log -----------------------------------------------------------------
commit 02bc760859b2d2828646289cc11fc91b2d3848fb
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Mon Sep 12 21:04:00 2016 +0000

    Only submit changes to the server if an input field changed

diff --git a/share/static/js/util.js b/share/static/js/util.js
index 9eba73b..b256fe1 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -600,6 +600,10 @@ jQuery(function () {
         editor.find(':input:visible:enabled:first').focus();
     });
 
+    jQuery(document).on('change', 'td.editable form :input', function () {
+        jQuery(this).closest('form').data('changed', true);
+    });
+
     jQuery(document).on('focusout', 'td.editing form', function () {
         if (!inlineEditEnabled) {
             return;
@@ -611,6 +615,11 @@ jQuery(function () {
         var table = tbody.closest('table');
         var value = cell.find('.value');
 
+        if (!editor.data('changed')) {
+            cell.removeClass('editing');
+            return;
+        }
+
         var params = editor.serialize();
 
         editor.find(':input').attr('disabled', 'disabled');

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


More information about the rt-commit mailing list