1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 20:41:57 +00:00

Implement a new View Engine for the Jet template parser as requested at: https://github.com/kataras/iris/issues/1281

Former-commit-id: 3e00bdfbf1f3998a1744c390c12fd70430ac0320
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-06-22 21:34:19 +03:00
parent b71d4032e6
commit 076d9121f1
22 changed files with 1124 additions and 40 deletions

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{ isset(title) ? title : "" }}</title>
</head>
<body>
{{block documentBody()}}{{end}}
</body>
</html>

View File

@@ -0,0 +1,30 @@
{{extends "layouts/application.jet"}}
{{block button(label, href="javascript:void(0)")}}
<a href="{{ href }}">{{ label }}</a>
{{end}}
{{block ul()}}
<ul>
{{yield content}}
</ul>
{{end}}
{{block documentBody()}}
<h1>List of TODOs</h1>
{{if isset(showingAllDone) && showingAllDone}}
<p>Showing only TODOs that are done</p>
{{else}}
<p><a href="/all-done">Show only TODOs that are done</a></p>
{{end}}
{{yield ul() content}}
{{range id, value := .}}
<li {{if value.Done}}style="color:red;text-decoration: line-through;"{{end}}>
<a href="/todo?id={{ id }}">{{ value.Text }}</a>
{{yield button(label="UP", href="/update/?id="+base64(id))}} - {{yield button(href="/delete/?id="+id, label="DL")}}
</li>
{{end}}
{{end}}
{{end}}

View File

@@ -0,0 +1,9 @@
{{extends "layouts/application.jet"}}
{{block documentBody()}}
<h1>Show TODO</h1>
<p>This uses a custom renderer by implementing the jet.Renderer interface.
<p>
{{.}}
</p>
{{end}}