From a052c411ef3f591aaaf70fb0365d71bf3970631d Mon Sep 17 00:00:00 2001 From: cereci5049 Date: Sun, 11 Aug 2024 02:01:14 +0530 Subject: [PATCH] 038 --- hh1.nimble | 2 +- src/controller/signup.nim | 2 +- src/hh1.nim | 26 +++++++++++++------------- src/view/signup.nimja | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/hh1.nimble b/hh1.nimble index 8316f39..1789394 100644 --- a/hh1.nimble +++ b/hh1.nimble @@ -12,7 +12,7 @@ bin = @["hh1"] # Dependencies requires "nim >= 2.0.8" -requires "https://github.com/ire4ever1190/mike" +requires "https://github.com/ire4ever1190/mike >= 1.3.3" requires "nimja" requires "https://codeberg.org/13thab/turso-nim" requires "https://github.com/euantorano/dotenv.nim" \ No newline at end of file diff --git a/src/controller/signup.nim b/src/controller/signup.nim index f69d270..9d36a96 100644 --- a/src/controller/signup.nim +++ b/src/controller/signup.nim @@ -11,7 +11,7 @@ proc signup*(ctx: Context): string= var user1 = ctx.cookies.getOrDefault("user1", "none") user = to(parseJson(user1), User) - compileTemplateFile(getScriptDir() / "view" / "signup.nimja") + compileTemplateFile(".." / "view" / "signup.nimja", baseDir = getScriptDir()) elif ctx.httpMethod == HttpPost: var firstName = ctx.urlForm["fn"] diff --git a/src/hh1.nim b/src/hh1.nim index f8b7546..f0881a5 100644 --- a/src/hh1.nim +++ b/src/hh1.nim @@ -19,55 +19,55 @@ import user1 = ctx.cookies.getOrDefault("user1", """{"none": "none"}""") echo user1 # var user = to(parseJson(user1), User) - compileTemplateFile(getScriptDir() / "view" / "index.nimja") + compileTemplateFile("view" / "index.nimja", baseDir = getScriptDir()) "/shop" -> get: # var user = ctx.getUserFromCookie(ctx.cookies.getOrDefault("user", "")) # echo ctx.cookies.getOrDefault("user", "") var user1 = ctx.cookies.getOrDefault("user1", "none") - user = to(parseJson(user1), User) - compileTemplateFile(getScriptDir() / "view" / "shop.nimja") + # user = to(parseJson(user1), User) + compileTemplateFile("view" / "shop.nimja", baseDir = getScriptDir()) "/contact" -> get: var user1 = ctx.cookies.getOrDefault("user1", "none") - user = to(parseJson(user1), User) - compileTemplateFile(getScriptDir() / "view" / "contact.nimja") + # user = to(parseJson(user1), User) + compileTemplateFile("view" / "contact.nimja", baseDir = getScriptDir()) "/cart" -> get: # var user = ctx.getUserFromCookie(ctx.cookies.getOrDefault("user", "")) var user1 = ctx.cookies.getOrDefault("user1", "none") - user = to(parseJson(user1), User) - compileTemplateFile(getScriptDir() / "view" / "cart.nimja") + # user = to(parseJson(user1), User) + compileTemplateFile("view" / "cart.nimja", baseDir = getScriptDir()) "/checkout" -> get: var user1 = ctx.cookies.getOrDefault("user1", "none") user = to(parseJson(user1), User) - compileTemplateFile(getScriptDir() / "view" / "checkout.nimja") + compileTemplateFile("view" / "checkout.nimja", baseDir = getScriptDir()) "/shop/:id" -> get: var prodId = capitalizeAscii(ctx.pathParams["id"]) user1 = ctx.cookies.getOrDefault("user1", "none") user = to(parseJson(user1), User) - compileTemplateFile(getScriptDir() / "view" / "shop-detail.nimja") + compileTemplateFile("view" / "shop-detail.nimja", baseDir = getScriptDir()) "/testimonial" -> get: var user1 = ctx.cookies.getOrDefault("user1", "none") user = to(parseJson(user1), User) - compileTemplateFile(getScriptDir() / "view" / "testimonial.nimja") + compileTemplateFile("view" / "testimonial.nimja", baseDir = getScriptDir()) -"/signup" -> [get, post]: ctx.signup() +# "/signup" -> [get, post]: ctx.signup() "/login" -> get: var user1 = ctx.cookies.getOrDefault("user1", "none") # user = to(parseJson(user1), User) - compileTemplateFile(getScriptDir() / "view" / "login.nimja") + compileTemplateFile("view" / "login.nimja", baseDir = getScriptDir()) "/htmx/login" -> post: var form = ctx.urlForm @@ -137,7 +137,7 @@ import var user1 = ctx.cookies.getOrDefault("user1", "none") user = to(parseJson(user1), User) - compileTemplateFile(getScriptDir() / "view" / "404.nimja") + compileTemplateFile("view" / "404.nimja", baseDir = getScriptDir()) servePublic("src/public", "/static") diff --git a/src/view/signup.nimja b/src/view/signup.nimja index dd76c53..5000e63 100644 --- a/src/view/signup.nimja +++ b/src/view/signup.nimja @@ -1,4 +1,4 @@ -{% extends "view/partials/_master.nimja" %} +{% extends "../view/partials/_master.nimja" %} {% block spheader1 %} Sign Up {% endblock %} {% block spheader2 %} Sign Up {% endblock %}