projecto completo creo, me quedo bonito :3
This commit is contained in:
25
templates/500.qtpl
Normal file
25
templates/500.qtpl
Normal file
@@ -0,0 +1,25 @@
|
||||
{% code
|
||||
type Error500Page struct {
|
||||
Message string
|
||||
Error string
|
||||
}
|
||||
%}
|
||||
|
||||
{% func (p *Error500Page ) Title() %}
|
||||
500
|
||||
{% endfunc %}
|
||||
|
||||
{% func (p *Error500Page ) Stylesheets() %}
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
|
||||
{% endfunc %}
|
||||
|
||||
{% func (p *Error500Page ) Scripts() %}
|
||||
{% endfunc %}
|
||||
|
||||
{% func (p *Error500Page ) Body() %}
|
||||
<div class="container">
|
||||
<h1>Error: 500</h1>
|
||||
<p>{%s p.Message %}</p>
|
||||
<p>{%s p.Error %}</p>
|
||||
</div>
|
||||
{% endfunc %}
|
||||
175
templates/500.qtpl.go
Normal file
175
templates/500.qtpl.go
Normal file
@@ -0,0 +1,175 @@
|
||||
// This file is automatically generated by qtc from "500.qtpl".
|
||||
// See https://github.com/valyala/quicktemplate for details.
|
||||
|
||||
//line 500.qtpl:1
|
||||
package templates
|
||||
|
||||
//line 500.qtpl:1
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line 500.qtpl:1
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line 500.qtpl:2
|
||||
type Error500Page struct {
|
||||
Message string
|
||||
Error string
|
||||
}
|
||||
|
||||
//line 500.qtpl:8
|
||||
func (p *Error500Page) StreamTitle(qw422016 *qt422016.Writer) {
|
||||
//line 500.qtpl:8
|
||||
qw422016.N().S(`
|
||||
500
|
||||
`)
|
||||
//line 500.qtpl:10
|
||||
}
|
||||
|
||||
//line 500.qtpl:10
|
||||
func (p *Error500Page) WriteTitle(qq422016 qtio422016.Writer) {
|
||||
//line 500.qtpl:10
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line 500.qtpl:10
|
||||
p.StreamTitle(qw422016)
|
||||
//line 500.qtpl:10
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line 500.qtpl:10
|
||||
}
|
||||
|
||||
//line 500.qtpl:10
|
||||
func (p *Error500Page) Title() string {
|
||||
//line 500.qtpl:10
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line 500.qtpl:10
|
||||
p.WriteTitle(qb422016)
|
||||
//line 500.qtpl:10
|
||||
qs422016 := string(qb422016.B)
|
||||
//line 500.qtpl:10
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line 500.qtpl:10
|
||||
return qs422016
|
||||
//line 500.qtpl:10
|
||||
}
|
||||
|
||||
//line 500.qtpl:12
|
||||
func (p *Error500Page) StreamStylesheets(qw422016 *qt422016.Writer) {
|
||||
//line 500.qtpl:12
|
||||
qw422016.N().S(`
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
|
||||
`)
|
||||
//line 500.qtpl:14
|
||||
}
|
||||
|
||||
//line 500.qtpl:14
|
||||
func (p *Error500Page) WriteStylesheets(qq422016 qtio422016.Writer) {
|
||||
//line 500.qtpl:14
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line 500.qtpl:14
|
||||
p.StreamStylesheets(qw422016)
|
||||
//line 500.qtpl:14
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line 500.qtpl:14
|
||||
}
|
||||
|
||||
//line 500.qtpl:14
|
||||
func (p *Error500Page) Stylesheets() string {
|
||||
//line 500.qtpl:14
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line 500.qtpl:14
|
||||
p.WriteStylesheets(qb422016)
|
||||
//line 500.qtpl:14
|
||||
qs422016 := string(qb422016.B)
|
||||
//line 500.qtpl:14
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line 500.qtpl:14
|
||||
return qs422016
|
||||
//line 500.qtpl:14
|
||||
}
|
||||
|
||||
//line 500.qtpl:16
|
||||
func (p *Error500Page) StreamScripts(qw422016 *qt422016.Writer) {
|
||||
//line 500.qtpl:16
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line 500.qtpl:17
|
||||
}
|
||||
|
||||
//line 500.qtpl:17
|
||||
func (p *Error500Page) WriteScripts(qq422016 qtio422016.Writer) {
|
||||
//line 500.qtpl:17
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line 500.qtpl:17
|
||||
p.StreamScripts(qw422016)
|
||||
//line 500.qtpl:17
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line 500.qtpl:17
|
||||
}
|
||||
|
||||
//line 500.qtpl:17
|
||||
func (p *Error500Page) Scripts() string {
|
||||
//line 500.qtpl:17
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line 500.qtpl:17
|
||||
p.WriteScripts(qb422016)
|
||||
//line 500.qtpl:17
|
||||
qs422016 := string(qb422016.B)
|
||||
//line 500.qtpl:17
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line 500.qtpl:17
|
||||
return qs422016
|
||||
//line 500.qtpl:17
|
||||
}
|
||||
|
||||
//line 500.qtpl:19
|
||||
func (p *Error500Page) StreamBody(qw422016 *qt422016.Writer) {
|
||||
//line 500.qtpl:19
|
||||
qw422016.N().S(`
|
||||
<div class="container">
|
||||
<h1>Error: 500</h1>
|
||||
<p>`)
|
||||
//line 500.qtpl:22
|
||||
qw422016.E().S(p.Message)
|
||||
//line 500.qtpl:22
|
||||
qw422016.N().S(`</p>
|
||||
<p>`)
|
||||
//line 500.qtpl:23
|
||||
qw422016.E().S(p.Error)
|
||||
//line 500.qtpl:23
|
||||
qw422016.N().S(`</p>
|
||||
</div>
|
||||
`)
|
||||
//line 500.qtpl:25
|
||||
}
|
||||
|
||||
//line 500.qtpl:25
|
||||
func (p *Error500Page) WriteBody(qq422016 qtio422016.Writer) {
|
||||
//line 500.qtpl:25
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line 500.qtpl:25
|
||||
p.StreamBody(qw422016)
|
||||
//line 500.qtpl:25
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line 500.qtpl:25
|
||||
}
|
||||
|
||||
//line 500.qtpl:25
|
||||
func (p *Error500Page) Body() string {
|
||||
//line 500.qtpl:25
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line 500.qtpl:25
|
||||
p.WriteBody(qb422016)
|
||||
//line 500.qtpl:25
|
||||
qs422016 := string(qb422016.B)
|
||||
//line 500.qtpl:25
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line 500.qtpl:25
|
||||
return qs422016
|
||||
//line 500.qtpl:25
|
||||
}
|
||||
31
templates/base.qtpl
Normal file
31
templates/base.qtpl
Normal file
@@ -0,0 +1,31 @@
|
||||
{% interface PageImpl {
|
||||
Title()
|
||||
Stylesheets()
|
||||
Scripts()
|
||||
Body()
|
||||
}
|
||||
%}
|
||||
|
||||
{% func Page(p PageImpl) %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<title>{%= p.Title() %}</title>
|
||||
{%= p.Stylesheets() %}
|
||||
{%= p.Scripts() %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{%= p.Body() %}
|
||||
</body>
|
||||
</html>
|
||||
{% endfunc %}
|
||||
|
||||
{% func GetDoneButton(done bool) %}
|
||||
{% if done %}
|
||||
<input type="submit" class="button-primary button-green u-full-width" value="">
|
||||
{% else %}
|
||||
<input type="submit" class="button-primary button-red u-full-width" value="">
|
||||
{% endif %}
|
||||
{% endfunc %}
|
||||
161
templates/base.qtpl.go
Normal file
161
templates/base.qtpl.go
Normal file
@@ -0,0 +1,161 @@
|
||||
// This file is automatically generated by qtc from "base.qtpl".
|
||||
// See https://github.com/valyala/quicktemplate for details.
|
||||
|
||||
//line base.qtpl:1
|
||||
package templates
|
||||
|
||||
//line base.qtpl:1
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line base.qtpl:1
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line base.qtpl:1
|
||||
type PageImpl interface {
|
||||
//line base.qtpl:1
|
||||
Title() string
|
||||
//line base.qtpl:1
|
||||
StreamTitle(qw422016 *qt422016.Writer)
|
||||
//line base.qtpl:1
|
||||
WriteTitle(qq422016 qtio422016.Writer)
|
||||
//line base.qtpl:1
|
||||
Stylesheets() string
|
||||
//line base.qtpl:1
|
||||
StreamStylesheets(qw422016 *qt422016.Writer)
|
||||
//line base.qtpl:1
|
||||
WriteStylesheets(qq422016 qtio422016.Writer)
|
||||
//line base.qtpl:1
|
||||
Scripts() string
|
||||
//line base.qtpl:1
|
||||
StreamScripts(qw422016 *qt422016.Writer)
|
||||
//line base.qtpl:1
|
||||
WriteScripts(qq422016 qtio422016.Writer)
|
||||
//line base.qtpl:1
|
||||
Body() string
|
||||
//line base.qtpl:1
|
||||
StreamBody(qw422016 *qt422016.Writer)
|
||||
//line base.qtpl:1
|
||||
WriteBody(qq422016 qtio422016.Writer)
|
||||
//line base.qtpl:1
|
||||
}
|
||||
|
||||
//line base.qtpl:9
|
||||
func StreamPage(qw422016 *qt422016.Writer, p PageImpl) {
|
||||
//line base.qtpl:9
|
||||
qw422016.N().S(`
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<title>`)
|
||||
//line base.qtpl:14
|
||||
p.StreamTitle(qw422016)
|
||||
//line base.qtpl:14
|
||||
qw422016.N().S(`</title>
|
||||
`)
|
||||
//line base.qtpl:15
|
||||
p.StreamStylesheets(qw422016)
|
||||
//line base.qtpl:15
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line base.qtpl:16
|
||||
p.StreamScripts(qw422016)
|
||||
//line base.qtpl:16
|
||||
qw422016.N().S(`
|
||||
</head>
|
||||
|
||||
<body>
|
||||
`)
|
||||
//line base.qtpl:20
|
||||
p.StreamBody(qw422016)
|
||||
//line base.qtpl:20
|
||||
qw422016.N().S(`
|
||||
</body>
|
||||
</html>
|
||||
`)
|
||||
//line base.qtpl:23
|
||||
}
|
||||
|
||||
//line base.qtpl:23
|
||||
func WritePage(qq422016 qtio422016.Writer, p PageImpl) {
|
||||
//line base.qtpl:23
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line base.qtpl:23
|
||||
StreamPage(qw422016, p)
|
||||
//line base.qtpl:23
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line base.qtpl:23
|
||||
}
|
||||
|
||||
//line base.qtpl:23
|
||||
func Page(p PageImpl) string {
|
||||
//line base.qtpl:23
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line base.qtpl:23
|
||||
WritePage(qb422016, p)
|
||||
//line base.qtpl:23
|
||||
qs422016 := string(qb422016.B)
|
||||
//line base.qtpl:23
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line base.qtpl:23
|
||||
return qs422016
|
||||
//line base.qtpl:23
|
||||
}
|
||||
|
||||
//line base.qtpl:25
|
||||
func StreamGetDoneButton(qw422016 *qt422016.Writer, done bool) {
|
||||
//line base.qtpl:25
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line base.qtpl:26
|
||||
if done {
|
||||
//line base.qtpl:26
|
||||
qw422016.N().S(`
|
||||
<input type="submit" class="button-primary button-green u-full-width" value="">
|
||||
`)
|
||||
//line base.qtpl:28
|
||||
} else {
|
||||
//line base.qtpl:28
|
||||
qw422016.N().S(`
|
||||
<input type="submit" class="button-primary button-red u-full-width" value="">
|
||||
`)
|
||||
//line base.qtpl:30
|
||||
}
|
||||
//line base.qtpl:30
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line base.qtpl:31
|
||||
}
|
||||
|
||||
//line base.qtpl:31
|
||||
func WriteGetDoneButton(qq422016 qtio422016.Writer, done bool) {
|
||||
//line base.qtpl:31
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line base.qtpl:31
|
||||
StreamGetDoneButton(qw422016, done)
|
||||
//line base.qtpl:31
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line base.qtpl:31
|
||||
}
|
||||
|
||||
//line base.qtpl:31
|
||||
func GetDoneButton(done bool) string {
|
||||
//line base.qtpl:31
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line base.qtpl:31
|
||||
WriteGetDoneButton(qb422016, done)
|
||||
//line base.qtpl:31
|
||||
qs422016 := string(qb422016.B)
|
||||
//line base.qtpl:31
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line base.qtpl:31
|
||||
return qs422016
|
||||
//line base.qtpl:31
|
||||
}
|
||||
67
templates/edit.qtpl
Normal file
67
templates/edit.qtpl
Normal file
@@ -0,0 +1,67 @@
|
||||
{% import "todo/models" %}
|
||||
|
||||
{% code
|
||||
type EditPage struct {
|
||||
Todos []models.Todo
|
||||
EditingTodo models.Todo
|
||||
}
|
||||
%}
|
||||
|
||||
{% func (p *EditPage ) Title() %}
|
||||
Todo
|
||||
{% endfunc %}
|
||||
|
||||
{% func (p *EditPage ) Stylesheets() %}
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/custom.css">
|
||||
{% endfunc %}
|
||||
|
||||
{% func (p *EditPage ) Scripts() %}
|
||||
{% endfunc %}
|
||||
|
||||
{% func (p *EditPage ) Body() %}
|
||||
<div class="container">
|
||||
<a href="/" class="title"><h1>TODO in Golang</h1></a>
|
||||
<form action="/update/{%d p.EditingTodo.Id %}" method="post">
|
||||
<div class="row">
|
||||
<div class="nine columns">
|
||||
<input type="text" class="u-full-width" name="todo" id="todo" value="{%s p.EditingTodo.Todo %}">
|
||||
</div>
|
||||
<div class="three columns">
|
||||
<input type="submit" class="button-primary u-full-width" value="Update">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% for _, todo := range p.Todos %}
|
||||
<div class="row">
|
||||
<div class="one column">
|
||||
<form action="/undo/{%d todo.Id %}" method="post">
|
||||
{%= GetDoneButton(todo.Done) %}
|
||||
</form>
|
||||
</div>
|
||||
<div class="seven columns">
|
||||
<p>{%s todo.Todo %}</p>
|
||||
</div>
|
||||
{% if todo.Id == p.EditingTodo.Id %}
|
||||
<div class="two columns">
|
||||
<input type="submit" disabled="disabled" class="u-full-width" value="Editing">
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="two columns">
|
||||
<form action="/edit/{%d todo.Id %}">
|
||||
<input type="submit" class="button-primary u-full-width" value="Edit">
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="two columns">
|
||||
<form action="/undo/{%d todo.Id %}" method="post">
|
||||
<input type="submit" class="button-red u-full-width" value="Delete">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
{% endfunc %}
|
||||
|
||||
257
templates/edit.qtpl.go
Normal file
257
templates/edit.qtpl.go
Normal file
@@ -0,0 +1,257 @@
|
||||
// This file is automatically generated by qtc from "edit.qtpl".
|
||||
// See https://github.com/valyala/quicktemplate for details.
|
||||
|
||||
//line edit.qtpl:1
|
||||
package templates
|
||||
|
||||
//line edit.qtpl:1
|
||||
import "todo/models"
|
||||
|
||||
//line edit.qtpl:3
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line edit.qtpl:3
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line edit.qtpl:4
|
||||
type EditPage struct {
|
||||
Todos []models.Todo
|
||||
EditingTodo models.Todo
|
||||
}
|
||||
|
||||
//line edit.qtpl:10
|
||||
func (p *EditPage) StreamTitle(qw422016 *qt422016.Writer) {
|
||||
//line edit.qtpl:10
|
||||
qw422016.N().S(`
|
||||
Todo
|
||||
`)
|
||||
//line edit.qtpl:12
|
||||
}
|
||||
|
||||
//line edit.qtpl:12
|
||||
func (p *EditPage) WriteTitle(qq422016 qtio422016.Writer) {
|
||||
//line edit.qtpl:12
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line edit.qtpl:12
|
||||
p.StreamTitle(qw422016)
|
||||
//line edit.qtpl:12
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line edit.qtpl:12
|
||||
}
|
||||
|
||||
//line edit.qtpl:12
|
||||
func (p *EditPage) Title() string {
|
||||
//line edit.qtpl:12
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line edit.qtpl:12
|
||||
p.WriteTitle(qb422016)
|
||||
//line edit.qtpl:12
|
||||
qs422016 := string(qb422016.B)
|
||||
//line edit.qtpl:12
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line edit.qtpl:12
|
||||
return qs422016
|
||||
//line edit.qtpl:12
|
||||
}
|
||||
|
||||
//line edit.qtpl:14
|
||||
func (p *EditPage) StreamStylesheets(qw422016 *qt422016.Writer) {
|
||||
//line edit.qtpl:14
|
||||
qw422016.N().S(`
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/custom.css">
|
||||
`)
|
||||
//line edit.qtpl:17
|
||||
}
|
||||
|
||||
//line edit.qtpl:17
|
||||
func (p *EditPage) WriteStylesheets(qq422016 qtio422016.Writer) {
|
||||
//line edit.qtpl:17
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line edit.qtpl:17
|
||||
p.StreamStylesheets(qw422016)
|
||||
//line edit.qtpl:17
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line edit.qtpl:17
|
||||
}
|
||||
|
||||
//line edit.qtpl:17
|
||||
func (p *EditPage) Stylesheets() string {
|
||||
//line edit.qtpl:17
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line edit.qtpl:17
|
||||
p.WriteStylesheets(qb422016)
|
||||
//line edit.qtpl:17
|
||||
qs422016 := string(qb422016.B)
|
||||
//line edit.qtpl:17
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line edit.qtpl:17
|
||||
return qs422016
|
||||
//line edit.qtpl:17
|
||||
}
|
||||
|
||||
//line edit.qtpl:19
|
||||
func (p *EditPage) StreamScripts(qw422016 *qt422016.Writer) {
|
||||
//line edit.qtpl:19
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line edit.qtpl:20
|
||||
}
|
||||
|
||||
//line edit.qtpl:20
|
||||
func (p *EditPage) WriteScripts(qq422016 qtio422016.Writer) {
|
||||
//line edit.qtpl:20
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line edit.qtpl:20
|
||||
p.StreamScripts(qw422016)
|
||||
//line edit.qtpl:20
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line edit.qtpl:20
|
||||
}
|
||||
|
||||
//line edit.qtpl:20
|
||||
func (p *EditPage) Scripts() string {
|
||||
//line edit.qtpl:20
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line edit.qtpl:20
|
||||
p.WriteScripts(qb422016)
|
||||
//line edit.qtpl:20
|
||||
qs422016 := string(qb422016.B)
|
||||
//line edit.qtpl:20
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line edit.qtpl:20
|
||||
return qs422016
|
||||
//line edit.qtpl:20
|
||||
}
|
||||
|
||||
//line edit.qtpl:22
|
||||
func (p *EditPage) StreamBody(qw422016 *qt422016.Writer) {
|
||||
//line edit.qtpl:22
|
||||
qw422016.N().S(`
|
||||
<div class="container">
|
||||
<a href="/" class="title"><h1>TODO in Golang</h1></a>
|
||||
<form action="/update/`)
|
||||
//line edit.qtpl:25
|
||||
qw422016.N().D(p.EditingTodo.Id)
|
||||
//line edit.qtpl:25
|
||||
qw422016.N().S(`" method="post">
|
||||
<div class="row">
|
||||
<div class="nine columns">
|
||||
<input type="text" class="u-full-width" name="todo" id="todo" value="`)
|
||||
//line edit.qtpl:28
|
||||
qw422016.E().S(p.EditingTodo.Todo)
|
||||
//line edit.qtpl:28
|
||||
qw422016.N().S(`">
|
||||
</div>
|
||||
<div class="three columns">
|
||||
<input type="submit" class="button-primary u-full-width" value="Update">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
`)
|
||||
//line edit.qtpl:36
|
||||
for _, todo := range p.Todos {
|
||||
//line edit.qtpl:36
|
||||
qw422016.N().S(`
|
||||
<div class="row">
|
||||
<div class="one column">
|
||||
<form action="/undo/`)
|
||||
//line edit.qtpl:39
|
||||
qw422016.N().D(todo.Id)
|
||||
//line edit.qtpl:39
|
||||
qw422016.N().S(`" method="post">
|
||||
`)
|
||||
//line edit.qtpl:40
|
||||
StreamGetDoneButton(qw422016, todo.Done)
|
||||
//line edit.qtpl:40
|
||||
qw422016.N().S(`
|
||||
</form>
|
||||
</div>
|
||||
<div class="seven columns">
|
||||
<p>`)
|
||||
//line edit.qtpl:44
|
||||
qw422016.E().S(todo.Todo)
|
||||
//line edit.qtpl:44
|
||||
qw422016.N().S(`</p>
|
||||
</div>
|
||||
`)
|
||||
//line edit.qtpl:46
|
||||
if todo.Id == p.EditingTodo.Id {
|
||||
//line edit.qtpl:46
|
||||
qw422016.N().S(`
|
||||
<div class="two columns">
|
||||
<input type="submit" disabled="disabled" class="u-full-width" value="Editing">
|
||||
</div>
|
||||
`)
|
||||
//line edit.qtpl:50
|
||||
} else {
|
||||
//line edit.qtpl:50
|
||||
qw422016.N().S(`
|
||||
<div class="two columns">
|
||||
<form action="/edit/`)
|
||||
//line edit.qtpl:52
|
||||
qw422016.N().D(todo.Id)
|
||||
//line edit.qtpl:52
|
||||
qw422016.N().S(`">
|
||||
<input type="submit" class="button-primary u-full-width" value="Edit">
|
||||
</form>
|
||||
</div>
|
||||
`)
|
||||
//line edit.qtpl:56
|
||||
}
|
||||
//line edit.qtpl:56
|
||||
qw422016.N().S(`
|
||||
<div class="two columns">
|
||||
<form action="/undo/`)
|
||||
//line edit.qtpl:58
|
||||
qw422016.N().D(todo.Id)
|
||||
//line edit.qtpl:58
|
||||
qw422016.N().S(`" method="post">
|
||||
<input type="submit" class="button-red u-full-width" value="Delete">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
`)
|
||||
//line edit.qtpl:63
|
||||
}
|
||||
//line edit.qtpl:63
|
||||
qw422016.N().S(`
|
||||
|
||||
</div>
|
||||
`)
|
||||
//line edit.qtpl:66
|
||||
}
|
||||
|
||||
//line edit.qtpl:66
|
||||
func (p *EditPage) WriteBody(qq422016 qtio422016.Writer) {
|
||||
//line edit.qtpl:66
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line edit.qtpl:66
|
||||
p.StreamBody(qw422016)
|
||||
//line edit.qtpl:66
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line edit.qtpl:66
|
||||
}
|
||||
|
||||
//line edit.qtpl:66
|
||||
func (p *EditPage) Body() string {
|
||||
//line edit.qtpl:66
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line edit.qtpl:66
|
||||
p.WriteBody(qb422016)
|
||||
//line edit.qtpl:66
|
||||
qs422016 := string(qb422016.B)
|
||||
//line edit.qtpl:66
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line edit.qtpl:66
|
||||
return qs422016
|
||||
//line edit.qtpl:66
|
||||
}
|
||||
59
templates/index.qtpl
Normal file
59
templates/index.qtpl
Normal file
@@ -0,0 +1,59 @@
|
||||
{% import "todo/models" %}
|
||||
|
||||
{% code
|
||||
type IndexPage struct {
|
||||
Todos []models.Todo
|
||||
}
|
||||
%}
|
||||
|
||||
{% func (p *IndexPage ) Title() %}
|
||||
Todo
|
||||
{% endfunc %}
|
||||
|
||||
{% func (p *IndexPage ) Stylesheets() %}
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/custom.css">
|
||||
{% endfunc %}
|
||||
|
||||
{% func (p *IndexPage ) Scripts() %}
|
||||
{% endfunc %}
|
||||
|
||||
{% func (p *IndexPage ) Body() %}
|
||||
<div class="container">
|
||||
<a href="/" class="title"><h1>TODO in Golang</h1></a>
|
||||
<form action="/create" method="post">
|
||||
<div class="row">
|
||||
<div class="nine columns">
|
||||
<input type="text" class="u-full-width" name="todo" id="todo">
|
||||
</div>
|
||||
<div class="three columns">
|
||||
<input type="submit" class="button-primary u-full-width" value="add">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% for _, todo := range p.Todos %}
|
||||
<div class="row">
|
||||
<div class="one column">
|
||||
<form action="/toggle/{%d todo.Id %}" method="post">
|
||||
{%= GetDoneButton(todo.Done) %}
|
||||
</form>
|
||||
</div>
|
||||
<div class="seven columns">
|
||||
<p>{%s todo.Todo %}</p>
|
||||
</div>
|
||||
<div class="two columns">
|
||||
<form action="/edit/{%d todo.Id %}">
|
||||
<input type="submit" class="button-primary u-full-width" value="Edit">
|
||||
</form>
|
||||
</div>
|
||||
<div class="two columns">
|
||||
<form action="/delete/{%d todo.Id %}" method="post">
|
||||
<input type="submit" class="button-primary button-red u-full-width" value="Delete">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
{% endfunc %}
|
||||
230
templates/index.qtpl.go
Normal file
230
templates/index.qtpl.go
Normal file
@@ -0,0 +1,230 @@
|
||||
// This file is automatically generated by qtc from "index.qtpl".
|
||||
// See https://github.com/valyala/quicktemplate for details.
|
||||
|
||||
//line index.qtpl:1
|
||||
package templates
|
||||
|
||||
//line index.qtpl:1
|
||||
import "todo/models"
|
||||
|
||||
//line index.qtpl:3
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line index.qtpl:3
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line index.qtpl:4
|
||||
type IndexPage struct {
|
||||
Todos []models.Todo
|
||||
}
|
||||
|
||||
//line index.qtpl:9
|
||||
func (p *IndexPage) StreamTitle(qw422016 *qt422016.Writer) {
|
||||
//line index.qtpl:9
|
||||
qw422016.N().S(`
|
||||
Todo
|
||||
`)
|
||||
//line index.qtpl:11
|
||||
}
|
||||
|
||||
//line index.qtpl:11
|
||||
func (p *IndexPage) WriteTitle(qq422016 qtio422016.Writer) {
|
||||
//line index.qtpl:11
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line index.qtpl:11
|
||||
p.StreamTitle(qw422016)
|
||||
//line index.qtpl:11
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line index.qtpl:11
|
||||
}
|
||||
|
||||
//line index.qtpl:11
|
||||
func (p *IndexPage) Title() string {
|
||||
//line index.qtpl:11
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line index.qtpl:11
|
||||
p.WriteTitle(qb422016)
|
||||
//line index.qtpl:11
|
||||
qs422016 := string(qb422016.B)
|
||||
//line index.qtpl:11
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line index.qtpl:11
|
||||
return qs422016
|
||||
//line index.qtpl:11
|
||||
}
|
||||
|
||||
//line index.qtpl:13
|
||||
func (p *IndexPage) StreamStylesheets(qw422016 *qt422016.Writer) {
|
||||
//line index.qtpl:13
|
||||
qw422016.N().S(`
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/custom.css">
|
||||
`)
|
||||
//line index.qtpl:16
|
||||
}
|
||||
|
||||
//line index.qtpl:16
|
||||
func (p *IndexPage) WriteStylesheets(qq422016 qtio422016.Writer) {
|
||||
//line index.qtpl:16
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line index.qtpl:16
|
||||
p.StreamStylesheets(qw422016)
|
||||
//line index.qtpl:16
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line index.qtpl:16
|
||||
}
|
||||
|
||||
//line index.qtpl:16
|
||||
func (p *IndexPage) Stylesheets() string {
|
||||
//line index.qtpl:16
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line index.qtpl:16
|
||||
p.WriteStylesheets(qb422016)
|
||||
//line index.qtpl:16
|
||||
qs422016 := string(qb422016.B)
|
||||
//line index.qtpl:16
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line index.qtpl:16
|
||||
return qs422016
|
||||
//line index.qtpl:16
|
||||
}
|
||||
|
||||
//line index.qtpl:18
|
||||
func (p *IndexPage) StreamScripts(qw422016 *qt422016.Writer) {
|
||||
//line index.qtpl:18
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line index.qtpl:19
|
||||
}
|
||||
|
||||
//line index.qtpl:19
|
||||
func (p *IndexPage) WriteScripts(qq422016 qtio422016.Writer) {
|
||||
//line index.qtpl:19
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line index.qtpl:19
|
||||
p.StreamScripts(qw422016)
|
||||
//line index.qtpl:19
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line index.qtpl:19
|
||||
}
|
||||
|
||||
//line index.qtpl:19
|
||||
func (p *IndexPage) Scripts() string {
|
||||
//line index.qtpl:19
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line index.qtpl:19
|
||||
p.WriteScripts(qb422016)
|
||||
//line index.qtpl:19
|
||||
qs422016 := string(qb422016.B)
|
||||
//line index.qtpl:19
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line index.qtpl:19
|
||||
return qs422016
|
||||
//line index.qtpl:19
|
||||
}
|
||||
|
||||
//line index.qtpl:21
|
||||
func (p *IndexPage) StreamBody(qw422016 *qt422016.Writer) {
|
||||
//line index.qtpl:21
|
||||
qw422016.N().S(`
|
||||
<div class="container">
|
||||
<a href="/" class="title"><h1>TODO in Golang</h1></a>
|
||||
<form action="/create" method="post">
|
||||
<div class="row">
|
||||
<div class="nine columns">
|
||||
<input type="text" class="u-full-width" name="todo" id="todo">
|
||||
</div>
|
||||
<div class="three columns">
|
||||
<input type="submit" class="button-primary u-full-width" value="add">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
`)
|
||||
//line index.qtpl:35
|
||||
for _, todo := range p.Todos {
|
||||
//line index.qtpl:35
|
||||
qw422016.N().S(`
|
||||
<div class="row">
|
||||
<div class="one column">
|
||||
<form action="/toggle/`)
|
||||
//line index.qtpl:38
|
||||
qw422016.N().D(todo.Id)
|
||||
//line index.qtpl:38
|
||||
qw422016.N().S(`" method="post">
|
||||
`)
|
||||
//line index.qtpl:39
|
||||
StreamGetDoneButton(qw422016, todo.Done)
|
||||
//line index.qtpl:39
|
||||
qw422016.N().S(`
|
||||
</form>
|
||||
</div>
|
||||
<div class="seven columns">
|
||||
<p>`)
|
||||
//line index.qtpl:43
|
||||
qw422016.E().S(todo.Todo)
|
||||
//line index.qtpl:43
|
||||
qw422016.N().S(`</p>
|
||||
</div>
|
||||
<div class="two columns">
|
||||
<form action="/edit/`)
|
||||
//line index.qtpl:46
|
||||
qw422016.N().D(todo.Id)
|
||||
//line index.qtpl:46
|
||||
qw422016.N().S(`">
|
||||
<input type="submit" class="button-primary u-full-width" value="Edit">
|
||||
</form>
|
||||
</div>
|
||||
<div class="two columns">
|
||||
<form action="/delete/`)
|
||||
//line index.qtpl:51
|
||||
qw422016.N().D(todo.Id)
|
||||
//line index.qtpl:51
|
||||
qw422016.N().S(`" method="post">
|
||||
<input type="submit" class="button-primary button-red u-full-width" value="Delete">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
`)
|
||||
//line index.qtpl:56
|
||||
}
|
||||
//line index.qtpl:56
|
||||
qw422016.N().S(`
|
||||
|
||||
</div>
|
||||
`)
|
||||
//line index.qtpl:59
|
||||
}
|
||||
|
||||
//line index.qtpl:59
|
||||
func (p *IndexPage) WriteBody(qq422016 qtio422016.Writer) {
|
||||
//line index.qtpl:59
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line index.qtpl:59
|
||||
p.StreamBody(qw422016)
|
||||
//line index.qtpl:59
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line index.qtpl:59
|
||||
}
|
||||
|
||||
//line index.qtpl:59
|
||||
func (p *IndexPage) Body() string {
|
||||
//line index.qtpl:59
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line index.qtpl:59
|
||||
p.WriteBody(qb422016)
|
||||
//line index.qtpl:59
|
||||
qs422016 := string(qb422016.B)
|
||||
//line index.qtpl:59
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line index.qtpl:59
|
||||
return qs422016
|
||||
//line index.qtpl:59
|
||||
}
|
||||
Reference in New Issue
Block a user