From 1d422d90f8d923ea8644a65d37de7d2948f1ddc4 Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Fri, 21 Jun 2024 02:42:38 +0530 Subject: * Removes HTMX - Will be covering in the future * Adds 404, about, contact, timeline * Updates layout - removes HTMX, cleanup macros * Update template renderer macro to accept page title --- src/indrajith-dev-crystal.cr | 39 +++++++++++-------- src/views/404.ecr | 2 + src/views/about.ecr | 28 ++++++++++++++ src/views/contact.ecr | 11 ++++++ src/views/home.ecr | 2 +- src/views/layout.ecr | 21 ++++++----- src/views/timeline.ecr | 89 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 166 insertions(+), 26 deletions(-) create mode 100644 src/views/404.ecr create mode 100644 src/views/about.ecr create mode 100644 src/views/contact.ecr create mode 100644 src/views/timeline.ecr (limited to 'src') diff --git a/src/indrajith-dev-crystal.cr b/src/indrajith-dev-crystal.cr index 28948cf..ca600f1 100644 --- a/src/indrajith-dev-crystal.cr +++ b/src/indrajith-dev-crystal.cr @@ -3,26 +3,35 @@ require "kemal" module Indrajith::Dev::Crystal VERSION = "0.1.0" - macro page_renderer(filename) + macro page_renderer(filename, title) + page_title = {{title}} render "src/views/#{{{filename}}}.ecr", "src/views/layout.ecr" end - def self.htmx_request?(context) - context.request.headers.has_key?("HX-Request") || - context.request.headers.has_key?("Hx-Request") || - context.request.headers.has_key?("hx-request") + get "/" do |context| + context.response.content_type = "text/html" + page_renderer "home", "Home" end - get "/" do |context| - if htmx_request?(context) - partial_content = render("src/views/home.ecr") - context.response.content_type = "text/html" - context.response.print partial_content - else - context.response.content_type = "text/html" - page_renderer "home" - end + get "/about" do |context| + context.response.content_type = "text/html" + page_renderer "about", "About " end - + + get "/timeline" do |context| + context.response.content_type = "text/html" + page_renderer "timeline", "Timeline" + end + + get "/contact" do |context| + context.response.content_type = "text/html" + page_renderer "contact", "Contact" + end + + error 404 do |context| + context.response.content_type = "text/html" + page_renderer "404", "The VOID" + end + Kemal.run end diff --git a/src/views/404.ecr b/src/views/404.ecr new file mode 100644 index 0000000..4a3cb6d --- /dev/null +++ b/src/views/404.ecr @@ -0,0 +1,2 @@ +
+ My Name is Indrajith K L, a Web Developer currently working as a Technical Architect with 9+ years of experience in various frontend frameworks and libraries like +
+ + , + , + , + , + etc. ++ Fluent in +
+ + , + , + & . Started out as an Android Developer in 2012, and then switched to Web Development and now focusing on frontend & other web technologies. +