From 944ba749c1f7ce257fa41118f2e10aaf934a8723 Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Thu, 15 May 2025 21:33:55 -0400 Subject: feat: k12 content, card formatting, begin style changes --- src/handlers.rs | 31 +++-- src/main.rs | 38 +++--- src/middleware/cache_control.rs | 2 +- src/posts/fs_post.rs | 2 +- src/views.rs | 1 + src/views/k12.rs | 6 + static/desktop.css | 17 +-- templates/card.html | 14 ++ templates/index.html | 51 +++++--- templates/k12.html | 278 ++++++++++++++++++++++++++++++++++++++++ templates/styles.css | 18 ++- 11 files changed, 395 insertions(+), 63 deletions(-) create mode 100644 src/views/k12.rs create mode 100644 templates/card.html create mode 100644 templates/k12.html diff --git a/src/handlers.rs b/src/handlers.rs index 800d8f8..43d31fd 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -1,15 +1,16 @@ -use askama::Template; -use crate::views::post::PostView; -use crate::views::posts::PostsView; use crate::posts::abstractions::repo::PostRepo; -use crate::views::policies::PoliciesTemplate; -use crate::views::index::IndexTemplate; -use crate::views::brochure::BrochureTemplate; -use crate::views::about::AboutView; use crate::tutors::abstractions::tutor_repo::TutorRepo; -use std::sync::Arc; +use crate::views::about::AboutView; +use crate::views::brochure::BrochureTemplate; +use crate::views::index::IndexTemplate; +use crate::views::k12::K12Template; +use crate::views::policies::PoliciesTemplate; +use crate::views::post::PostView; +use crate::views::posts::PostsView; +use askama::Template; +use axum::extract::{Path, State}; use axum::response::Html; -use axum::extract::{State, Path}; +use std::sync::Arc; pub async fn about_handler(State(repo): State>) -> Html { let view = AboutView::with_tutors(repo.load()); @@ -17,7 +18,7 @@ pub async fn about_handler(State(repo): State>) -> Html Html { - Html(BrochureTemplate{}.render().unwrap()) + Html(BrochureTemplate {}.render().unwrap()) } pub async fn index_handler() -> Html { @@ -25,7 +26,7 @@ pub async fn index_handler() -> Html { } pub async fn policies_handler() -> Html { - Html(PoliciesTemplate{}.render().unwrap()) + Html(PoliciesTemplate {}.render().unwrap()) } pub async fn posts_handler(State(repo): State>) -> Html { @@ -33,8 +34,14 @@ pub async fn posts_handler(State(repo): State>) -> Html, State(repo): State>) -> Html { +pub async fn post_handler( + Path(post_id): Path, + State(repo): State>, +) -> Html { let view = PostView::with_post(repo.by_id(&post_id)); Html(view.render().unwrap()) } +pub async fn k12_handler() -> Html { + Html(K12Template {}.render().unwrap()) +} diff --git a/src/main.rs b/src/main.rs index 372915b..57b0256 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,20 +1,23 @@ +use axum::{extract::Request, routing::get, Router, ServiceExt}; +use middleware::cache_control::cache_static; +use posts::fs_post_repo::FsPostRepo; +use std::{env, sync::Arc}; use tower::Layer; -use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter}; -use tower_http::{trace::{self, TraceLayer}, normalize_path::NormalizePathLayer}; +use tower_http::services::ServeDir; +use tower_http::{ + normalize_path::NormalizePathLayer, + trace::{self, TraceLayer}, +}; use tracing::{info, Level}; -use axum::{routing::get, Router, ServiceExt, extract::Request}; +use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter}; use tutors::fs_tutor_repo::FsTutorRepo; -use std::{sync::Arc, env}; -use tower_http::services::ServeDir; -use posts::fs_post_repo::FsPostRepo; -use middleware::cache_control::cache_static; +mod handlers; mod helpers; +mod middleware; mod posts; mod tutors; mod views; -mod handlers; -mod middleware; #[tokio::main] async fn main() { @@ -28,9 +31,9 @@ async fn main() { .init(); info!("loading state..."); - let blog_dir = env::var("CT_POSTS").unwrap(); - let tutor_dir = env::var("CT_TEAM").unwrap(); - let assets_dir = env::var("CT_ASSETS").unwrap(); + let blog_dir = env::var("CT_POSTS").unwrap_or(String::from("/var/ct/posts")); + let tutor_dir = env::var("CT_TEAM").unwrap_or(String::from("/var/ct/team")); + let assets_dir = env::var("CT_ASSETS").unwrap_or(String::from("/var/ct/assets")); let posts = Arc::new(FsPostRepo::with_dir(blog_dir)); let tutors = Arc::new(FsTutorRepo::with_dir(tutor_dir.clone())); @@ -44,6 +47,7 @@ async fn main() { .route("/policies", get(handlers::policies_handler)) .route("/brochure", get(handlers::brochure_handler)) .route("/about", get(handlers::about_handler)) + .route("/k12", get(handlers::k12_handler)) .with_state(tutors) .nest_service("/assets", ServeDir::new(assets_dir)) .nest_service("/team", ServeDir::new(tutor_dir)) @@ -51,14 +55,14 @@ async fn main() { .layer(axum::middleware::from_fn(cache_static)) .layer( TraceLayer::new_for_http() - .make_span_with(trace::DefaultMakeSpan::new() - .level(Level::INFO)) - .on_response(trace::DefaultOnResponse::new() - .level(Level::INFO)) + .make_span_with(trace::DefaultMakeSpan::new().level(Level::INFO)) + .on_response(trace::DefaultOnResponse::new().level(Level::INFO)), ); let app = NormalizePathLayer::trim_trailing_slash().layer(app); let addr = env::var("CT_BIND").unwrap_or("0.0.0.0:8000".into()); let listener = tokio::net::TcpListener::bind(addr).await.unwrap(); - axum::serve(listener, ServiceExt::::into_make_service(app)).await.unwrap(); + axum::serve(listener, ServiceExt::::into_make_service(app)) + .await + .unwrap(); } diff --git a/src/middleware/cache_control.rs b/src/middleware/cache_control.rs index 30f31ca..0f11924 100644 --- a/src/middleware/cache_control.rs +++ b/src/middleware/cache_control.rs @@ -3,7 +3,7 @@ use axum::http::header::{HeaderValue, CACHE_CONTROL}; use axum::middleware::Next; use axum::response::Response; -pub async fn cache_static(mut request: Request, next: Next) -> Response { +pub async fn cache_static(request: Request, next: Next) -> Response { let was_static = request.uri().path().starts_with("/assets"); let mut response = next.run(request).await; diff --git a/src/posts/fs_post.rs b/src/posts/fs_post.rs index a1de678..4fc03b2 100644 --- a/src/posts/fs_post.rs +++ b/src/posts/fs_post.rs @@ -26,7 +26,7 @@ impl Post for FsPost { let article = self.get_article(); Cow::Owned( article - .split_once("\n") + .split_once('\n') .map(|(first, _)| first) .unwrap_or_default() .trim_start_matches('_') diff --git a/src/views.rs b/src/views.rs index cb58813..e9f1951 100644 --- a/src/views.rs +++ b/src/views.rs @@ -1,6 +1,7 @@ pub mod about; pub mod brochure; pub mod index; +pub mod k12; pub mod policies; pub mod post; pub mod posts; diff --git a/src/views/k12.rs b/src/views/k12.rs new file mode 100644 index 0000000..eb9725f --- /dev/null +++ b/src/views/k12.rs @@ -0,0 +1,6 @@ +use crate::helpers::*; +use askama::Template; + +#[derive(Template)] +#[template(path = "k12.html")] +pub struct K12Template; diff --git a/static/desktop.css b/static/desktop.css index 7a20b0a..cfe5b73 100644 --- a/static/desktop.css +++ b/static/desktop.css @@ -17,11 +17,9 @@ .banner { padding-top: 7em; text-align: right; - background: linear-gradient( - to right, - rgba(255, 255, 255, 0) 0%, - rgba(255, 255, 255, 1) 50% - ); + background: linear-gradient(to right, + rgba(255, 255, 255, 0) 0%, + rgba(255, 255, 255, 1) 50%); } form { @@ -66,14 +64,7 @@ padding: 2em; } - #reviews .card, - #offerings .card { - display: block; - flex: none; - width: 20%; - } - .modal .card { width: 25%; } -} +} \ No newline at end of file diff --git a/templates/card.html b/templates/card.html new file mode 100644 index 0000000..1397bc8 --- /dev/null +++ b/templates/card.html @@ -0,0 +1,14 @@ +
+

+ {% block title %} + Card Title + {% endblock %} +

+ +

+ {% block content %} + Stuff in the card + {% endblock %} +

+ +
\ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 72b0892..a98fa29 100644 --- a/templates/index.html +++ b/templates/index.html @@ -29,7 +29,8 @@ student services without creating financial strain.

- I invite you to explore and learn more about the services we offer, Carpenter Tutoring's background, + I invite you to explore and learn more about the services we offer, Carpenter Tutoring's background, and some of our policies. Thank you for visiting, and please do not hesitate to reach out with any questions. We will be thrilled to assist you! @@ -222,7 +223,8 @@

Subject Tutoring

Tutoring for specific courses or disciplines

- expand Learn more + expand Learn more
@@ -231,13 +233,15 @@ Personalized plans for managing academics, extracurriculars, and other commitments

- expand Learn more + expand Learn more

Study Skills

Learn how to make the most of your study time

- expand Learn more + expand Learn more
@@ -246,7 +250,8 @@ Time management and study skills blended with continuing accountability

- expand Learn more + expand Learn more
@@ -255,19 +260,22 @@ Assistance with generating a college list and crafting application essays

- expand Learn more + expand Learn more

College-Level Writing

Get a head start on meeting professors' expectations

- expand Learn more + expand Learn more

Dissertation Coaching

Ensure your research is communicated effectively and eloquently

- expand Learn more + expand Learn more
@@ -275,13 +283,15 @@

Tailored assistance in preparing for a variety of standardized tests

- expand Learn more + expand + Learn more

Music Lessons

Piano and/or composition lessons for students of all ages

- expand Learn more + expand Learn more
@@ -291,7 +301,8 @@ looking to satisfy Proof of Progress or gain insight into their child's learning

- expand Learn more + expand + Learn more
@@ -300,7 +311,8 @@

Helpful Links

View an interactive brochure of our offerings - See policies and procedures regarding scheduling, payment, and booking + See policies and procedures regarding scheduling, payment, and + booking
@@ -309,7 +321,10 @@

C.L. Cannon

- I hired Amy to complete an end-of-the-year evaluation for both of my Elementary aged sons. This being our first year of independent home instruction, the task of testing and/or evaluation was daunting! Amy put my fears to rest! She was super easy to work with, had great communication skills, and answered all my questions in a timely and informative manner! I would highly recommend her services! + I hired Amy to complete an end-of-the-year evaluation for both of my Elementary aged sons. This being our + first year of independent home instruction, the task of testing and/or evaluation was daunting! Amy put my + fears to rest! She was super easy to work with, had great communication skills, and answered all my + questions in a timely and informative manner! I would highly recommend her services!

View on Google @@ -326,7 +341,8 @@

Lee Crabtree

- Amy is a wonderful tutor who helped my child (who does not like help at all) though some difficult classes where the teacher was not providing the support my child needed. Highly recommended. + Amy is a wonderful tutor who helped my child (who does not like help at all) though some difficult classes + where the teacher was not providing the support my child needed. Highly recommended.

View on Google @@ -343,7 +359,10 @@

Connor Fenton

- I was a Graduate student at the College of William and Mary who needed to pass a Latin Language test as part of my degree requirements. I was struggling with refreshing my Latin after a few years out of the classroom and Amy was both professional and helpful. With her tutoring I was able to pass my test and finish my degree. She is very considerate and easy to work with. + I was a Graduate student at the College of William and Mary who needed to pass a Latin Language test as part + of my degree requirements. I was struggling with refreshing my Latin after a few years out of the classroom + and Amy was both professional and helpful. With her tutoring I was able to pass my test and finish my + degree. She is very considerate and easy to work with.

View on Google @@ -358,4 +377,4 @@

-{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/templates/k12.html b/templates/k12.html new file mode 100644 index 0000000..449b4b6 --- /dev/null +++ b/templates/k12.html @@ -0,0 +1,278 @@ +{% extends "base.html" %} + +{% block main %} + +
+

K-12 Services

+
+ + + +
+

See your student thrive with personalized support.

+
+ +
+
+

+ Jump to K-12 Services +

+
+ + + + + + + + + + + + +
+ +
+

+ Academic Coaching +

+ +

+ Academic Coaching teaches and models the skills students need for success through graduation and beyond. We work + together to create and execute realistic plans to handle the responsibilities of each week. Tailored to each + student's individual needs, Academic Coaching provides students with a partner in navigating both academic and + personal responsibilities with the goal of increasing confidence, autonomy, and self-sufficiency. Topics include + but are not limited to + +

    +
  • Time and stress management
  • +
  • Task prioritization
  • +
  • Organization
  • +
  • Effective studio techniques
  • +
  • Note-taking
  • +
  • Motivation
  • +
  • Procrastination
  • +
  • Self-advocacy
  • +
  • Communication
  • +
+

+
+ +
+ + +
+ +
+

+ Application Essay Consulting +

+ +

+ Whether you're applying to competitive high schools or getting ready for college, the essay is an important part + of any application. From picking a topic to telling your story to editing a final draft, you have a dedicated + and knowledgeable partner. Students remain in control during every stage of the writing process with the added + benefits of real-time feedback, guidance, and recommendations. Support for supplemental essays is also + available. +

+
+ +
+ +
+

+ College Transition +

+ +

+ When I worked at colleges, I saw talented students struggle, often because they hadn't solidified the skills + they'd need for success in college or hadn't had the opportunity to learn about the resources and services + available to them on campus. The College Transition offering provides students the toolkit of techniques and + tips they'll need and introduces relevant university services and resources before students arrive for + their first semester to ensure a smooth transition to college life. +

+
+ +
+ +
+

+ Services for Homeschoolers +

+ +

+ Carpenter Tutoring is proud to have service homeschooling communities in Virginia and North Carolina since 2019. +

+ +

+ We offer both supplemental and primary instruction for a range of age levels and subjects. In both cases, we are + happy to adapt to your curricular choices. Please see Subject Tutoring + for all subjects in which support is available. +

+ +

+ We also provide two levels of portfolio-based end-of-year Proof of Progress evaluations for families + homeschooling in Virginia. Simplified Evaluations consider math and language arts materials and satisfy + Virginia requirements with a personalized letter and evaluator credentials to be sent to the school system. + Detailed Evaluations include all the elements of Simplified Evaluations plus the option to add subjects + beyond math and language arts and a second letter intended for use only by families which identifies areas of + strength and weakness in the subjects provided and recommendations for moving forward. Please contact us for more information. +

+
+ +
+ +
+

+ Standardized Test Prep +

+ +

+ Individualized support in mastering both the content of and strategies for a number of standardized tests + including but not limited to +

    +
  • PSAT
  • +
  • SAT
  • +
  • ACT
  • +
  • SOLs
  • +
  • ISEE
  • +
  • SSAT
  • +
  • GED
  • +
  • ASVAB
  • +
+

+
+ +
+ +
+

+ Subject Tutoring +

+ +

+ Support offered for all applicable levels of courses (regular, Honors, AP) unless otherwise noted. + +

+

+ +
Math
+

+

    +
  • Elementary Math
  • +
  • Intermediate Math
  • +
  • Middle School Math
  • +
  • Pre-Algebra
  • +
  • Algebra I
  • +
  • Geometry
  • +
  • Algebra, Functions, and Data Analysis
  • +
  • Algebra 2
  • +
  • Algebra 3/Trigonometry
  • +
  • Probability and Statistics
  • +
  • Pre-Calculus
  • +
  • Calculus*
  • +
  • Personal Finance
  • +
+ + Support may be available for courses beyond those listed. Please contact us for more + information. +

+ +
Science
+

+

+ +
    +
  • Elementary Science
  • +
  • Intermediate Science
  • +
  • Middle School Science
  • +
  • Biology
  • +
  • Physics
  • +
  • Chemistry
  • +
  • Environmental Science
  • +
  • Earth Science
  • +
+

+ +
Foreign Language
+

+

    +
  • Latin I
  • +
  • Latin II
  • +
  • Latin III
  • +
  • Latin IV
  • +
  • Latin V
  • +
  • AP Latin IV
  • +
+ + Support may be available for courses and languages beyond those listed. Please contact + us for more information. +

+ +
Language Arts / English
+

+

    +
  • Elementary level
  • +
  • Intermediate level
  • +
  • Middle School level
  • +
  • English I or 9
  • +
  • English II or 10
  • +
  • English III or 11
  • +
  • English IV or 12
  • +
  • AP Language and Composition
  • +
  • AP Literature and Composition
  • +
  • Creative Writing
  • +
  • General writing / grammar support
  • +
  • Editing
  • +
+

+ +
Computer Science
+

+ Computer science course content and offerings vary widely by school. A professional software engineer is + available to discuss support options for specific needs. Please contact us for more + information. +

+
+ +{% endblock %} \ No newline at end of file diff --git a/templates/styles.css b/templates/styles.css index a0d9a80..887766d 100644 --- a/templates/styles.css +++ b/templates/styles.css @@ -36,7 +36,7 @@ nav { display: flex; flex-wrap: wrap; background-color: white; - position: fixed; + position: fixed; } nav img { @@ -161,6 +161,7 @@ section a { border-radius: 1em; margin-left: 0; margin-right: 0; + align-content: center; } form input, @@ -231,7 +232,14 @@ section.flexible { #reviews .card, #offerings .card { - margin: 1em; + margin-left: 1em; + margin-right: 1em; + margin-top: 0.5em; + margin-bottom: 0.5em; + font-size: 0.7em; + padding: 0.3em; + flex: 1 0 21%; + align-items: center; text-align: center; } @@ -244,6 +252,10 @@ section.flexible { justify-content: center; } +#offerings .full { + flex: 1 1 100%; +} + .modal { position: fixed; z-index: 1; @@ -281,4 +293,4 @@ section.flexible { .centered { text-align: center; justify-content: center; -} +} \ No newline at end of file -- cgit v1.2.3