[Rt-commit] rt branch, 4.6/inline-edit, updated. rt-4.4.1-162-g4882552

Shawn Moore shawn at bestpractical.com
Tue Sep 20 12:15:58 EDT 2016


The branch, 4.6/inline-edit has been updated
       via  4882552baa77f894fc2bbd60235e6f3f22e86d81 (commit)
      from  351fb2b53459483853cee8b290189eb93b63ff96 (commit)

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

- Log -----------------------------------------------------------------
commit 4882552baa77f894fc2bbd60235e6f3f22e86d81
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Tue Sep 20 16:15:22 2016 +0000

    When we cancel inline edit, restore the form to pristine condition
    
    Otherwise, if you click back into the inline edit form, the edits you
    made will still be there, and you'll have to cancel them again.

diff --git a/share/static/js/util.js b/share/static/js/util.js
index e8cb4ce..cec4463 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -587,6 +587,7 @@ jQuery(function () {
     var inlineEditingDate = false;
     var scrollHandler = null;
     var escapeKeyHandler = null;
+    var inlineEditFormPristine = null;
 
     var beginInlineEdit = function (cell) {
         if (!inlineEditEnabled) {
@@ -600,6 +601,7 @@ jQuery(function () {
             return;
         }
 
+        inlineEditPristineForm = cell.find('form').clone();
         var height = cell.height();
 
         cell.addClass('editing');
@@ -643,6 +645,10 @@ jQuery(function () {
         inlineEditingDate = false;
         cell.removeClass('editing').removeAttr('height');
         editor.removeClass('wide');
+
+        cell.find('form').replaceWith(inlineEditPristineForm);
+        inlineEditPristineForm = null;
+
         if (scrollHandler) {
             jQuery(window).off('scroll', scrollHandler);
         }
@@ -676,6 +682,7 @@ jQuery(function () {
         editor.find(':input').attr('disabled', 'disabled');
         cell.removeClass('editing').addClass('loading');
         tbody.addClass('refreshing');
+        inlineEditPristineForm = null;
 
         jQuery.ajax({
             url     : editor.attr('action'),

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


More information about the rt-commit mailing list