[ARVADOS] created: 648993083cc3339eab094be4dbccae7701d7664f
git at public.curoverse.com
git at public.curoverse.com
Fri Dec 19 17:40:15 EST 2014
at 648993083cc3339eab094be4dbccae7701d7664f (commit)
commit 648993083cc3339eab094be4dbccae7701d7664f
Author: Brett Smith <brett at curoverse.com>
Date: Fri Dec 19 17:40:13 2014 -0500
4836: Fix infinite scroll loading in background tabs.
If an infinite scroller is in the first tab of a show page, but the
user is going to a different tab, we'll queue up the first event
to load data for the container, but when it fires the container won't
be visible so it will decline to load anything. Then you can only get
data to load if you resize the window.
Checking for container visibility was done in
ffa64c065ac8b28849395cf3e89fe93814252473, when maybe_load_more_content
would run on multiple containers. That was obsoleted in
4ad1947da490a998d68380b1520c4f95b1784676, when the function was
attached as an event handler to each container individually. Checking
for visibility is obsolete and can safely be removed.
diff --git a/apps/workbench/app/assets/javascripts/infinite_scroll.js b/apps/workbench/app/assets/javascripts/infinite_scroll.js
index 7bdf574..e97c9fc 100644
--- a/apps/workbench/app/assets/javascripts/infinite_scroll.js
+++ b/apps/workbench/app/assets/javascripts/infinite_scroll.js
@@ -18,7 +18,7 @@ function maybe_load_more_content(event) {
$container.attr('data-infinite-content-href'));
}
src = $container.attr('data-infinite-content-href');
- if (!src || !$container.is(':visible'))
+ if (!src)
// Finished
return;
diff --git a/apps/workbench/test/integration/projects_test.rb b/apps/workbench/test/integration/projects_test.rb
index 97e1a54..e5aa791 100644
--- a/apps/workbench/test/integration/projects_test.rb
+++ b/apps/workbench/test/integration/projects_test.rb
@@ -744,4 +744,15 @@ class ProjectsTest < ActionDispatch::IntegrationTest
assert match, 'Expected project name not found'
assert_text 'No description provided'
end
+
+ test "first tab loads data when visiting other tab directly" do
+ # As of 2014-12-19, the first tab of project#show uses infinite scrolling.
+ # Make sure that it loads data even if we visit another tab directly.
+ project = api_fixture("groups", "aproject")
+ visit(page_with_token("active_trustedclient",
+ "/projects/#{project['uuid']}#Advanced"))
+ assert_text("API response")
+ find("#page-wrapper .nav-tabs :first-child a").click
+ assert_text("bytes Collection")
+ end
end
diff --git a/apps/workbench/test/integration_helper.rb b/apps/workbench/test/integration_helper.rb
index febcfcf..2cf6bca 100644
--- a/apps/workbench/test/integration_helper.rb
+++ b/apps/workbench/test/integration_helper.rb
@@ -32,9 +32,11 @@ class ActionDispatch::IntegrationTest
# fixture, or passed as a raw string.
api_token = ((@@API_AUTHS.include? token) ?
@@API_AUTHS[token]['api_token'] : token)
- sep = (path.include? '?') ? '&' : '?'
+ path_parts = path.partition("#")
+ sep = (path_parts.first.include? '?') ? '&' : '?'
q_string = URI.encode_www_form('api_token' => api_token)
- "#{path}#{sep}#{q_string}"
+ path_parts.insert(1, "#{sep}#{q_string}")
+ path_parts.join("")
end
# Find a page element, but return false instead of raising an
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list