From 201a37e8d3d0ef4c59b184c0707ec8ddd301a25a Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Fri, 9 Apr 2021 18:50:55 -0400 Subject: spruced up templates, some repo impl --- src/templates/base.hbs | 155 ++++++++++++++++++++++++++++++++++++++++++ src/templates/index.hbs | 74 ++++++++++++++++++++ src/templates/index.html | 85 ----------------------- src/templates/login.hbs | 7 ++ src/templates/login.html | 6 -- src/templates/mod.rs | 25 ++++--- src/templates/suggestions.hbs | 9 +++ 7 files changed, 261 insertions(+), 100 deletions(-) create mode 100644 src/templates/base.hbs create mode 100644 src/templates/index.hbs delete mode 100644 src/templates/index.html create mode 100644 src/templates/login.hbs delete mode 100644 src/templates/login.html create mode 100644 src/templates/suggestions.hbs (limited to 'src/templates') diff --git a/src/templates/base.hbs b/src/templates/base.hbs new file mode 100644 index 0000000..df3ba9d --- /dev/null +++ b/src/templates/base.hbs @@ -0,0 +1,155 @@ + + + + + + + + + + + {{~> body}} + + + diff --git a/src/templates/index.hbs b/src/templates/index.hbs new file mode 100644 index 0000000..6bd539b --- /dev/null +++ b/src/templates/index.hbs @@ -0,0 +1,74 @@ +{{#> base}} +{{#*inline "navItem"}} +
  • + +
  • +{{/inline}} +{{#*inline "body"}} + + +
    +
    + {{#if selected_make}} + + {{/if}} + {{#if selected_model}} + + {{/if}} + +
    +
    + +
    + + + {{#each parts}} + + + + {{/each}} + +
    {{ this }}
    +
    +{{/inline}} +{{/base}} diff --git a/src/templates/index.html b/src/templates/index.html deleted file mode 100644 index 4663f5d..0000000 --- a/src/templates/index.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - -
    -
    - - - - -
    - - {{#each parts}} - - - - {{/each}} -
    {{ this }}
    -
    - - diff --git a/src/templates/login.hbs b/src/templates/login.hbs new file mode 100644 index 0000000..84b354b --- /dev/null +++ b/src/templates/login.hbs @@ -0,0 +1,7 @@ +{{#> base}} +{{#*inline "body"}} + + Login with Google + +{{/inline}} +{{/base}} diff --git a/src/templates/login.html b/src/templates/login.html deleted file mode 100644 index 9329a22..0000000 --- a/src/templates/login.html +++ /dev/null @@ -1,6 +0,0 @@ - - - - Login with Google - - diff --git a/src/templates/mod.rs b/src/templates/mod.rs index 3a6eb2b..534ada0 100644 --- a/src/templates/mod.rs +++ b/src/templates/mod.rs @@ -1,9 +1,16 @@ -pub static INDEX_T: &str = include_str!("index.html"); -pub static LOGIN_T: &str = include_str!("login.html"); -pub const CATALOG_L: &str = "/#menu"; -pub const PARTS_L: &str = "/parts"; -pub const PARTS_CSV_L: &str = "/parts.csv"; -pub const CARS_L: &str = "/cars"; -pub const CARS_CSV_L: &str = "/cars.csv"; -pub const SUGGESTIONS_L: &str = "/suggestions"; -pub const LOGIN_L: &str = "/login"; +use handlebars::Handlebars; +use once_cell::sync::Lazy; + +pub static REGISTRY: Lazy = Lazy::new(|| { + let mut handlebars = Handlebars::new(); + handlebars + .register_template_string("index", include_str!("index.hbs")) + .unwrap(); + handlebars + .register_template_string("login", include_str!("login.hbs")) + .unwrap(); + handlebars + .register_template_string("base", include_str!("base.hbs")) + .unwrap(); + handlebars +}); diff --git a/src/templates/suggestions.hbs b/src/templates/suggestions.hbs new file mode 100644 index 0000000..f979be7 --- /dev/null +++ b/src/templates/suggestions.hbs @@ -0,0 +1,9 @@ +{{#> base}} +{{#*inline "body"}} +
    +
    + +
    +
    +{{/inline}} +{{/base}} -- cgit v1.2.3