~evanj/cms

ref: 715dccc30b27b8e6bdd6330ff3d106e66f577087 cms/internal/s/tmpl/html/index.html -rw-r--r-- 7.1 KiB
715dccc3Evan M Jones Fix(new*List): Remove error, remove panic when list is of size zero. 1 year, 2 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html lang=en>
<head>
  {{ template "html/_head.html" }}
  <title>CMS</title>
</head>
<body class='index bg-light'>
  <style>{{ template "css/main.css" }}</style>
  <main>
    {{ template "html/_header.html" $ }}
    <div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
      <h1 class="display-4">CMS</h1>
      <p class="lead">An old-school content management <mark>infrastructure</mark> for most.</p>
    </div>
    <div class='container'>
      <div class='row'>
        <div class="col-12 offset-0 col-lg-8 offset-lg-2">
          <div class="alert alert-warning" role="alert">
            <p><strong>WARNING:</strong> This site is in <strong>ALPHA</strong>. 
            This site is a content management system/infrastructure. Meaning: 
            it's purpose is to allow users to generate content. That's a 
            dangerous thing. Instead of focusing on fighting abuse I'll be auto 
            deleting all content (except for my own) on a regular and tight 
            interval. You still might have fun poking around on this site. It's 
            also <a href='https://www.gnu.org/philosophy/floss-and-foss.en.html'>FLOSS,</a>
            so you can enjoy self-hosting yourself if you are so inclined. If you
            find bugs (you most likely will) or have feature requests please send 
            them my way. It is appreciated. Thank you.</p>
            <p>If you need to hit the API try cURL'ing any page you see in the 
            URL bar (include basic auth). A simple use case of consuming this site can be found on my 
            <a href='https://git.sr.ht/~evanj/evanjon.es/tree/master/pkg/cms/cms.go'>personal site</a>.</p>
          </div>
        </div>
      </div>
    </div>
    <article>
      {{ if .User }}
        <form method=POST action='/space/new' enctype='multipart/form-data'>
          <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
            <div class="modal-dialog modal-dialog-scrollable">
              <div class="modal-content">
                <div class="modal-header">
                  <h5 class="modal-title" id="exampleModalLabel">Create a new space</h5>
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                  </button>
                </div>
                <div class="modal-body">
                  <label for="spaceName">Name</label>
                  <input name=name type=text id="spaceName" class="mb-3 form-control" placeholder="Name" required>
                  <label for="spaceDesc">Description</label>
                  <input name=desc type=text id="spaceDesc" class="mb-3 form-control" placeholder="Description" required>
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                  <button type="submit" class="btn btn-primary">Go</button>
                </div>
              </div>
            </div>
          </div>
        </form>
        <div class="container">
          <div class='row'>
            <div class='offset-lg-3 col-lg-6'>
              <div class="my-3 p-3 bg-white rounded shadow-sm">
                  <small class="d-block text-right float-right" data-toggle="modal" data-target="#exampleModal">
                    <a href="#">Create a new space</a>
                  </small>
                <h6 class="border-bottom border-gray pb-2 mb-0">Your spaces</h6>
                {{ if .Spaces.List }}
                  {{ range .Spaces.List }}
                  <div class="media text-muted pt-3">
                    <a href='/space/{{ .ID }}'  class="d-block media-body pb-3 mb-0 small lh-125 border-bottom border-gray">
                      <strong class="d-block text-gray-dark">{{ .Name }}</strong>
                      {{ .Desc }}
                    </a>
                  </div>
                  {{ end }}
                  {{ if .Spaces.More }}
                  <small class="d-block text-right mt-3">
                    <a href="/?before={{ .Spaces.Last.ID}}">Load more</a>
                  </small>
                  {{ end }}
                {{ else }}
                  <div class="mt-3 alert alert-primary" role="alert">
                    You haven't created any spaces yet. 
                  </div>
                {{ end }}
              </div>
            </div>
          </div>
        </div>
      {{ else }}
        <div class="container">
          <div class='row justify-content-center'>
            <div class="col-12 col-md-6 col-lg-4 offset-col-lg-2 col-xl-3 offset-col-xl-3 d-flex">
              <div class="card mb-4 shadow-sm flex-fill">
                <div class="card-header">
                  <h4 class="my-0 font-weight-normal">Signup</h4>
                </div>
                <div class="card-body">
                  <form method=POST action='/user/signup' enctype='multipart/form-data'>
                    <label for="signupInputUsername" class="sr-only">Email address</label>
                    <input name=username type="text" id="signupInputUsername" class="mb-3 form-control" placeholder="Username" required>
                    <label for="signupInputPassword" class="sr-only">Password</label>
                    <input name=password type="password" id="signupInputPassword" class="mb-3 form-control" placeholder="Password" required>
                    <label for="signupInputVerify" class="sr-only">Confirm Password</label>
                    <input name=verify type="password" id="signupInputVerify" class="mb-3 form-control" placeholder="Confirm Password" required>
                    <button class="btn btn-lg btn-primary btn-block" type="submit">Go</button>
                  </form>
                </div>
              </div>
            </div>
            <div class="col-12 col-md-6 col-lg-4 col-xl-3 d-flex">
              <div class="card mb-4 shadow-sm flex-fill">
                <div class="card-header">
                  <h4 class="my-0 font-weight-normal">Login</h4>
                </div>
                <div class="card-body d-flex">
                  <form class='d-flex flex-grow-1 flex-column' method=POST action='/user/login' enctype='multipart/form-data'>
                    <label for="loginInputUsername" class="sr-only">Email address</label>
                    <input name=username type="text" id="loginInputUsername" class="mb-3 form-control" placeholder="Username" required>
                    <label for="loginInputPassword" class="sr-only">Password</label>
                    <input name=password type="password" id="loginInputPassword" class="mb-3 form-control" placeholder="Password" required>
                    <button class="mt-auto btn btn-lg btn-primary btn-block" type="submit">Go</button>
                  </form>
                </div>
              </div>
            </div>
          </div>
        </div>
      {{ end }}
    </article>
    {{ template "html/_footer.html" }}
  </main>
  {{ template "html/_scripts.html" }}
  {{ if .User }}
    <script>{{ template "js/main.js" $ }}</script>
  {{ end }}
</body>
</html>