mirror of
https://github.com/actix/examples
synced 2025-06-29 02:10:36 +02:00
Update yarte to 0.2
This commit is contained in:
20
template_yarte/templates/deep/more/card/form.hbs
Normal file
20
template_yarte/templates/deep/more/card/form.hbs
Normal file
@ -0,0 +1,20 @@
|
||||
{{!
|
||||
Form: What is your name?
|
||||
!}}
|
||||
{{> ../deep/welcome id = "welcome", tag = "h1", tail = '!' ~}}
|
||||
<div>
|
||||
{{! Title !}}
|
||||
<h3>What is your name?</h3>
|
||||
|
||||
{{! Form !}}
|
||||
<form>
|
||||
{{! Input name !}}
|
||||
Name: <input type="text" name="name" />
|
||||
{{! Input last name !}}
|
||||
<br/>Last name: <input type="text" name="lastname" />
|
||||
|
||||
{{! Submit !}}
|
||||
<br/><p><input type="submit"></p></form>
|
||||
|
||||
{{! Order and remove whitespace with comments !}}
|
||||
</div>
|
8
template_yarte/templates/deep/more/card/hi.hbs
Normal file
8
template_yarte/templates/deep/more/card/hi.hbs
Normal file
@ -0,0 +1,8 @@
|
||||
{{!
|
||||
Hi message:
|
||||
args:
|
||||
- lastname
|
||||
- name
|
||||
!}}
|
||||
<h1>Hi, {{ name }} {{ lastname }}!</h1>
|
||||
{{~> alias/welcome id = "hi", tag = 'p', tail = "" }}
|
@ -1 +1,8 @@
|
||||
<{{ tag }}>Welcome!</{{ tag }}>
|
||||
{{!
|
||||
Welcome card:
|
||||
args:
|
||||
- tag
|
||||
- id
|
||||
- tail
|
||||
!}}
|
||||
<{{ tag }} id="{{ id }}" class="welcome">Welcome{{ tail }}</{{ tag }}>
|
||||
|
1
template_yarte/templates/deep/more/doc/head.hbs
Normal file
1
template_yarte/templates/deep/more/doc/head.hbs
Normal file
@ -0,0 +1 @@
|
||||
<head><meta charset="utf-8" /><title>{{ title }}</title></head>
|
1
template_yarte/templates/deep/more/doc/t.hbs
Normal file
1
template_yarte/templates/deep/more/doc/t.hbs
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html>
|
@ -1,22 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
{{! Simple example !}}
|
||||
{{> doc/t ~}}
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Actix web</title>
|
||||
</head>
|
||||
{{~> doc/head title = "Actix web" ~}}
|
||||
<body>
|
||||
{{~#if let Some(name) = query.get("name") ~}}
|
||||
<h1>Hi, {{ name }}!</h1>
|
||||
{{~> alias/welcome tag='p' ~}}
|
||||
{{~ else ~}}
|
||||
{{~> alias/welcome tag="h1" ~}}
|
||||
<p>
|
||||
<h3>What is your name?</h3>
|
||||
<form>
|
||||
<input type="text" name="name"/><br/>
|
||||
<p><input type="submit"></p>
|
||||
</form>
|
||||
</p>
|
||||
{{~/if~}}
|
||||
</body>
|
||||
</html>
|
||||
{{~#if let Some(name) = query.get("name") }}
|
||||
{{ let lastname = query.get("lastname").ok_or(yarte::Error)? }}
|
||||
{{> card/hi ~}}
|
||||
{{ else ~}}
|
||||
{{> card/form ~}}
|
||||
{{/if ~}}
|
||||
</body></html>
|
||||
|
Reference in New Issue
Block a user