commit 6ac445b8c544adae764a05f43af43298b79c308e
parent 66b314d762d65bf4e5a249f66279eafb8cf6c554
Author: Peter Kosyh <p.kosyh@gmail.com>
Date: Mon, 7 Sep 2020 22:10:06 +0300
New post link added
Diffstat:
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/ii-node/tpl/header.tpl b/ii-node/tpl/header.tpl
@@ -29,7 +29,7 @@
{{ with .Echo }}
{{ if $.Topic }}
- :: <a href="/{{$.Topic}}/reply">Reply topic</a>
+ :: <a href="/{{$.Topic}}/reply/new">New post</a>
{{ else }}
:: <a href="/{{.}}/new">New topic</a>
{{ end }}
diff --git a/ii-node/tpl/reply.tpl b/ii-node/tpl/reply.tpl
@@ -6,9 +6,7 @@
<input type="text" name="to" class="to" placeholder="{{.To}}" value="{{.To}}"><br>
<input type="text" name="subj" class="subj" placeholder="{{.Subj}}" value="{{.Subj}}"><br>
<input type="hidden" name="repto" value="{{.|repto}}">
-<textarea type="text" name="msg" class="message" cols=60 row=16 placeholder="Enter text here.">
-{{.Text}}
-</textarea>
+<textarea type="text" name="msg" class="message" cols=60 row=16 placeholder="Enter text here.">{{.Text}}</textarea>
</td></tr>
<tr><td class="odd center">
diff --git a/ii-node/web.go b/ii-node/web.go
@@ -531,7 +531,7 @@ func www_new(ctx *WebContext, w http.ResponseWriter, r *http.Request) error {
return nil
}
-func www_reply(ctx *WebContext, w http.ResponseWriter, r *http.Request) error {
+func www_reply(ctx *WebContext, w http.ResponseWriter, r *http.Request, quote bool) error {
id := ctx.BasePath
m := ctx.www.db.Get(id)
if m == nil {
@@ -542,7 +542,11 @@ func www_reply(ctx *WebContext, w http.ResponseWriter, r *http.Request) error {
msg.To = msg.From
msg.Subj = "Re: " + strings.TrimPrefix(msg.Subj, "Re: ")
msg.Tags.Add("repto/" + id)
- msg.Text = msg_quote(msg.Text)
+ if quote {
+ msg.Text = msg_quote(msg.Text)
+ } else {
+ msg.Text = ""
+ }
ctx.Msg = append(ctx.Msg, &msg)
err := ctx.www.tpl.ExecuteTemplate(w, "reply.tpl", ctx)
return err
@@ -788,7 +792,7 @@ func _handleWWW(ctx *WebContext, w http.ResponseWriter, r *http.Request) error {
if len(args) > 1 {
if args[1] == "reply" {
ctx.BasePath = args[0]
- return www_reply(ctx, w, r)
+ return www_reply(ctx, w, r, !(len(args) > 2 && args[2] == "new"))
} else if args[1] == "edit" {
ctx.BasePath = args[0]
return www_edit(ctx, w, r)