~evanj/cms

742a26f8c9faae960f2de74d063576315d22d211 — Evan M Jones 8 months ago e11cc3b
Fix(html): Cleaning up html a tad.
M internal/c/c.go => internal/c/c.go +1 -3
@@ 15,9 15,7 @@ import (

type KeyCookie = string

var (
	KeyUserLogin KeyCookie = "KeyUserLogin"
)
var KeyUserLogin KeyCookie = "KeyUserLogin"

type Controller struct {
	log *log.Logger

M internal/s/tmpl/css/main.css => internal/s/tmpl/css/main.css +7 -0
@@ 1,3 1,9 @@
* { 
  padding: 0;
  margin: 0;
  list-style: none;
}

body {
}



@@ 12,6 18,7 @@ textarea {
  box-sizing: border-box;
}

a,
input, 
button {
  cursor: pointer;

M internal/s/tmpl/html/_head.html => internal/s/tmpl/html/_head.html +3 -0
@@ 0,0 1,3 @@
<meta charset="utf-8">
<link rel="icon" type="image/x-icon" href="https://favicon.evanjon.es/255/0/0/32/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1">

M internal/s/tmpl/html/content.html => internal/s/tmpl/html/content.html +49 -54
@@ 2,19 2,15 @@
<html lang=en>

<head>
  <meta charset="utf-8">
  <title>CMS | {{ .Space.Name }}</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  {{ template "html/_head.html" }}
  <title>CMS | {{ .Space.Name }} | {{ .ContentType.Name }} | {{ (.Content.MustValueByName "name").Value }}</title>
</head>

<body>
  <style>{{ template "css/main.css" }}</style>

  <main>
    <header>
      <h1>CMS</h1>
      <p>An old-school CMS for most.</p>
    </header>
    {{ template "html/_header.html" }}
    <hr/>
    <article>



@@ 22,65 18,64 @@
        <a href='/contenttype/{{ .Space.ID }}/{{ .ContentType.ID }}'>Back</a>
      </nav>

      <h2>
        {{ .Space.Name }}
        >
        {{ .ContentType.Name }}
        >
        {{ (.Content.MustValueByName "name").Value }}
      </h2>
      <h1>Space: {{ .Space.Name }}</h1>
      <h2>Content Type: {{ .ContentType.Name }}</h2>
      <h3>Content: {{ (.Content.MustValueByName "name").Value }}</h3>

      <form method=POST action='/content/update' enctype='multipart/form-data'>
        <legend>Update Content:</legend>
        <input required type=hidden name=space value="{{ .Space.ID }}" />
        <input required type=hidden name=contenttype value="{{ .ContentType.ID }}" />
        <input required type=hidden name=content value="{{ .Content.ID }}" />
      <details>
        <summary>Update Content</summary>
        <form method=POST action='/content/update' enctype='multipart/form-data'>
          <input required type=hidden name=space value="{{ .Space.ID }}" />
          <input required type=hidden name=contenttype value="{{ .ContentType.ID }}" />
          <input required type=hidden name=content value="{{ .Content.ID }}" />

        {{ range .Content.Values }}
          {{ range .Content.Values }}

          <label>{{ .Name }}</label>
            <label>{{ .Name }}</label>

          {{ if eq .Type "StringSmall" }}
            <input value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}" />
          {{ end }}

          {{ if eq .Type "StringBig" }}
            <textarea required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}">{{ .Value }}</textarea>
          {{ end }}

          {{ if eq .Type "InputHTML" }}
            <textarea class='input-html' value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}">{{ .Value }}</textarea>
          {{ end }}
            {{ if eq .Type "StringSmall" }}
              <input value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}" />
            {{ end }}

          {{ if eq .Type "InputMarkdown" }}
            <textarea class='input-markdown' value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}">{{ .Value }}</textarea>
          {{ end }}
            {{ if eq .Type "StringBig" }}
              <textarea required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}">{{ .Value }}</textarea>
            {{ end }}

          {{ if eq .Type "File" }}
            <input value="{{ .Value }}" type=file name="{{ .Type }}-{{ .ID }}" multiple=false />
          {{ end }}
            {{ if eq .Type "InputHTML" }}
              <textarea class='input-html' value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}">{{ .Value }}</textarea>
            {{ end }}

          {{ if eq .Type "Date" }}
            <input value="{{ .Value }}" required type=date name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}" />
          {{ end }}
            {{ if eq .Type "InputMarkdown" }}
              <textarea class='input-markdown' value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}">{{ .Value }}</textarea>
            {{ end }}

          {{ if eq .Type "Reference" }}
            <input value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}" />
          {{ end }}
            {{ if eq .Type "File" }}
              <input value="{{ .Value }}" type=file name="{{ .Type }}-{{ .ID }}" multiple=false />
            {{ end }}

        {{ end }}
            {{ if eq .Type "Date" }}
              <input value="{{ .Value }}" required type=date name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}" />
            {{ end }}

        <input type=submit value=Go />
      </form>
            {{ if eq .Type "Reference" }}
              <input value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}" />
            {{ end }}

      <form method=POST action='/content/delete' enctype='multipart/form-data'>
        <legend>Delete Content:</legend>
        <input required type=hidden name=space value="{{ .Space.ID }}" />
        <input required type=hidden name=contenttype value="{{ .ContentType.ID }}" />
        <input required type=hidden name=content value="{{ .Content.ID }}" />
        <input type=submit value=Go />
      </form>
          {{ end }}

          <input type=submit value=Go />
        </form>
      </details>

      <details>
        <summary>Delete Content</summary>
        <form method=POST action='/content/delete' enctype='multipart/form-data'>
          <input required type=hidden name=space value="{{ .Space.ID }}" />
          <input required type=hidden name=contenttype value="{{ .ContentType.ID }}" />
          <input required type=hidden name=content value="{{ .Content.ID }}" />
          <input type=submit value=Go />
        </form>
      </details>

    </article>
    <hr/>

