diff --git a/docs/_static/link_gen/link.js b/docs/_static/link_gen/link.js index bf6ec4de..cacb9cb7 100644 --- a/docs/_static/link_gen/link.js +++ b/docs/_static/link_gen/link.js @@ -43,7 +43,7 @@ function generateCanvasUrl(hubUrl, urlPath, repoUrl, branch) { return url.toString(); } -function generateMyBinderUrl(hubUrl, userName, repoName, branch, urlPath, +function generateBinderUrl(hubUrl, userName, repoName, branch, urlPath, contentRepoUrl, contentRepoBranch) { var url = new URL(hubUrl); @@ -93,7 +93,7 @@ function changeTab(div) { var content_branch = document.getElementById("content-branch-group"); var id = div.id; - if (id.includes("mybinder")) { + if (id.includes("binder")) { hub.placeholder = "https://mybinder.org"; hub.value = "https://mybinder.org"; hub_help_text.hidden = true; @@ -146,7 +146,7 @@ function displayLink() { document.getElementById('canvas-link').value = generateCanvasUrl( hubUrl, urlPath, repoUrl, branch ); - document.getElementById('mybinder-link').value = generateMyBinderUrl( + document.getElementById('binder-link').value = generateBinderUrl( hubUrl, userName, repoName, branch, urlPath, contentRepoUrl, contentRepoBranch ); } @@ -219,8 +219,18 @@ function main() { populateFromQueryString(); + // Activate tabs based on search parameters + var params = new URL(window.location).searchParams; + if (params.get("tab")) { + if (params.get("tab") === "binder") { + $("#tab-auth-binder").click() + } else if (params.get("tab") === "canvas") { + $("#tab-auth-canvas").click() + } + } + // Do an initial render, to make sure our disabled / enabled properties are correctly set render(); } -window.onload = main; \ No newline at end of file +window.onload = main; diff --git a/docs/link.rst b/docs/link.rst index cf2d9fa3..49312918 100644 --- a/docs/link.rst +++ b/docs/link.rst @@ -13,7 +13,7 @@ Use the following form to create your own ``nbgitpuller`` links. @@ -35,8 +35,8 @@ Use the following form to create your own ``nbgitpuller`` links.
-
- +
+
@@ -163,3 +163,12 @@ For example, the following URL will pre-populate the form with the UC Berkeley DataHub as the JupyterHub:: https://jupyterhub.github.io/nbgitpuller/link?hub=https://datahub.berkeley.edu + + +**Activating a tab when someone lands on this page** + +You can also activate one of the tabs in the form above by default when a user lands +on this page. To do so, use the ``tab=`` REST parameter. Here are the possible values: + +* ``?tab=binder`` - activates the Binder tab +* ``?tab=canvas`` - activates the Canvas tab.