Skip to content

Commit

Permalink
ETA update to v.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
guildenstern70 committed Oct 11, 2024
1 parent 812ce87 commit 404bb40
Show file tree
Hide file tree
Showing 15 changed files with 120 additions and 122 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.1
0.9.0
7 changes: 4 additions & 3 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
}
},
"imports": {
"eta": "https://deno.land/x/eta@v2.0.1/mod.ts",
"eta": "jsr:@eta-dev/eta@3.5.0",
"oak_sessions": "https://deno.land/x/[email protected]/mod.ts",
"@littlelite/dyelog": "jsr:@littlelite/dyelog@^0.1.8",
"@oak/oak": "jsr:@oak/oak@^14.2.0",
"@std/fmt": "jsr:@std/[email protected]",
"@oak/oak": "jsr:@oak/oak@^17.1.0",
"@std/fmt": "jsr:@std/[email protected]",
"@std/path": "jsr:@std/path@^1.0.6",
"@std/server": "jsr:@std/server@^0.219.1"
},
"tasks": {
Expand Down
192 changes: 97 additions & 95 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/page/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ export class Features extends Page
super(logger, ctx);
}

async render()
render()
{
this.logger.info("GET /features");
this.ctx.response.body = await View.render("./static/templates/features.eta", {
this.ctx.response.body = View.render("./features", {
appname: "SmartDeno",
appversion: this.version,
title: "Features",
Expand Down
2 changes: 1 addition & 1 deletion src/page/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class Home extends Page
welcomeMessage = "Welcome to SmartDeno, ";
}

this.ctx.response.body = await View.render("./static/templates/home.eta", {
this.ctx.response.body = View.render("./home", {
appname: "SmartDeno",
appversion: this.version,
appdescription: welcomeMessage,
Expand Down
4 changes: 2 additions & 2 deletions src/page/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class Login extends Page
}
}

async render()
render()
{

this.logger.info("GET /login");
Expand All @@ -75,7 +75,7 @@ export class Login extends Page
loginErrors = true;
}

this.ctx.response.body = await View.render("./static/templates/login.eta", {
this.ctx.response.body = View.render("./login", {
appname: "SmartDeno",
appversion: this.version,
title: "Contact",
Expand Down
2 changes: 1 addition & 1 deletion src/page/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export abstract class Page
protected logger: DyeLog;
protected version: string;

protected abstract render(): Promise<void>;
protected abstract render(): void;

protected constructor(logger: DyeLog, ctx: Context)
{
Expand Down
4 changes: 2 additions & 2 deletions src/page/restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export class Restapi extends Page
super(logger, ctx);
}

async render()
render()
{
this.logger.info("GET /restapi");
this.ctx.response.body = await View.render("./static/templates/restapi.eta", {
this.ctx.response.body = View.render("./restapi", {
appname: "SmartDeno",
appversion: this.version
});
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
*
*/

export const VERSION = "0.8.1";
export const VERSION = "0.9.0";
18 changes: 4 additions & 14 deletions src/view/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,13 @@
*
*/

import { Layoutview } from "./layout/layoutview.ts";
import { render } from "eta";
import { Eta } from "eta";

export class View
{
static async render(etaTemplatePath: string, data: object)
static render(templateName: string, data: object)
{
const html = await View.get(etaTemplatePath);
return render(html, data);
const eta = new Eta({ views: './static/templates' });
return eta.render(templateName, data);
}

private static async get(etaTemplatePath: string): Promise<string>
{
const layout = new Layoutview();
const html = await Deno.readTextFile(etaTemplatePath);
const layoutHtml = await layout.get();
return layoutHtml.replace("<%~ it.body %>", html);
}

}
1 change: 1 addition & 0 deletions static/templates/features.eta
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<% layout("./base") %>
<div class="container text-center">
<div class="row">
<div class="col">
Expand Down
1 change: 1 addition & 0 deletions static/templates/home.eta
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<% layout("./base") %>
<div class="container text-center">
<div class="row">
<div class="col">
Expand Down
1 change: 1 addition & 0 deletions static/templates/layout.eta
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<% layout("./base") %>
<div class="cover-container d-flex w-100 h-100 p-3 mx-auto flex-column">
<header class="mb-auto">
<div>
Expand Down
1 change: 1 addition & 0 deletions static/templates/login.eta
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<% layout("./base") %>
<div class="container">
<div class="row d-flex justify-content-center">
<div class="col-md-6">
Expand Down
1 change: 1 addition & 0 deletions static/templates/restapi.eta
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<% layout("./base") %>
<div class="container">
<div class="row">
<div style="height: 80px">&nbsp;</div>
Expand Down

0 comments on commit 404bb40

Please sign in to comment.