summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs1
-rw-r--r--src/templates/index.html41
2 files changed, 20 insertions, 22 deletions
diff --git a/src/main.rs b/src/main.rs
index 6947482..2f5bdf4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -39,7 +39,6 @@ async fn router(req: Request<Body>) -> Result<Response<Body>, Infallible> {
async fn parts(req: Request<Body>) -> Result<Response<Body>, Infallible> {
let query = req.uri().query().unwrap_or_default();
let filter = serde_urlencoded::de::from_str::<PartsRequest>(query).unwrap();
- dbg!(&query, &filter);
let mut reg = Handlebars::new();
reg.register_template_string("index", templates::INDEX_T)
.unwrap();
diff --git a/src/templates/index.html b/src/templates/index.html
index 6b2f54a..683891c 100644
--- a/src/templates/index.html
+++ b/src/templates/index.html
@@ -11,28 +11,27 @@
</head>
<body>
<h1>Parts Catalog</h1>
+ {{#each makes}}
<form action="/parts">
- <ul>
- {{#each makes}}
- <li>
- <input type="submit" name="make" value="{{ this }}" />
- {{#if (eq this "Hudson")}}
- <ul>
- <input type="hidden" name="make" value="{{ selected_make }}" />
- {{#each models}}
- <li>
- <input type="submit" name="model" value="{{ this }}" />
- </li>
- {{else}}
- No models found.
- {{/each}}
- </ul>
- {{/if}}
- </li>
- {{else}}
- No makes found.
- {{/each}}
- </ul>
+ {{#if (eq this ../selected_make)}}
+ <input disabled type="submit" name="make" value="{{ this }}" />
+ <input type="hidden" name="make" value="{{ ../selected_make }}" />
+ {{#each ../models}}
+ {{#if (eq this ../../selected_model)}}
+ <input disabled type="submit" name="model" value="{{ this }}" />
+ Parts for {{ this }}
+ {{else}}
+ <input type="submit" name="model" value="{{ this }}" />
+ {{/if}}
+ {{else}}
+ No models found.
+ {{/each}}
+ {{else}}
+ <input type="submit" name="make" value="{{ this }}" />
+ {{/if}}
</form>
+ {{else}}
+ No makes found.
+ {{/each}}
</body>
</html>