From b77c35fce1ed96dd42ff8e25b7d653539cb372f2 Mon Sep 17 00:00:00 2001 From: Chris Holdgraf Date: Mon, 29 Jun 2020 09:29:32 -0700 Subject: [PATCH] tab activation on link generator --- docs/_static/link_gen/link.js | 8 ++++---- docs/link.rst | 31 ++++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/docs/_static/link_gen/link.js b/docs/_static/link_gen/link.js index bf6ec4de..96737d17 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 ); } @@ -223,4 +223,4 @@ function main() { 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..3e9fdb56 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.
-
- +
+
@@ -148,6 +148,18 @@ Use the following form to create your own ``nbgitpuller`` links.


+ + + **Pre-populating some fields in the link generator** @@ -163,3 +175,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.