[Rt-commit] rt branch, 4.4/inline-edit, updated. rt-4.4.1-125-g39780f8

Shawn Moore shawn at bestpractical.com
Wed Aug 31 14:17:53 EDT 2016


The branch, 4.4/inline-edit has been updated
       via  39780f856426c02bd8f502eeff486349f97cc99c (commit)
       via  975b717ad3f5488eee9499505a68fb557661b633 (commit)
       via  85bc14b6dd643842338a219fe31318096243a48b (commit)
       via  366459ed4a55d1e15400ef341983115219ebf25d (commit)
      from  966fd9f6e2d285334880bd8eb982a46d7a5febcd (commit)

Summary of changes:
 share/html/Elements/CollectionAsTable/Row |  2 +-
 share/static/css/base/collection.css      | 11 +++++++++++
 share/static/js/util.js                   | 13 +++++++++++--
 3 files changed, 23 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 366459ed4a55d1e15400ef341983115219ebf25d
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Aug 31 17:12:31 2016 +0000

    Disable form fields as soon as form is submitted

diff --git a/share/static/js/util.js b/share/static/js/util.js
index d5f1cf6..edddf5c 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -571,12 +571,15 @@ jQuery(function () {
         var cell = editor.closest('td');
         var value = cell.find('.value');
 
-        cell.removeClass('editing').addClass('editable');
+        var params = editor.serialize();
+
+        cell.addClass('loading');
+        editor.find(':input').attr('disabled', 'disabled');
 
         jQuery.ajax({
             url     : editor.attr('action'),
             method  : 'POST',
-            data    : editor.serialize(),
+            data    : params,
             success : function (results) {
                 jQuery.each(results.actions, function (i, action) {
                     jQuery.jGrowl(action, { themeState: 'none' });

commit 85bc14b6dd643842338a219fe31318096243a48b
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Aug 31 17:12:47 2016 +0000

    Add loading spinner while the form is being submitted

diff --git a/share/html/Elements/CollectionAsTable/Row b/share/html/Elements/CollectionAsTable/Row
index eba7c22..54bd960 100644
--- a/share/html/Elements/CollectionAsTable/Row
+++ b/share/html/Elements/CollectionAsTable/Row
@@ -157,7 +157,7 @@ foreach my $column (@Format) {
     $m->out('>');
 
     if ($attrs{edit}) {
-        $m->out('<form method="POST" action="'.RT->Config->Get('WebPath').'/Helpers/TicketUpdate?id='.$record->id.'" class="editor">' . $attrs{edit} . '</form>');
+        $m->out('<form method="POST" action="'.RT->Config->Get('WebPath').'/Helpers/TicketUpdate?id='.$record->id.'" class="editor">' . $attrs{edit} . '<img class="loading" src="'.RT->Config->Get('WebPath').'/static/images/loading.gif" alt="'.loc('Loading').'"/></form>');
         $m->out('<div class="value">');
     }
 
diff --git a/share/static/css/base/collection.css b/share/static/css/base/collection.css
index 222c509..1596e51 100644
--- a/share/static/css/base/collection.css
+++ b/share/static/css/base/collection.css
@@ -29,6 +29,11 @@ td.editable > form.editor {
     display: none;
 }
 
+td.editable > form.editor > img.loading,
+td.editing > form.editor > img.loading {
+    display: none;
+}
+
 td.editable > .value {
     padding-top: 0;
 }
@@ -36,3 +41,9 @@ td.editable > .value {
 td.editing > .value {
     display: none;
 }
+
+td.editing.loading > form.editor > img.loading {
+    display: inline-block;
+    height: 1em;
+    width: 1em;
+}

commit 975b717ad3f5488eee9499505a68fb557661b633
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Aug 31 18:10:46 2016 +0000

    Display errors in a sticky jGrowl

diff --git a/share/static/js/util.js b/share/static/js/util.js
index edddf5c..8218238 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -584,6 +584,9 @@ jQuery(function () {
                 jQuery.each(results.actions, function (i, action) {
                     jQuery.jGrowl(action, { themeState: 'none' });
                 });
+            },
+            error   : function (xhr, error) {
+                jQuery.jGrowl(error, { sticky: true });
             }
         });
     });

commit 39780f856426c02bd8f502eeff486349f97cc99c
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Aug 31 18:10:55 2016 +0000

    On ajax complete, reset the UI

diff --git a/share/static/js/util.js b/share/static/js/util.js
index 8218238..a137742 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -587,6 +587,9 @@ jQuery(function () {
             },
             error   : function (xhr, error) {
                 jQuery.jGrowl(error, { sticky: true });
+            },
+            complete : function () {
+                cell.removeClass('loading').removeClass('editing').addClass('editable');
             }
         });
     });

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


More information about the rt-commit mailing list