diff --git a/public/convo.js b/public/convo.js new file mode 100644 index 00000000..135f5dda --- /dev/null +++ b/public/convo.js @@ -0,0 +1,12 @@ +(() => { + addInitHook("end_init", () => { + $(".create_convo_link").click((event) => { + event.preventDefault(); + $(".convo_create_form").removeClass("auto_hide"); + }); + $(".convo_create_form .close_form").click((event) => { + event.preventDefault(); + $(".convo_create_form").addClass("auto_hide"); + }); + }); +})(); \ No newline at end of file diff --git a/public/global.js b/public/global.js index 711d6bb5..ece44a97 100644 --- a/public/global.js +++ b/public/global.js @@ -843,11 +843,11 @@ function mainInit(){ $(".create_topic_link").click((event) => { event.preventDefault(); - $(".topic_create_form").show(); + $(".topic_create_form").removeClass("auto_hide"); }); $(".topic_create_form .close_form").click((event) => { event.preventDefault(); - $(".topic_create_form").hide(); + $(".topic_create_form").addClass("auto_hide"); }); $("#themeSelectorSelect").change(function(){ diff --git a/routes/convos.go b/routes/convos.go index 360ae476..2f108b69 100644 --- a/routes/convos.go +++ b/routes/convos.go @@ -14,6 +14,7 @@ import ( func Convos(w http.ResponseWriter, r *http.Request, user c.User, header *c.Header) c.RouteError { accountEditHead("convos", w, r, &user, header) + header.AddScript("convo.js") header.AddSheet(header.Theme.Name + "/convo.css") header.AddNotice("convo_dev") ccount := c.Convos.GetUserCount(user.ID) @@ -124,7 +125,7 @@ func ConvosCreateSubmit(w http.ResponseWriter, r *http.Request, user c.User) c.R break } - u, err := c.Users.GetByName(recp) + u, err := c.Users.GetByName(strings.TrimSpace(recp)) if err == sql.ErrNoRows { return c.LocalError("One of the recipients doesn't exist", w, r, user) } else if err != nil { diff --git a/templates/convos.html b/templates/convos.html index f8fcd39f..072abdda 100644 --- a/templates/convos.html +++ b/templates/convos.html @@ -1,9 +1,28 @@

{{lang "convos_head"}}

- {{if not .CurrentUser.IsBanned}}

Create Convo

{{end}} + {{if not .CurrentUser.IsBanned}}

Create Convo

{{end}}
+{{if not .CurrentUser.IsBanned}} +
+
+
+ +
+
+
+
+
+
+
+ + +
+
+
+
+{{end}}
{{range .Convos}}
diff --git a/templates/forum.html b/templates/forum.html index 1bfe9f6e..3bd9c0fd 100644 --- a/templates/forum.html +++ b/templates/forum.html @@ -10,25 +10,25 @@

{{.Title}}

{{if .CurrentUser.Loggedin}} -
- {{if .CurrentUser.Perms.CreateTopic}} -
-
-
- {{/** TODO: Add a permissions check for this **/}} -
- -
- {{else}}
{{end}} +
+ {{if .CurrentUser.Perms.CreateTopic}} +
+
+
+ {{/** TODO: Add a permissions check for this **/}} +
+
-
- {{end}} + {{else}}
{{end}} +
+
+ {{end}}
{{if .CurrentUser.Loggedin}} {{template "topics_mod_floater.html"}} {{if .CurrentUser.Perms.CreateTopic}} -