mirror of
https://github.com/deps-rs/deps.rs.git
synced 2024-11-23 18:56:30 +00:00
Fix form submission (#189)
This commit is contained in:
parent
6e25ce930d
commit
c840d04789
2 changed files with 8 additions and 4 deletions
6
assets/links.js
vendored
6
assets/links.js
vendored
|
@ -28,6 +28,8 @@ function buildRepoLink() {
|
||||||
} else {
|
} else {
|
||||||
window.location.assign(`/repo/${hoster}/${owner}/${repoName}${qparams}`);
|
window.location.assign(`/repo/${hoster}/${owner}/${repoName}${qparams}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildCrateLink() {
|
function buildCrateLink() {
|
||||||
|
@ -36,10 +38,12 @@ function buildCrateLink() {
|
||||||
let crate = formRef.elements["crateName"].value;
|
let crate = formRef.elements["crateName"].value;
|
||||||
let crateVer = formRef.elements["crateVersion"].value;
|
let crateVer = formRef.elements["crateVersion"].value;
|
||||||
|
|
||||||
if (crateVer.length == 0) {
|
if (crateVer.length === 0) {
|
||||||
// default to latest version
|
// default to latest version
|
||||||
window.location.assign(`/crate/${crate}`);
|
window.location.assign(`/crate/${crate}`);
|
||||||
} else {
|
} else {
|
||||||
window.location.assign(`/crate/${crate}/${crateVer}`);
|
window.location.assign(`/crate/${crate}/${crateVer}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ fn link_forms() -> Markup {
|
||||||
p class="help" id="baseUrlHelp" { "Path within the repository where the " code { "Cargo.toml" } " file is located." }
|
p class="help" id="baseUrlHelp" { "Path within the repository where the " code { "Cargo.toml" } " file is located." }
|
||||||
}
|
}
|
||||||
|
|
||||||
input type="submit" class="button is-primary" value="Check" onclick="buildRepoLink();";
|
input type="submit" class="button is-primary" value="Check" onclick="return buildRepoLink();";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ fn link_forms() -> Markup {
|
||||||
label class="label" { "Crate Name" }
|
label class="label" { "Crate Name" }
|
||||||
|
|
||||||
div class="control" {
|
div class="control" {
|
||||||
input class="input" type="text" id="crateName" placeholder="serde-derive" required;
|
input class="input" type="text" id="crateName" placeholder="serde" required;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ fn link_forms() -> Markup {
|
||||||
p class="help" { "If left blank, defaults to the latest version." }
|
p class="help" { "If left blank, defaults to the latest version." }
|
||||||
}
|
}
|
||||||
|
|
||||||
input type="submit" class="button is-primary" value="Check" onclick="buildCrateLink();";
|
input type="submit" class="button is-primary" value="Check" onclick="return buildCrateLink();";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue