[Rt-commit] rt branch, 4.6/inline-edit, updated. rt-4.4.1-134-g6570181

Shawn Moore shawn at bestpractical.com
Mon Sep 12 16:41:12 EDT 2016


The branch, 4.6/inline-edit has been updated
       via  657018150a9b97f8acb8c93ca057f8c329f73cc8 (commit)
       via  a74a72066cca2b794818456d0e10217d0542562e (commit)
       via  8015efd660b36dea61d63c26162eb42ed86df893 (commit)
      from  6f589346cd77d1b003901f64e5a0b8a4f022010c (commit)

Summary of changes:
 share/static/css/base/collection.css | 37 ++++++++++++++++++++++++------------
 share/static/js/util.js              | 36 ++++++++++++++++++++++++++---------
 2 files changed, 52 insertions(+), 21 deletions(-)

- Log -----------------------------------------------------------------
commit 8015efd660b36dea61d63c26162eb42ed86df893
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Mon Sep 12 20:20:09 2016 +0000

    Simplify CSS class management of inline edit

diff --git a/share/static/css/base/collection.css b/share/static/css/base/collection.css
index 4e25347..9f6e437 100644
--- a/share/static/css/base/collection.css
+++ b/share/static/css/base/collection.css
@@ -25,30 +25,39 @@ table.collection td:first-child, table.collection th:first-child {
     content: '\a0\a0\a0\a0';
 }
 
+td.editable > .value {
+    padding-top: 0;
+}
+
+td.editable > form.editor > img.loading {
+    height: 1em;
+    width: 1em;
+}
+
+td.editable.error {
+    color: red;
+    font-weight: bold;
+}
+
 td.editable > form.editor {
     display: none;
 }
 
-td.editable > form.editor > img.loading,
-td.editing > form.editor > img.loading {
-    display: none;
+td.editable.editing > form.editor,
+td.editable.loading > form.editor {
+    display: inline-block;
 }
 
-td.editable > .value {
-    padding-top: 0;
+td.editable.editing > .value,
+td.editable.loading > .value {
+    display: none;
 }
 
-td.editing > .value {
+td.editable > form.editor > .loading {
     display: none;
 }
 
-td.editing.loading > form.editor > img.loading {
+td.editable.loading > form.editor > .loading {
     display: inline-block;
-    height: 1em;
-    width: 1em;
 }
 
-td.editing.loading.error {
-    color: red;
-    font-weight: bold;
-}
diff --git a/share/static/js/util.js b/share/static/js/util.js
index 1bda962..341b27e 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -586,7 +586,7 @@ jQuery(function () {
         var value = cell.find('.value');
         var editor = cell.find('.editor');
 
-        cell.removeClass('editable').addClass('editing');
+        cell.addClass('editing');
         editor.find(':input:visible:enabled:first').focus();
     });
 
@@ -598,9 +598,8 @@ jQuery(function () {
 
         var params = editor.serialize();
 
-        cell.removeClass('editing').addClass('editable');
         editor.find(':input').attr('disabled', 'disabled');
-        cell.addClass('loading');
+        cell.removeClass('editing').addClass('loading');
 
         jQuery.ajax({
             url     : editor.attr('action'),

commit a74a72066cca2b794818456d0e10217d0542562e
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Mon Sep 12 20:33:08 2016 +0000

    Disable inline edit on error

diff --git a/share/static/js/util.js b/share/static/js/util.js
index 341b27e..4c31f58 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -541,7 +541,7 @@ function refreshCollectionListRow(tbody, success, error) {
             tbody.replaceWith(response);
             if (success) { success(response) }
         },
-        error: error,
+        error: error
     });
 }
 
@@ -575,6 +575,12 @@ jQuery(function() {
 
 /* inline edit */
 jQuery(function () {
+    var inlineEditEnabled = true;
+    var disableInlineEdit = function () {
+        inlineEditEnabled = false;
+        jQuery('.editable').removeClass('editing').removeClass('loading');
+    };
+
     // stop propagation when we click a hyperlink (e.g. ticket subject) so that
     // the td.editable onclick handler doesn't also fire
     jQuery(document).on('click', 'td.editable a', function (e) {
@@ -582,6 +588,10 @@ jQuery(function () {
     });
 
     jQuery(document).on('click', 'td.editable', function (e) {
+        if (!inlineEditEnabled) {
+            return;
+        }
+
         var cell = jQuery(this);
         var value = cell.find('.value');
         var editor = cell.find('.editor');
@@ -591,6 +601,10 @@ jQuery(function () {
     });
 
     jQuery(document).on('focusout', 'td.editing form', function () {
+        if (!inlineEditEnabled) {
+            return;
+        }
+
         var editor = jQuery(this);
         var cell = editor.closest('td');
         var tbody = cell.closest('tbody');
@@ -609,19 +623,21 @@ jQuery(function () {
                 jQuery.each(results.actions, function (i, action) {
                     jQuery.jGrowl(action, { themeState: 'none' });
                 });
-            },
-            error   : function (xhr, error) {
-                jQuery.jGrowl(error, { sticky: true, themeState: 'none' });
-            },
-            complete : function () {
+
                 refreshCollectionListRow(
                     tbody,
                     function () { },
                     function (xhr, error) {
                         jQuery.jGrowl(error, { sticky: true, themeState: 'none' });
                         cell.addClass('error').html(loc_key('error'));
+                        disableInlineEdit();
                     }
                 );
+            },
+            error   : function (xhr, error) {
+                jQuery.jGrowl(error, { sticky: true, themeState: 'none' });
+                cell.addClass('error').html(loc_key('error'));
+                disableInlineEdit();
             }
         });
     });

commit 657018150a9b97f8acb8c93ca057f8c329f73cc8
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Mon Sep 12 20:39:05 2016 +0000

    Add visual indicator that tbody is refreshing

diff --git a/share/static/css/base/collection.css b/share/static/css/base/collection.css
index 9f6e437..58ebba3 100644
--- a/share/static/css/base/collection.css
+++ b/share/static/css/base/collection.css
@@ -61,3 +61,7 @@ td.editable.loading > form.editor > .loading {
     display: inline-block;
 }
 
+tbody.list-item.refreshing {
+    opacity: 0.5;
+}
+
diff --git a/share/static/js/util.js b/share/static/js/util.js
index 4c31f58..cb201d9 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -533,6 +533,8 @@ function refreshCollectionListRow(tbody, success, error) {
         Warning       : tbody.data('warning')
     };
 
+    tbody.addClass('refreshing');
+
     jQuery.ajax({
         url    : RT.Config.WebHomePath + '/Helpers/CollectionListRow',
         method : 'GET',
@@ -614,6 +616,7 @@ jQuery(function () {
 
         editor.find(':input').attr('disabled', 'disabled');
         cell.removeClass('editing').addClass('loading');
+        tbody.addClass('refreshing');
 
         jQuery.ajax({
             url     : editor.attr('action'),

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


More information about the rt-commit mailing list