~evanj/cms

ref: 34b3875dddf3e9096221b155abcb25ad2e7aeecc cms/internal/s/tmpl/tmpls_embed.go -rw-r--r-- 2.2 KiB
34b3875dEvan M Jones Feat(*): Project init. 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Code generated by "embed -pattern html/* -id tmpls"; DO NOT EDIT.

package tmpl

var tmpls map[string]string

func init() {
	tmpls = make(map[string]string)

	tmpls["html/index.html"] = `<!DOCTYPE html>
<html lang=en>

<head>
  <meta charset="utf-8">
  <title>CMS</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>
  <style>
    form input { display: block; margin: 10px 0; }
  </style>

  <main>
    <header>
      <h1>CMS</h1>
      <p>A flexible CMS for everyone.</p>
    </header>
    <hr/>
    <article>
      <h1>landing page</h1>

      {{ if .User }}

        <p>Available Spaces</p>
        <p>TODO</p>

        <form method=POST action='/space/new' enctype='multipart/form-data'>
          <legend>Create Space</legend>
          <input required type=text name=name placeholder=name />
          <input type=text name=description placeholder=description />
          <input type=submit value=Go />
        </form>

        <form method=POST action='/user/logout' enctype='multipart/form-data'>
          <legend>Logout</legend>
          <input type=submit value=Go />
        </form>

      {{ else }}

        <form method=POST action='/user/login' enctype='multipart/form-data'>
          <legend>Login</legend>
          <input autocomplete=on required type=text name=username placeholder=username autofocus />
          <input autocomplete=on required type=password name=password placeholder=password />
          <input type=submit value=Go />
        </form>

        <form method=POST action='/user/signup' enctype='multipart/form-data'>
          <legend>Signup</legend>
          <input autocomplete=on required type=text name=username placeholder=username autofocus />
          <input autocomplete=on required type=password name=password placeholder=password />
          <input autocomplete=on required type=password name=verify placeholder=verify />
          <input type=submit value=Go />
        </form>

      {{ end }}

    </article>
    <hr/>
    <footer>
      <center>© 2015-2020 Evan Jones</center>
    </footer>
  </main>
</body>

</html>
`

}

func Get(name string) (string, bool) {
	val, ok := tmpls[name]
	return val, ok
}

func Must(name string) string {
	val, _ := tmpls[name]
	return val
}