Skip to content

Commit

Permalink
Merge pull request #169 from whole-tale/ainwt_form
Browse files Browse the repository at this point in the history
Add a simple form for AinWT
  • Loading branch information
Xarthisius committed May 26, 2022
2 parents 830c1e3 + f768dde commit ff8e5c8
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
1 change: 1 addition & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_extra_path = ["extras"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand Down
75 changes: 75 additions & 0 deletions extras/ainwt.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">

<title>Analyze in Whole Tale</title>
</head>
<body>
<h1>Import Dataset to Whole Tale</h1>
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<form>
<div class="mb-3">
<label for="repositorySelect" class="form-label">Choose repository type</label>
<select class="form-select" aria-label="Select Data Repository type" id="repositorySelect">
<option value="zenodo">Zenodo</option>
<option value="dataverse">Dataverse</option>
</select>
</div>
<div class="mb-3">
<label for="baseUrl" class="form-label">Base Repository URL</label>
<input type="text" class="form-control" id="baseUrl">
<div id="doiHelp" class="form-text">Base URL for accessing data repository e.g.
https://dataverse.scholarsportal.info/ or https://sandbox.zenodo.org/
</div>
</div>
<div class="mb-3">
<label for="doi" class="form-label">Dataset identifier</label>
<input type="text" class="form-control" id="doi">
<div id="doiHelp" class="form-text">The Persistent ID (DOI or Handle) of the dataset (for example,
doi:10.7910/DVN/TJCLKP) or repository specific identifier (e.g. zenodo record id).</div>
</div>
<a href="#link" class="btn btn-primary" role="button" id="launcher">Launch Tale</a>
</form>
</div>
</div>
</div>
<script>
function updateHref(){
var hrefUrl = "https://girder.wholetale.org/api/v1/integration/";
var repo = document.forms[0].repositorySelect.value.trim();
var doi = document.forms[0].doi.value.trim();
var url = document.forms[0].baseUrl.value.trim();
if (repo === "dataverse") {
hrefUrl = hrefUrl + repo + "?siteUrl=" + encodeURIComponent(url);
if (doi.startsWith("doi:")) {
hrefUrl = hrefUrl + "&datasetPid=" + encodeURIComponent(doi);
} else {
hrefUrl = hrefUrl + "&datasetId=" + encodeURIComponent(doi);
}
} else {
hrefUrl = hrefUrl + repo + "?resource_server=" + encodeURIComponent(url);
if (doi.startsWith("doi:")) {
hrefUrl = hrefUrl + "&doi=" + encodeURIComponent(doi);
} else {
hrefUrl = hrefUrl + "&record_id=" + encodeURIComponent(doi);
}
}
var link = document.getElementById("launcher");
link.href = hrefUrl;
}
document.getElementById("repositorySelect").onchange = updateHref;
document.getElementById("doi").onchange = updateHref;
document.getElementById("baseUrl").onchange = updateHref;
updateHref();
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</body>
</html>

0 comments on commit ff8e5c8

Please sign in to comment.