From 1259dad8d561bd390262314035d5252905d1c12e Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Tue, 23 Feb 2021 17:37:08 -0500 Subject: basic make/model/parts list flow functional --- src/main.rs | 1 - src/templates/index.html | 41 ++++++++++++++++++++--------------------- 2 files changed, 20 insertions(+), 22 deletions(-) (limited to 'src') 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) -> Result, Infallible> { async fn parts(req: Request) -> Result, Infallible> { let query = req.uri().query().unwrap_or_default(); let filter = serde_urlencoded::de::from_str::(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 @@

Parts Catalog

+ {{#each makes}}
-
    - {{#each makes}} -
  • - - {{#if (eq this "Hudson")}} -
      - - {{#each models}} -
    • - -
    • - {{else}} - No models found. - {{/each}} -
    - {{/if}} -
  • - {{else}} - No makes found. - {{/each}} -
+ {{#if (eq this ../selected_make)}} + + + {{#each ../models}} + {{#if (eq this ../../selected_model)}} + + Parts for {{ this }} + {{else}} + + {{/if}} + {{else}} + No models found. + {{/each}} + {{else}} + + {{/if}}
+ {{else}} + No makes found. + {{/each}} -- cgit v1.2.3