Merge pull request 'ayushman' (#28) from ayushman into main

Reviewed-on: #28
This commit is contained in:
cereci5049 2024-08-15 22:48:09 +02:00
commit 38b746424d
2 changed files with 70 additions and 15 deletions

View file

@ -70,19 +70,23 @@ proc htmxSignup*(val: Table[string, Validity], message: string): string =
>
<label class="text-danger">{message}</label>
<div class="form-group mt-5">
<label for="email">First Name:</label>
<label class="text-danger"></label>
<div class="form-group mt-5"
hx-target="this"
hx-swap="outerHTML"
>
<label for="email">First Name:</label>
<label class="text-danger">{val["fn"].message}</label>
<input type="text" name="fn" class="form-control" required autocomplete="off">
</div>
<input type="text" name="fn" class="form-control {val["fn"].mark}" required autocomplete="off"
value="{val["fn"].name}"
hx-post="/htmx/fname"
>
<div class="form-group">
<label for="email">Last Name:</label>
<label class="text-danger"></label>
<label class="text-danger">{val["ln"].message}</label>
<input type="text" name="ln" class="form-control" required autocomplete="off">
<input type="text" name="ln" class="form-control {val["ln"].mark}" required autocomplete="off" value="{val["ln"].name}">
</div>
@ -96,9 +100,9 @@ proc htmxSignup*(val: Table[string, Validity], message: string): string =
<div class="form-group">
<label for="email">Phone:</label>
<label class="text-danger"></label>
<label class="text-danger">{val["ph"].message}</label>
<input type="email" name="ph" class="form-control" required autocomplete="off">
<input type="email" name="ph" class="form-control {val["ph"].mark}" required autocomplete="off" value="{val["ph"].name}">
</div>
@ -108,7 +112,7 @@ proc htmxSignup*(val: Table[string, Validity], message: string): string =
>
<label for="password">Password:</label>
<label class="text-danger"></label>
<input type="password" name="password" id="password" class="form-control" required autocomplete="off"
<input type="password" name="pw" id="password" class="form-control" required autocomplete="off"
value=""
hx-post="/htmx/password"
>
@ -120,4 +124,49 @@ proc htmxSignup*(val: Table[string, Validity], message: string): string =
<button id="b4" type="submit" class="btn btn-primary">Submit</button>
<a id="b4" href="/login" class="btn btn-outline-primary">Login</a>
<hr>
</form>"""
</form>"""
proc htmxFirstName*(firstName: string, input: Validity): string =
result = fmt"""
<div class="form-group mt-5"
hx-target="this"
hx-swap="outerHTML"
>
<label for="email">First Name:</label>
<label class="text-danger">{input.message}</label>
<input type="text" name="fn" class="form-control {input.mark}" required autocomplete="off"
value="{firstName}"
hx-post="/htmx/fname"
>
"""
proc htmxLastName*(lastName: string, input: Validity): string =
result = fmt"""
<div class="form-group mt-5"
hx-target="this"
hx-swap="outerHTML"
>
<label for="email">Last Name:</label>
<label class="text-danger">{input.message}</label>
<input type="text" name="ln" class="form-control {input.mark}" required autocomplete="off"
value="{lastName}"
hx-post="/htmx/lname"
>
"""
proc htmxPhone*(phone: string, input: Validity): string =
result = fmt"""
<div class="form-group mt-5"
hx-target="this"
hx-swap="outerHTML"
>
<label for="email">Phone:</label>
<label class="text-danger">{input.message}</label>
<input type="email" name="ph" class="form-control {input.mark}" required autocomplete="off"
value="{phone}"
hx-post="/htmx/phone"
>
"""

View file

@ -17,11 +17,17 @@
>
<label class="text-danger"></label>
<div class="form-group mt-5">
<div class="form-group mt-5"
hx-target="this"
hx-swap="outerHTML"
>
<label for="email">First Name:</label>
<label class="text-danger"></label>
<input type="text" name="fn" class="form-control" required autocomplete="off">
<input type="text" name="fn" class="form-control" required autocomplete="off"
value=""
hx-post="/htmx/fname"
>
</div>
@ -72,4 +78,4 @@
</div>
</div>
{% endblock %}
{% endblock %}