[ARVADOS] updated: f5a1a9210e7638babe33d16938246e93ff4dd334

git at public.curoverse.com git at public.curoverse.com
Fri Nov 14 01:18:47 EST 2014


Summary of changes:
 .../workbench/app/assets/javascripts/filterable.js | 23 +++++++++++-----------
 .../app/assets/javascripts/infinite_scroll.js      | 14 ++-----------
 2 files changed, 13 insertions(+), 24 deletions(-)

  discards  9100a3b10a79bc07a8b31291dc30e155603ec9b0 (commit)
       via  f5a1a9210e7638babe33d16938246e93ff4dd334 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (9100a3b10a79bc07a8b31291dc30e155603ec9b0)
            \
             N -- N -- N (f5a1a9210e7638babe33d16938246e93ff4dd334)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit f5a1a9210e7638babe33d16938246e93ff4dd334
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Nov 13 21:47:29 2014 -0500

    4024: Use filterable-control input values (if any) when first loading dynamic content.

diff --git a/apps/workbench/app/assets/javascripts/filterable.js b/apps/workbench/app/assets/javascripts/filterable.js
index 8ac1953..cd01f64 100644
--- a/apps/workbench/app/assets/javascripts/filterable.js
+++ b/apps/workbench/app/assets/javascripts/filterable.js
@@ -49,8 +49,41 @@
 // Combining "select" filterable-controls with infinite-scroll is not
 // yet supported.
 
+function updateFilterableQueryNow($target) {
+    var newquery = $target.data('filterable-query-new');
+    var params = $target.data('infinite-content-params-filterable') || {};
+    params.filters = [['any', 'ilike', '%' + newquery + '%']];
+    $target.data('infinite-content-params-filterable', params);
+    $target.data('filterable-query', newquery);
+}
+
 $(document).
-    on('paste keyup input', 'input[type=text].filterable-control', function() {
+    on('ready ajax:success', function() {
+        // Copy any initial input values into
+        // data-filterable-query[-new].
+        $('input[type=text].filterable-control').each(function() {
+            var $this = $(this);
+            var $target = $($this.attr('data-filterable-target'));
+            if ($target.data('filterable-query-new') === undefined) {
+                $target.data('filterable-query', $this.val());
+                $target.data('filterable-query-new', $this.val());
+                updateFilterableQueryNow($target);
+            }
+        });
+        $('[data-infinite-scroller]').on('refresh-content', '[data-filterable-query]', function(e) {
+            // If some other event causes a refresh-content event while there
+            // is a new query waiting to cooloff, we should use the new query
+            // right away -- otherwise we'd launch an extra ajax request that
+            // would have to be reloaded as soon as the cooloff period ends.
+            if (this != e.target)
+                return;
+            if ($(this).data('filterable-query') == $(this).data('filterable-query-new'))
+                return;
+            updateFilterableQueryNow($(this));
+        });
+    }).
+    on('paste keyup input', 'input[type=text].filterable-control', function(e) {
+        if (this != e.target) return;
         var $target = $($(this).attr('data-filterable-target'));
         var currentquery = $target.data('filterable-query');
         if (currentquery === undefined) currentquery = '';
@@ -74,11 +107,7 @@ $(document).
                 // in the next 1/4 second (like type or erase
                 // characters in the search box), hide the stale
                 // content and ask the server for new results.
-                var newquery = $target.data('filterable-query-new');
-                var params = $target.data('infinite-content-params-filterable') || {};
-                params.filters = [['any', 'ilike', '%' + newquery + '%']];
-                $target.data('infinite-content-params-filterable', params);
-                $target.data('filterable-query', newquery);
+                updateFilterableQueryNow($target);
                 $target.trigger('refresh-content');
             }, 250));
         } else {
diff --git a/apps/workbench/app/assets/javascripts/infinite_scroll.js b/apps/workbench/app/assets/javascripts/infinite_scroll.js
index 0472576..7bdf574 100644
--- a/apps/workbench/app/assets/javascripts/infinite_scroll.js
+++ b/apps/workbench/app/assets/javascripts/infinite_scroll.js
@@ -1,7 +1,7 @@
 function maybe_load_more_content(event) {
-    var scroller = this;        // element with scroll bars
-    var $container;             // element that receives new content
-    var src;                    // url for retrieving content
+    var scroller = this;
+    var $container = $(event.data.container);
+    var src;                     // url for retrieving content
     var scrollHeight;
     var spinner, colspan;
     var serial = Date.now();
@@ -11,7 +11,6 @@ function maybe_load_more_content(event) {
         >
         scrollHeight - 50)
     {
-        $container = $(event.data.container);
         if (!$container.attr('data-infinite-content-href0')) {
             // Remember the first page source url, so we can refresh
             // from page 1 later.
diff --git a/apps/workbench/test/integration/filterable_infinite_scroll_test.rb b/apps/workbench/test/integration/filterable_infinite_scroll_test.rb
index 14a0677..4434f9a 100644
--- a/apps/workbench/test/integration/filterable_infinite_scroll_test.rb
+++ b/apps/workbench/test/integration/filterable_infinite_scroll_test.rb
@@ -2,6 +2,8 @@ require 'integration_helper'
 
 class FilterableInfiniteScrollTest < ActionDispatch::IntegrationTest
   setup do
+    headless = Headless.new
+    headless.start
     Capybara.current_driver = :selenium
   end
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list