M internal/s/tmpl/html/contenttype.html => internal/s/tmpl/html/contenttype.html +58 -59
@@ 2,19 2,15 @@
<html lang=en>

<head>
  <meta charset="utf-8">
  <title>CMS | {{ .Space.Name }}</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  {{ template "html/_head.html" }}
  <title>CMS | {{ .Space.Name }} | {{ .ContenType.Name }}</title>
</head>

<body>
  <style>{{ template "css/main.css" }}</style>

  <main>
    <header>
      <h1>CMS</h1>
      <p>An old-school CMS for most.</p>
    </header>
    {{ template "html/_header.html" }}
    <hr/>
    <article>



@@ 22,72 18,75 @@
        <a href='/space/{{ .Space.ID }}'>Back</a>
      </nav>

      <h2>
        {{ .Space.Name }}
        > 
        {{ .ContentType.Name }}
      </h2>
      <h1>Space: {{ .Space.Name }}</h1>
      <h2>Content Type: {{ .ContentType.Name }}</h2>

      <form method=POST action='/content/new' enctype='multipart/form-data'>
        <legend>Create a <strong>{{ .ContentType.Name }}</strong>:</legend>
        <input required type=hidden name=space value="{{ .Space.ID }}" />
        <input required type=hidden name=contenttype value="{{ .ContentType.ID }}" />
        <br/>
      <details>
        <summary>Create a {{ .ContentType.Name }} Content</summary>
        <form method=POST action='/content/new' enctype='multipart/form-data'>
          <input required type=hidden name=space value="{{ .Space.ID }}" />
          <input required type=hidden name=contenttype value="{{ .ContentType.ID }}" />
          <br/>

        {{ range .ContentType.Fields }}
          {{ range .ContentType.Fields }}

          <label>{{ .Name }}</label>
            <label>{{ .Name }}</label>

          {{ if eq .Type "StringSmall" }}
            <input required type=text name="{{ .Name }}" placeholder="{{ .Name }}" />
          {{ end }}
            {{ if eq .Type "StringSmall" }}
              <input required type=text name="{{ .Name }}" placeholder="{{ .Name }}" />
            {{ end }}

          {{ if eq .Type "StringBig" }}
            <textarea required type=text name="{{ .Name }}" placeholder="{{ .Name }}" ></textarea>
          {{ end }}
            {{ if eq .Type "StringBig" }}
              <textarea required type=text name="{{ .Name }}" placeholder="{{ .Name }}" ></textarea>
            {{ end }}

          {{ if eq .Type "InputHTML" }}
            <textarea class='input-html' required type=text name="{{ .Name }}" placeholder="{{ .Name }}" ></textarea>
          {{ end }}
            {{ if eq .Type "InputHTML" }}
              <textarea class='input-html' required type=text name="{{ .Name }}" placeholder="{{ .Name }}" ></textarea>
            {{ end }}

          {{ if eq .Type "InputMarkdown" }}
            <textarea class='input-markdown' required type=text name="{{ .Name }}" placeholder="{{ .Name }}" ></textarea>
          {{ end }}
            {{ if eq .Type "InputMarkdown" }}
              <textarea class='input-markdown' required type=text name="{{ .Name }}" placeholder="{{ .Name }}" ></textarea>
            {{ end }}

          {{ if eq .Type "File" }}
            <input required type=file name="{{ .Name }}" multiple=false />
          {{ end }}
            {{ if eq .Type "File" }}
              <input required type=file name="{{ .Name }}" multiple=false />
            {{ end }}

          {{ if eq .Type "Date" }}
            <input required type=date name="{{ .Name }}" placeholder="{{ .Name }}" />
          {{ end }}

          {{ if eq .Type "Reference" }}
            <input required type=text name="{{ .Name }}" placeholder="{{ .Name }}" />
          {{ end }}
            {{ if eq .Type "Date" }}
              <input required type=date name="{{ .Name }}" placeholder="{{ .Name }}" />
            {{ end }}

            {{ if eq .Type "Reference" }}
            <!-- use dialog for this popup menu 
              https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog
            -->
              <input required type=text name="{{ .Name }}" placeholder="{{ .Name }}" />
            {{ end }}


        {{ end }}

        <input type=submit value=Go />
      </form>

      <p>Browse <strong>{{ .ContentType.Name }}</strong> Content:</p>
      {{ if .ContentList }}
        <ul>
          {{ range .ContentList }}
            <li> 
              <a href='/content/{{ $.Space.ID }}/{{ $.ContentType.ID }}/{{ .ID }}'>
                {{ (.MustValueByName "name").Value }}
              </a>
            </li>
          {{ end }}
        </ul>
      {{ else }}
        <p>No content has been created with a content type of 
        {{ .ContentType.Name }}</p>
      {{ end }}

          <input type=submit value=Go />
        </form>
      </details>

      <details>
        <summary>Browse {{ .ContentType.Name }} Content</summary>
        {{ if .ContentList }}
          <ul>
            {{ range .ContentList }}
              <li> 
                <a href='/content/{{ $.Space.ID }}/{{ $.ContentType.ID }}/{{ .ID }}'>
                  {{ (.MustValueByName "name").Value }}
                </a>
              </li>
            {{ end }}
          </ul>
        {{ else }}
          <p>No content has been created with a content type of {{ .ContentType.Name }}</p>
        {{ end }}
      </details>

    </article>
    <hr/>

M internal/s/tmpl/html/index.html => internal/s/tmpl/html/index.html +47 -41
@@ 2,9 2,8 @@
<html lang=en>

<head>
  <meta charset="utf-8">
  {{ template "html/_head.html" }}
  <title>CMS</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>


@@ 18,48 17,55 @@

      {{ if .User }}

        <h2>Welcome back, {{ .User.Name }}.</h2>

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


        <p>Available Spaces:</p>
        {{ if .Spaces }}
          <ul>
            {{ range .Spaces }}
            <li><a href="/space/{{ .ID }}">{{ .Name }}</a></li>
            {{ end }}
          </ul>
        {{ else }}
          <p>You haven't created any spaces yet.</p>
        {{ end }}

        <form method=POST action='/user/logout' enctype='multipart/form-data'>
          <legend>Logout</legend>
          <input type=submit value=Go />
        </form>
        <details>
          <summary>Create a New Space</summary>
          <form method=POST action='/space/new' enctype='multipart/form-data'>
            <input required type=text name=name placeholder=name />
            <input required type=text name=desc placeholder=description />
            <input type=submit value=Go />
          </form>
        </details>

        <details>
          <summary>Available Spaces</summary>
          {{ if .Spaces }}
            <ul>
              {{ range .Spaces }}
              <li><a href="/space/{{ .ID }}">{{ .Name }}</a></li>
              {{ end }}
            </ul>
          {{ else }}
            <p>You haven't created any spaces yet.</p>
          {{ end }}
        </details>

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

      {{ 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>
        <details>
          <summary>Login</summary>
          <form method=POST action='/user/login' enctype='multipart/form-data'>
            <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>
        </details>

        <details>
          <summary>Signup</summary>
          <form method=POST action='/user/signup' enctype='multipart/form-data'>
            <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>
        </details>

      {{ end }}


M internal/s/tmpl/html/space.html => internal/s/tmpl/html/space.html +38 -35
@@ 2,9 2,8 @@
<html lang=en>

<head>
  <meta charset="utf-8">
  {{ template "html/_head.html" }}
  <title>CMS | {{ .Space.Name }}</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>


@@ 19,39 18,43 @@
        <a href='/'>Back</a>
      </nav>

      <h2>{{ .Space.Name }}</h2>

      <form method=POST action='/contenttype/new' enctype='multipart/form-data'>
        <legend>Create Content Type:</legend>
        <input required type=hidden name=space value="{{ .Space.ID }}" />
        <input required type=text name=name placeholder="content type name" />
        <div id='first-fieldset'>
          <input readonly="readonly" required type=text name="field_name_1" value="name" />
          <select readonly="readonly" required name="field_type_1">
            <option disabled value>Field Type</option>
            <option selected value="StringSmall">String Small</option>
            <option disabled value="StringBig">String Big</option>
            <option disabled value="InputHTML">HTML</option>
            <option disabled value="InputMarkdown">Markdown</option>
            <option disabled value="File">File</option>
            <option disabled value="Date">Date</option>
            <option disabled value="Reference">Reference</option>
          </select>
        </div>
        <button id='add-fieldbtn'>Add Another Field</button>
        <input type=submit value=Go />
      </form>

      <p>Browse Content By Type:</p>
      {{ if .ContentTypes }}
        <ul>
          {{ range .ContentTypes }}
            <li><a href='/contenttype/{{ $.Space.ID }}/{{ .ID }}'>{{ .Name }}</a></li>
          {{ end }}
        </ul>
      {{ else }}
        content must exist.</p>
      {{ end }}
      <h1>Space: {{ .Space.Name }}</h1>

      <details>
        <summary>Create Content Type</summary>
        <form method=POST action='/contenttype/new' enctype='multipart/form-data'>
          <input required type=hidden name=space value="{{ .Space.ID }}" />
          <input required type=text name=name placeholder="content type name" />
          <div id='first-fieldset'>
            <input readonly="readonly" required type=text name="field_name_1" value="name" />
            <select readonly="readonly" required name="field_type_1">
              <option disabled value>Field Type</option>
              <option selected value="StringSmall">String Small</option>
              <option disabled value="StringBig">String Big</option>
              <option disabled value="InputHTML">HTML</option>
              <option disabled value="InputMarkdown">Markdown</option>
              <option disabled value="File">File</option>
              <option disabled value="Date">Date</option>
              <option disabled value="Reference">Reference</option>
            </select>
          </div>
          <button id='add-fieldbtn'>Add Another Field</button>
          <input type=submit value=Go />
        </form>
      </details>

      <details>
        <summary>Browse Content By Type</summary>
        {{ if .ContentTypes }}
          <ul>
            {{ range .ContentTypes }}
              <li><a href='/contenttype/{{ $.Space.ID }}/{{ .ID }}'>{{ .Name }}</a></li>
            {{ end }}
          </ul>
        {{ else }}
          <p>You haven't created any content types yet.</p>
        {{ end }}
      </details>

    </article>
    <hr/>

M internal/s/tmpl/js/content.js => internal/s/tmpl/js/content.js +2 -2
@@ 4,7 4,7 @@
  // HTML
  tinymce.init({ 
    selector: 'textarea.input-html',
    statusbar: false,
    // statusbar: false,
    setup: function(item) { 
      item.on('change', function() { 
        item.targetElm.value = item.getContent()


@@ 18,7 18,7 @@
    plugin: 'textpattern',
    menubar: false,
    toolbar: 'undo redo',
    statusbar: false,
    // statusbar: false,
    textpattern_patterns: [
      {start: '*', end: '*', format: 'italic'},
      {start: '**', end: '**', format: 'bold'},

M internal/s/tmpl/tmpls_embed.go => internal/s/tmpl/tmpls_embed.go +205 -192
@@ 7,7 7,13 @@ var tmpls map[string]string
func init() {
	tmpls = make(map[string]string)

	tmpls["css/main.css"] = `body {
	tmpls["css/main.css"] = `* { 
  padding: 0;
  margin: 0;
  list-style: none;
}

body {
}

main { 


@@ 21,6 27,7 @@ textarea {
  box-sizing: border-box;
}

a,
input, 
button {
  cursor: pointer;


@@ 48,7 55,10 @@ textarea {
</footer>
`

	tmpls["html/_head.html"] = ``
	tmpls["html/_head.html"] = `<meta charset="utf-8">
<link rel="icon" type="image/x-icon" href="https://favicon.evanjon.es/255/0/0/32/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1">
`

	tmpls["html/_header.html"] = `<header>
  <h1>CMS</h1>


@@ 60,19 70,15 @@ textarea {
<html lang=en>

<head>
  <meta charset="utf-8">
  <title>CMS | {{ .Space.Name }}</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  {{ template "html/_head.html" }}
  <title>CMS | {{ .Space.Name }} | {{ .ContentType.Name }} | {{ (.Content.MustValueByName "name").Value }}</title>
</head>

<body>
  <style>{{ template "css/main.css" }}</style>

  <main>
    <header>
      <h1>CMS</h1>
      <p>An old-school CMS for most.</p>
    </header>
    {{ template "html/_header.html" }}
    <hr/>
    <article>



@@ 80,65 86,64 @@ textarea {
        <a href='/contenttype/{{ .Space.ID }}/{{ .ContentType.ID }}'>Back</a>
      </nav>

      <h2>
        {{ .Space.Name }}
        >
        {{ .ContentType.Name }}
        >
        {{ (.Content.MustValueByName "name").Value }}
      </h2>
      <h1>Space: {{ .Space.Name }}</h1>
      <h2>Content Type: {{ .ContentType.Name }}</h2>
      <h3>Content: {{ (.Content.MustValueByName "name").Value }}</h3>

      <form method=POST action='/content/update' enctype='multipart/form-data'>
        <legend>Update Content:</legend>
        <input required type=hidden name=space value="{{ .Space.ID }}" />
        <input required type=hidden name=contenttype value="{{ .ContentType.ID }}" />
        <input required type=hidden name=content value="{{ .Content.ID }}" />
      <details>
        <summary>Update Content</summary>
        <form method=POST action='/content/update' enctype='multipart/form-data'>
          <input required type=hidden name=space value="{{ .Space.ID }}" />
          <input required type=hidden name=contenttype value="{{ .ContentType.ID }}" />
          <input required type=hidden name=content value="{{ .Content.ID }}" />

        {{ range .Content.Values }}
          {{ range .Content.Values }}

          <label>{{ .Name }}</label>
            <label>{{ .Name }}</label>

          {{ if eq .Type "StringSmall" }}
            <input value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}" />
          {{ end }}

          {{ if eq .Type "StringBig" }}
            <textarea required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}">{{ .Value }}</textarea>
          {{ end }}

          {{ if eq .Type "InputHTML" }}
            <textarea class='input-html' value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}">{{ .Value }}</textarea>
          {{ end }}
            {{ if eq .Type "StringSmall" }}
              <input value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}" />
            {{ end }}

          {{ if eq .Type "InputMarkdown" }}
            <textarea class='input-markdown' value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}">{{ .Value }}</textarea>
          {{ end }}
            {{ if eq .Type "StringBig" }}
              <textarea required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}">{{ .Value }}</textarea>
            {{ end }}

          {{ if eq .Type "File" }}
            <input value="{{ .Value }}" type=file name="{{ .Type }}-{{ .ID }}" multiple=false />
          {{ end }}
            {{ if eq .Type "InputHTML" }}
              <textarea class='input-html' value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}">{{ .Value }}</textarea>
            {{ end }}

          {{ if eq .Type "Date" }}
            <input value="{{ .Value }}" required type=date name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}" />
          {{ end }}
            {{ if eq .Type "InputMarkdown" }}
              <textarea class='input-markdown' value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}">{{ .Value }}</textarea>
            {{ end }}

          {{ if eq .Type "Reference" }}
            <input value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}" />
          {{ end }}
            {{ if eq .Type "File" }}
              <input value="{{ .Value }}" type=file name="{{ .Type }}-{{ .ID }}" multiple=false />
            {{ end }}

        {{ end }}
            {{ if eq .Type "Date" }}
              <input value="{{ .Value }}" required type=date name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}" />
            {{ end }}

        <input type=submit value=Go />
      </form>
            {{ if eq .Type "Reference" }}
              <input value="{{ .Value }}" required type=text name="{{ .Type }}-{{ .ID }}" placeholder="{{ .Name }}" />
            {{ end }}

      <form method=POST action='/content/delete' enctype='multipart/form-data'>
        <legend>Delete Content:</legend>
        <input required type=hidden name=space value="{{ .Space.ID }}" />
        <input required type=hidden name=contenttype value="{{ .ContentType.ID }}" />
        <input required type=hidden name=content value="{{ .Content.ID }}" />
        <input type=submit value=Go />
      </form>
          {{ end }}

          <input type=submit value=Go />
        </form>
      </details>

      <details>
        <summary>Delete Content</summary>
        <form method=POST action='/content/delete' enctype='multipart/form-data'>
          <input required type=hidden name=space value="{{ .Space.ID }}" />
          <input required type=hidden name=contenttype value="{{ .ContentType.ID }}" />
          <input required type=hidden name=content value="{{ .Content.ID }}" />
          <input type=submit value=Go />
        </form>
      </details>

    </article>
    <hr/>


@@ 156,19 161,15 @@ textarea {
<html lang=en>

<head>
  <meta charset="utf-8">
  <title>CMS | {{ .Space.Name }}</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  {{ template "html/_head.html" }}
  <title>CMS | {{ .Space.Name }} | {{ .ContenType.Name }}</title>
</head>

<body>
  <style>{{ template "css/main.css" }}</style>

  <main>
    <header>
      <h1>CMS</h1>
      <p>An old-school CMS for most.</p>
    </header>
    {{ template "html/_header.html" }}
    <hr/>
    <article>



@@ 176,72 177,75 @@ textarea {
        <a href='/space/{{ .Space.ID }}'>Back</a>
      </nav>

      <h2>
        {{ .Space.Name }}
        > 
        {{ .ContentType.Name }}
      </h2>

      <form method=POST action='/content/new' enctype='multipart/form-data'>
        <legend>Create a <strong>{{ .ContentType.Name }}</strong>:</legend>
        <input required type=hidden name=space value="{{ .Space.ID }}" />
        <input required type=hidden name=contenttype value="{{ .ContentType.ID }}" />
        <br/>
      <h1>Space: {{ .Space.Name }}</h1>
      <h2>Content Type: {{ .ContentType.Name }}</h2>

        {{ range .ContentType.Fields }}
      <details>
        <summary>Create a {{ .ContentType.Name }} Content</summary>
        <form method=POST action='/content/new' enctype='multipart/form-data'>
          <input required type=hidden name=space value="{{ .Space.ID }}" />
          <input required type=hidden name=contenttype value="{{ .ContentType.ID }}" />
          <br/>

          <label>{{ .Name }}</label>
          {{ range .ContentType.Fields }}

          {{ if eq .Type "StringSmall" }}
            <input required type=text name="{{ .Name }}" placeholder="{{ .Name }}" />
          {{ end }}
            <label>{{ .Name }}</label>

          {{ if eq .Type "StringBig" }}
            <textarea required type=text name="{{ .Name }}" placeholder="{{ .Name }}" ></textarea>
          {{ end }}
            {{ if eq .Type "StringSmall" }}
              <input required type=text name="{{ .Name }}" placeholder="{{ .Name }}" />
            {{ end }}

          {{ if eq .Type "InputHTML" }}
            <textarea class='input-html' required type=text name="{{ .Name }}" placeholder="{{ .Name }}" ></textarea>
          {{ end }}
            {{ if eq .Type "StringBig" }}
              <textarea required type=text name="{{ .Name }}" placeholder="{{ .Name }}" ></textarea>
            {{ end }}

          {{ if eq .Type "InputMarkdown" }}
            <textarea class='input-markdown' required type=text name="{{ .Name }}" placeholder="{{ .Name }}" ></textarea>
          {{ end }}
            {{ if eq .Type "InputHTML" }}
              <textarea class='input-html' required type=text name="{{ .Name }}" placeholder="{{ .Name }}" ></textarea>
            {{ end }}

          {{ if eq .Type "File" }}
            <input required type=file name="{{ .Name }}" multiple=false />
          {{ end }}
            {{ if eq .Type "InputMarkdown" }}
              <textarea class='input-markdown' required type=text name="{{ .Name }}" placeholder="{{ .Name }}" ></textarea>
            {{ end }}

          {{ if eq .Type "Date" }}
            <input required type=date name="{{ .Name }}" placeholder="{{ .Name }}" />
          {{ end }}
            {{ if eq .Type "File" }}
              <input required type=file name="{{ .Name }}" multiple=false />
            {{ end }}

          {{ if eq .Type "Reference" }}
            <input required type=text name="{{ .Name }}" placeholder="{{ .Name }}" />
          {{ end }}
            {{ if eq .Type "Date" }}
              <input required type=date name="{{ .Name }}" placeholder="{{ .Name }}" />
            {{ end }}

            {{ if eq .Type "Reference" }}
            <!-- use dialog for this popup menu 
              https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog
            -->
              <input required type=text name="{{ .Name }}" placeholder="{{ .Name }}" />
            {{ end }}


        {{ end }}

        <input type=submit value=Go />
      </form>

      <p>Browse <strong>{{ .ContentType.Name }}</strong> Content:</p>
      {{ if .ContentList }}
        <ul>
          {{ range .ContentList }}
            <li> 
              <a href='/content/{{ $.Space.ID }}/{{ $.ContentType.ID }}/{{ .ID }}'>
                {{ (.MustValueByName "name").Value }}
              </a>
            </li>
          {{ end }}
        </ul>
      {{ else }}
        <p>No content has been created with a content type of 
        {{ .ContentType.Name }}</p>
      {{ end }}

          <input type=submit value=Go />
        </form>
      </details>

      <details>
        <summary>Browse {{ .ContentType.Name }} Content</summary>
        {{ if .ContentList }}
          <ul>
            {{ range .ContentList }}
              <li> 
                <a href='/content/{{ $.Space.ID }}/{{ $.ContentType.ID }}/{{ .ID }}'>
                  {{ (.MustValueByName "name").Value }}
                </a>
              </li>
            {{ end }}
          </ul>
        {{ else }}
          <p>No content has been created with a content type of {{ .ContentType.Name }}</p>
        {{ end }}
      </details>

    </article>
    <hr/>


@@ 259,9 263,8 @@ textarea {
<html lang=en>

<head>
  <meta charset="utf-8">
  {{ template "html/_head.html" }}
  <title>CMS</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>


@@ 275,48 278,55 @@ textarea {

      {{ if .User }}

        <h2>Welcome back, {{ .User.Name }}.</h2>

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


        <p>Available Spaces:</p>
        {{ if .Spaces }}
          <ul>
            {{ range .Spaces }}
            <li><a href="/space/{{ .ID }}">{{ .Name }}</a></li>
            {{ end }}
          </ul>
        {{ else }}
          <p>You haven't created any spaces yet.</p>
        {{ end }}
        <details>
          <summary>Create a New Space</summary>
          <form method=POST action='/space/new' enctype='multipart/form-data'>
            <input required type=text name=name placeholder=name />
            <input required type=text name=desc placeholder=description />
            <input type=submit value=Go />
          </form>
        </details>

        <details>
          <summary>Available Spaces</summary>
          {{ if .Spaces }}
            <ul>
              {{ range .Spaces }}
              <li><a href="/space/{{ .ID }}">{{ .Name }}</a></li>
              {{ end }}
            </ul>
          {{ else }}
            <p>You haven't created any spaces yet.</p>
          {{ end }}
        </details>

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

      {{ 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>
        <details>
          <summary>Login</summary>
          <form method=POST action='/user/login' enctype='multipart/form-data'>
            <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>
        </details>

        <details>
          <summary>Signup</summary>
          <form method=POST action='/user/signup' enctype='multipart/form-data'>
            <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>
        </details>

      {{ end }}



@@ 333,9 343,8 @@ textarea {
<html lang=en>

<head>
  <meta charset="utf-8">
  {{ template "html/_head.html" }}
  <title>CMS | {{ .Space.Name }}</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>


@@ 350,39 359,43 @@ textarea {
        <a href='/'>Back</a>
      </nav>

      <h2>{{ .Space.Name }}</h2>

      <form method=POST action='/contenttype/new' enctype='multipart/form-data'>
        <legend>Create Content Type:</legend>
        <input required type=hidden name=space value="{{ .Space.ID }}" />
        <input required type=text name=name placeholder="content type name" />
        <div id='first-fieldset'>
          <input readonly="readonly" required type=text name="field_name_1" value="name" />
          <select readonly="readonly" required name="field_type_1">
            <option disabled value>Field Type</option>
            <option selected value="StringSmall">String Small</option>
            <option disabled value="StringBig">String Big</option>
            <option disabled value="InputHTML">HTML</option>
            <option disabled value="InputMarkdown">Markdown</option>
            <option disabled value="File">File</option>
            <option disabled value="Date">Date</option>
            <option disabled value="Reference">Reference</option>
          </select>
        </div>
        <button id='add-fieldbtn'>Add Another Field</button>
        <input type=submit value=Go />
      </form>

      <p>Browse Content By Type:</p>
      {{ if .ContentTypes }}
        <ul>
          {{ range .ContentTypes }}
            <li><a href='/contenttype/{{ $.Space.ID }}/{{ .ID }}'>{{ .Name }}</a></li>
          {{ end }}
        </ul>
      {{ else }}
        content must exist.</p>
      {{ end }}
      <h1>Space: {{ .Space.Name }}</h1>

      <details>
        <summary>Create Content Type</summary>
        <form method=POST action='/contenttype/new' enctype='multipart/form-data'>
          <input required type=hidden name=space value="{{ .Space.ID }}" />
          <input required type=text name=name placeholder="content type name" />
          <div id='first-fieldset'>
            <input readonly="readonly" required type=text name="field_name_1" value="name" />
            <select readonly="readonly" required name="field_type_1">
              <option disabled value>Field Type</option>
              <option selected value="StringSmall">String Small</option>
              <option disabled value="StringBig">String Big</option>
              <option disabled value="InputHTML">HTML</option>
              <option disabled value="InputMarkdown">Markdown</option>
              <option disabled value="File">File</option>
              <option disabled value="Date">Date</option>
              <option disabled value="Reference">Reference</option>
            </select>
          </div>
          <button id='add-fieldbtn'>Add Another Field</button>
          <input type=submit value=Go />
        </form>
      </details>

      <details>
        <summary>Browse Content By Type</summary>
        {{ if .ContentTypes }}
          <ul>
            {{ range .ContentTypes }}
              <li><a href='/contenttype/{{ $.Space.ID }}/{{ .ID }}'>{{ .Name }}</a></li>
            {{ end }}
          </ul>
        {{ else }}
          <p>You haven't created any content types yet.</p>
        {{ end }}
      </details>

    </article>
    <hr/>


@@ 400,7 413,7 @@ textarea {
  // HTML
  tinymce.init({ 
    selector: 'textarea.input-html',
    statusbar: false,
    // statusbar: false,
    setup: function(item) { 
      item.on('change', function() { 
        item.targetElm.value = item.getContent()


@@ 414,7 427,7 @@ textarea {
    plugin: 'textpattern',
    menubar: false,
    toolbar: 'undo redo',
    statusbar: false,
    // statusbar: false,
    textpattern_patterns: [
      {start: '*', end: '*', format: 'italic'},
      {start: '**', end: '**', format: 'bold'},