Prepare for test creation
This commit is contained in:
parent
3c7df632a4
commit
6dc460b478
@ -4,9 +4,9 @@ use rocket::*;
|
|||||||
use rocket_dyn_templates::{Template, context};
|
use rocket_dyn_templates::{Template, context};
|
||||||
|
|
||||||
#[get("/create")]
|
#[get("/create")]
|
||||||
fn create() -> &'static str
|
fn create() -> Template
|
||||||
{
|
{
|
||||||
"Hello, world!"
|
Template::render("create", context!{})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/about")]
|
#[get("/about")]
|
||||||
|
44
templates/create.html.tera
Normal file
44
templates/create.html.tera
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{% extends "base" %}
|
||||||
|
{% block title %}{% endblock %}
|
||||||
|
{% block body %}
|
||||||
|
<div class="hero h-fit">
|
||||||
|
<div class="hero-content flex-col text-center mt-48">
|
||||||
|
<h1 class="text-5xl font-bold">Crea tu propio test</h1>
|
||||||
|
<form class="card flex-shrink-0 w-full max-w-sm shadow-2xl bg-base-200 mt-6" id="signup-form"
|
||||||
|
action="/auth/register" method="post">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="form-control">
|
||||||
|
<label class="label">
|
||||||
|
<span class="label-text">Nombre</span>
|
||||||
|
</label>
|
||||||
|
<input type="text" name="username" id="username" placeholder="Entra tu nombre..." class="input input-bordered" />
|
||||||
|
</div>
|
||||||
|
<div class="form-control mt-6">
|
||||||
|
<input type="submit" class="btn btn-primary btn-disabled" id="continue-btn" value="Empezar"
|
||||||
|
disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
function debounce(callback, wait) {
|
||||||
|
let timeout;
|
||||||
|
return (...args) => {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
timeout = setTimeout(function () { callback.apply(this, args); }, wait);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
document.querySelector("#username").onkeyup = debounce(() => {
|
||||||
|
if(document.querySelector("#username").value.length != 0)
|
||||||
|
{
|
||||||
|
document.querySelector("#continue-btn").classList.remove("btn-disabled");
|
||||||
|
document.querySelector("#continue-btn").removeAttribute("disabled");
|
||||||
|
} else {
|
||||||
|
document.querySelector("#continue-btn").classList.add("btn-disabled");
|
||||||
|
document.querySelector("#continue-btn").disabled = true;
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user