Quick Convo Form.
Be more tolerant of spaces when inputting participant names. Use a class instead of inline css for the Quick Topic Form Toggle.
This commit is contained in:
parent
4e166df3e2
commit
57712e0cb5
|
@ -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");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
|
@ -843,11 +843,11 @@ function mainInit(){
|
||||||
|
|
||||||
$(".create_topic_link").click((event) => {
|
$(".create_topic_link").click((event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$(".topic_create_form").show();
|
$(".topic_create_form").removeClass("auto_hide");
|
||||||
});
|
});
|
||||||
$(".topic_create_form .close_form").click((event) => {
|
$(".topic_create_form .close_form").click((event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$(".topic_create_form").hide();
|
$(".topic_create_form").addClass("auto_hide");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#themeSelectorSelect").change(function(){
|
$("#themeSelectorSelect").change(function(){
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
|
|
||||||
func Convos(w http.ResponseWriter, r *http.Request, user c.User, header *c.Header) c.RouteError {
|
func Convos(w http.ResponseWriter, r *http.Request, user c.User, header *c.Header) c.RouteError {
|
||||||
accountEditHead("convos", w, r, &user, header)
|
accountEditHead("convos", w, r, &user, header)
|
||||||
|
header.AddScript("convo.js")
|
||||||
header.AddSheet(header.Theme.Name + "/convo.css")
|
header.AddSheet(header.Theme.Name + "/convo.css")
|
||||||
header.AddNotice("convo_dev")
|
header.AddNotice("convo_dev")
|
||||||
ccount := c.Convos.GetUserCount(user.ID)
|
ccount := c.Convos.GetUserCount(user.ID)
|
||||||
|
@ -124,7 +125,7 @@ func ConvosCreateSubmit(w http.ResponseWriter, r *http.Request, user c.User) c.R
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
u, err := c.Users.GetByName(recp)
|
u, err := c.Users.GetByName(strings.TrimSpace(recp))
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
return c.LocalError("One of the recipients doesn't exist", w, r, user)
|
return c.LocalError("One of the recipients doesn't exist", w, r, user)
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
|
|
|
@ -1,9 +1,28 @@
|
||||||
<div class="colstack_item colstack_head rowhead">
|
<div class="colstack_item colstack_head rowhead">
|
||||||
<div class="rowitem">
|
<div class="rowitem">
|
||||||
<h1>{{lang "convos_head"}}</h1>
|
<h1>{{lang "convos_head"}}</h1>
|
||||||
{{if not .CurrentUser.IsBanned}}<h2><a href="/user/convos/create/">Create Convo</a></h2>{{end}}
|
{{if not .CurrentUser.IsBanned}}<h2><a class="create_convo_link" href="/user/convos/create/">Create Convo</a></h2>{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{if not .CurrentUser.IsBanned}}
|
||||||
|
<div class="colstack_item the_form convo_create_form auto_hide">
|
||||||
|
<form action="/user/convos/create/submit/?s={{.CurrentUser.Session}}" method="post">
|
||||||
|
<div class="formrow real_first_child">
|
||||||
|
<div class="formitem formlabel"><a>Recipient/s</a></div>
|
||||||
|
<div class="formitem"><input name="recp" type="text" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="formrow">
|
||||||
|
<div class="formitem"><textarea name="body"></textarea></div>
|
||||||
|
</div>
|
||||||
|
<div class="formrow">
|
||||||
|
<div class="formitem">
|
||||||
|
<button name="panel-button" class="formbutton form_middle_button">{{lang "create_convo_button"}}</button>
|
||||||
|
<button class="formbutton close_form">{{lang "quick_topic.cancel_button"}}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
<div class="colstack_item convos_list">
|
<div class="colstack_item convos_list">
|
||||||
{{range .Convos}}
|
{{range .Convos}}
|
||||||
<div class="rowitem">
|
<div class="rowitem">
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
{{template "topics_mod_floater.html"}}
|
{{template "topics_mod_floater.html"}}
|
||||||
|
|
||||||
{{if .CurrentUser.Perms.CreateTopic}}
|
{{if .CurrentUser.Perms.CreateTopic}}
|
||||||
<div id="forum_topic_create_form" class="rowblock topic_create_form quick_create_form" style="display:none;" aria-label="{{lang "quick_topic.aria"}}">
|
<div id="forum_topic_create_form" class="rowblock topic_create_form quick_create_form auto_hide" aria-label="{{lang "quick_topic.aria"}}">
|
||||||
<form id="quick_post_form" enctype="multipart/form-data" action="/topic/create/submit/?s={{.CurrentUser.Session}}" method="post"></form>
|
<form id="quick_post_form" enctype="multipart/form-data" action="/topic/create/submit/?s={{.CurrentUser.Session}}" method="post"></form>
|
||||||
<img class="little_row_avatar" src="{{.CurrentUser.MicroAvatar}}" height=64 alt="{{lang "quick_topic.avatar_alt"}}" title="{{lang "quick_topic.avatar_tooltip"}}" />
|
<img class="little_row_avatar" src="{{.CurrentUser.MicroAvatar}}" height=64 alt="{{lang "quick_topic.avatar_alt"}}" title="{{lang "quick_topic.avatar_tooltip"}}" />
|
||||||
<input form="quick_post_form" id="topic_board_input" name="topic-board" value="{{.Forum.ID}}" type="hidden">
|
<input form="quick_post_form" id="topic_board_input" name="topic-board" value="{{.Forum.ID}}" type="hidden">
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
{{template "topics_mod_floater.html"}}
|
{{template "topics_mod_floater.html"}}
|
||||||
|
|
||||||
{{if .CurrentUser.Perms.CreateTopic}}
|
{{if .CurrentUser.Perms.CreateTopic}}
|
||||||
<div id="forum_topic_create_form" class="rowblock topic_create_form quick_create_form" style="display:none;" aria-label="{{lang "quick_topic.aria"}}">
|
<div id="forum_topic_create_form" class="rowblock topic_create_form quick_create_form auto_hide" aria-label="{{lang "quick_topic.aria"}}">
|
||||||
<form id="quick_post_form" enctype="multipart/form-data" action="/topic/create/submit/?s={{.CurrentUser.Session}}" method="post"></form>
|
<form id="quick_post_form" enctype="multipart/form-data" action="/topic/create/submit/?s={{.CurrentUser.Session}}" method="post"></form>
|
||||||
<img class="little_row_avatar" src="{{.CurrentUser.MicroAvatar}}" height=64 alt="{{lang "quick_topic.avatar_alt"}}" title="{{lang "quick_topic.avatar_tooltip"}}" />
|
<img class="little_row_avatar" src="{{.CurrentUser.MicroAvatar}}" height=64 alt="{{lang "quick_topic.avatar_alt"}}" title="{{lang "quick_topic.avatar_tooltip"}}" />
|
||||||
<input form="quick_post_form" id="topic_board_input" name="topic-board" value="{{.Forum.ID}}" type="hidden">
|
<input form="quick_post_form" id="topic_board_input" name="topic-board" value="{{.Forum.ID}}" type="hidden">
|
||||||
|
|
|
@ -53,14 +53,14 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="rowblock topic_create_form quick_create_form" style="display:none;" aria-label="{{lang "quick_topic.aria"}}">
|
<div class="rowblock topic_create_form quick_create_form auto_hide" aria-label="{{lang "quick_topic.aria"}}">
|
||||||
<form name="topic_create_form_form" id="quick_post_form" enctype="multipart/form-data" action="/topic/create/submit/?s={{.CurrentUser.Session}}" method="post"></form>
|
<form name="topic_create_form_form" id="quick_post_form" enctype="multipart/form-data" action="/topic/create/submit/?s={{.CurrentUser.Session}}" method="post"></form>
|
||||||
<img class="little_row_avatar" src="{{.CurrentUser.MicroAvatar}}" height=64 alt="{{lang "quick_topic.avatar_alt"}}" title="{{lang "quick_topic.avatar_tooltip"}}" />
|
<img class="little_row_avatar" src="{{.CurrentUser.MicroAvatar}}" height=64 alt="{{lang "quick_topic.avatar_alt"}}" title="{{lang "quick_topic.avatar_tooltip"}}" />
|
||||||
<div class="main_form">
|
<div class="main_form">
|
||||||
<div class="topic_meta">
|
<div class="topic_meta">
|
||||||
<div class="formrow topic_board_row real_first_child">
|
<div class="formrow topic_board_row real_first_child">
|
||||||
<div class="formitem"><select form="quick_post_form" id="topic_board_input" name="topic-board">
|
<div class="formitem"><select form="quick_post_form" id="topic_board_input" name="topic-board">
|
||||||
{{range .ForumList}}<option {{if eq .ID $.DefaultForum}}selected{{end}} value="{{.ID}}">{{.Name}}</option>{{end}}
|
{{range .ForumList}}<option{{if eq .ID $.DefaultForum}} selected{{end}} value="{{.ID}}">{{.Name}}</option>{{end}}
|
||||||
</select></div>
|
</select></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="formrow topic_name_row">
|
<div class="formrow topic_name_row">
|
||||||
|
|
|
@ -2,6 +2,12 @@
|
||||||
.convos_list .rowitem {
|
.convos_list .rowitem {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
.convo_create_form {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.close_form {
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
.convos_item_user:not(:last-child):after {
|
.convos_item_user:not(:last-child):after {
|
||||||
content: ",";
|
content: ",";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue