diff options
Diffstat (limited to 'cmd/web/templates/editor')
-rw-r--r-- | cmd/web/templates/editor/form-message.tmpl | 19 | ||||
-rw-r--r-- | cmd/web/templates/editor/form.tmpl | 48 | ||||
-rw-r--r-- | cmd/web/templates/editor/htmx-editor-page.tmpl | 3 |
3 files changed, 70 insertions, 0 deletions
diff --git a/cmd/web/templates/editor/form-message.tmpl b/cmd/web/templates/editor/form-message.tmpl new file mode 100644 index 0000000..1707e78 --- /dev/null +++ b/cmd/web/templates/editor/form-message.tmpl @@ -0,0 +1,19 @@ + {{ if .Errors }} + <div class="alert alert-danger"> + <ul> + {{ range $error := .Errors }} + <li>{{ $error }}</li> + {{ end }} + </ul> + </div> + {{ end }} + + {{ if .SuccessMessages }} + <div class="alert alert-success"> + <ul> + {{ range $message := .SuccessMessages }} + <li>{{ $message }}</li> + {{ end }} + </ul> + </div> + {{ end }}
\ No newline at end of file diff --git a/cmd/web/templates/editor/form.tmpl b/cmd/web/templates/editor/form.tmpl new file mode 100644 index 0000000..e735f75 --- /dev/null +++ b/cmd/web/templates/editor/form.tmpl @@ -0,0 +1,48 @@ +<div class="editor-page"> + <div class="container page"> + <div class="row"> + + <div class="col-md-10 col-md-offset-1 col-xs-12"> + + <div id="form-message"> + {{ template "editor/form-message" . }} + </div> + + <form method="post" + + {{ if .HasArticle }} + hx-patch="/htmx/editor/{{ .Article.Slug }}" + {{ else }} + hx-post="/htmx/editor" + {{ end }} + + hx-target="#app-body" + > + <fieldset class="form-group"> + <input type="text" name="title" class="form-control form-control-lg" placeholder="Post Title" + value="{{ .Article.Title }}" + > + </fieldset> + <fieldset class="form-group"> + <input type="text" name="description" class="form-control form-control-md" placeholder="What's this article about?" + value="{{ .Article.Description }}" + > + </fieldset> + <fieldset class="form-group"> + <textarea rows="8" name="content" class="form-control" placeholder="Write your post (in markdown)">{{ .Article.Body }}</textarea> + </fieldset> + <fieldset class="form-group"> + <input type="text" name="tags" class="form-control tagify--outside" placeholder="Enter tags" + {{ if .HasArticle }} + value="{{ .Article.GetTagsAsCommaSeparated }}" + {{ end }} + > + </fieldset> + <button class="btn btn-lg btn-primary pull-xs-right"> + Publish Article + </button> + </form> + </div> + </div> + </div> +</div>
\ No newline at end of file diff --git a/cmd/web/templates/editor/htmx-editor-page.tmpl b/cmd/web/templates/editor/htmx-editor-page.tmpl new file mode 100644 index 0000000..ef5d8cd --- /dev/null +++ b/cmd/web/templates/editor/htmx-editor-page.tmpl @@ -0,0 +1,3 @@ +{{ template "editor/form" . }} +{{ template "components/navbar" . }} +{{ template "components/head" . }}
\ No newline at end of file |