aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2019-12-21 08:36:44 +0000
committerr <r@freesoftwareextremist.com>2019-12-21 08:38:42 +0000
commit39c57a6b653a269668f459414d295e812f3628a8 (patch)
tree3b00e5ec638f592699d31562675b1b1e2d5da8c7 /templates
parentdf875381d4e2c9a0bd283acc3592cde6562f5e5e (diff)
downloadbloat-39c57a6b653a269668f459414d295e812f3628a8.tar.gz
bloat-39c57a6b653a269668f459414d295e812f3628a8.zip
Use a single form for new posts and replies
Diffstat (limited to 'templates')
-rw-r--r--templates/postform.tmpl16
-rw-r--r--templates/thread.tmpl18
-rw-r--r--templates/timeline.tmpl12
3 files changed, 22 insertions, 24 deletions
diff --git a/templates/postform.tmpl b/templates/postform.tmpl
new file mode 100644
index 0000000..3f6eeaa
--- /dev/null
+++ b/templates/postform.tmpl
@@ -0,0 +1,16 @@
+<form class="post-form" action="/post" method="POST" enctype="multipart/form-data">
+ {{if .}}
+ <input type="hidden" name="reply_to_id" value="{{.InReplyToID}}" />
+ <label for="post-content"> Reply to {{.InReplyToName}} </label>
+ {{else}}
+ <label for="post-content"> New post </label>
+ {{end}}
+ <div class="post-form-content-container">
+ <textarea id="post-content" name="content" class="post-content" cols="50" rows="5">{{if .}}{{.ReplyContent}}{{end}}</textarea>
+ </div>
+ <div>
+ Attachments <input id="post-file-picker" type="file" name="attachments" multiple>
+ </div>
+ <button type="submit"> Post </button>
+</form>
+
diff --git a/templates/thread.tmpl b/templates/thread.tmpl
index d4c88de..9d8f650 100644
--- a/templates/thread.tmpl
+++ b/templates/thread.tmpl
@@ -3,21 +3,11 @@
<div class="page-title"> Thread </div>
{{range .Statuses}}
-{{template "status.tmpl" .}}
-{{if eq .ID $.ReplyToID}}
-<form class="timeline-post-form" action="/post" method="POST" enctype="multipart/form-data">
- <input type="hidden" name="reply_to_id" value="{{$.ReplyToID}}" />
- <label for="post-content"> reply to {{.Account.DisplayName}} </label>
- <div class="post-form-content-container">
- <textarea id="post-content" name="content" class="post-content" cols="50" rows="5">{{$.ReplyContent}}</textarea>
- </div>
- <div>
- Attachments <input id="post-file-picker" type="file" name="attachments" multiple>
- </div>
- <button type="submit"> Post </button>
-</form>
-{{end}}
+{{template "status.tmpl" .}}
+{{if $.ReplyContext}}{{if eq .ID $.ReplyContext.InReplyToID}}
+{{template "postform.tmpl" $.ReplyContext}}
+{{end}}{{end}}
{{end}}
diff --git a/templates/timeline.tmpl b/templates/timeline.tmpl
index fe426de..09717c1 100644
--- a/templates/timeline.tmpl
+++ b/templates/timeline.tmpl
@@ -2,16 +2,8 @@
{{template "navigation.tmpl" .NavbarData}}
<div class="page-title"> Timeline </div>
-<form class="timeline-post-form" action="/post" method="POST" enctype="multipart/form-data">
- <label for="post-content"> New Post </label>
- <div class="post-content-container">
- <textarea id="post-content" name="content" class="post-content" cols="50" rows="5"></textarea>
- </div>
- <div class="post-attachment-div">
- Attachments <input id="post-file-picker" type="file" name="attachments" multiple>
- </div>
- <button type="submit"> Post </button>
-</form>
+
+{{template "postform.tmpl" }}
{{range .Statuses}}
{{template "status.tmpl" .}}