Use a client template for poll input.
Tweak the poll input phrase. Increase the padding on .pollinput for Nox.
This commit is contained in:
parent
a5441f18de
commit
89c8f4e775
|
@ -177,6 +177,9 @@ type TopicCAttachItem struct {
|
|||
Path string
|
||||
FullPath string
|
||||
}
|
||||
type TopicCPollInput struct {
|
||||
Index int
|
||||
}
|
||||
|
||||
type TopicPage struct {
|
||||
*Header
|
||||
|
|
|
@ -275,6 +275,7 @@ func PrepResources(user *User, header *Header, theme *Theme) {
|
|||
if user.Loggedin {
|
||||
addPreScript("topic_c_edit_post")
|
||||
addPreScript("topic_c_attach_item")
|
||||
addPreScript("topic_c_poll_input")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,8 @@ type CTmpl struct {
|
|||
|
||||
func genIntTmpl(name string) func(pi interface{}, w io.Writer) error {
|
||||
return func(pi interface{}, w io.Writer) error {
|
||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap[name]
|
||||
theme := Themes[DefaultThemeBox.Load().(string)]
|
||||
mapping, ok := theme.TemplatesMap[name]
|
||||
if !ok {
|
||||
mapping = name
|
||||
}
|
||||
|
@ -531,8 +532,8 @@ func compileJSTemplates(wg *sync.WaitGroup, c *tmpl.CTemplateSet, themeName stri
|
|||
tmpls.AddStd("paginator", "common.Paginator", Paginator{pageList, page, lastPage})
|
||||
|
||||
tmpls.AddStd("topic_c_edit_post", "common.TopicCEditPost", TopicCEditPost{ID: 0, Source: "", Ref: ""})
|
||||
|
||||
tmpls.AddStd("topic_c_attach_item", "common.TopicCAttachItem", TopicCAttachItem{ID: 1, ImgSrc: "", Path: "", FullPath: ""})
|
||||
tmpls.AddStd("topic_c_poll_input", "common.TopicCPollInput", TopicCPollInput{Index:0})
|
||||
|
||||
tmpls.AddStd("notice", "string", "nonono")
|
||||
|
||||
|
|
|
@ -546,7 +546,7 @@
|
|||
"quick_topic.avatar_alt":"Your Avatar",
|
||||
"quick_topic.whatsup":"What's up?",
|
||||
"quick_topic.content_placeholder":"Insert post here",
|
||||
"quick_topic.add_poll_option":"Add new poll option",
|
||||
"quick_topic.add_poll_option":"Poll option",
|
||||
"quick_topic.create_topic_button":"Create Topic",
|
||||
"quick_topic.create_topic_button_short":"New Topic",
|
||||
"quick_topic.add_poll_button":"Add Poll",
|
||||
|
@ -653,7 +653,7 @@
|
|||
"topic.reply_aria":"The quick reply form",
|
||||
"topic.reply_content":"Insert reply here",
|
||||
"topic.reply_content_alt":"What do you think?",
|
||||
"topic.reply_add_poll_option":"Add new poll option",
|
||||
"topic.reply_add_poll_option":"Poll option",
|
||||
"topic.reply_button":"Create Reply",
|
||||
"topic.reply_add_poll_button":"Add Poll",
|
||||
"topic.reply_add_file_button":"Add File",
|
||||
|
|
|
@ -231,9 +231,10 @@ function fetchPhrases(plist) {
|
|||
if(!panel) {
|
||||
toLoad += 2;
|
||||
if(loggedIn) {
|
||||
toLoad += 2;
|
||||
toLoad += 3;
|
||||
notifyOnScriptW("template_topic_c_edit_post", () => q(!Template_topic_c_edit_post));
|
||||
notifyOnScriptW("template_topic_c_attach_item", () => q(!Template_topic_c_attach_item));
|
||||
notifyOnScriptW("template_topic_c_poll_input", () => q(!Template_topic_c_poll_input));
|
||||
}
|
||||
notifyOnScriptW("template_topics_topic", () => q(!Template_topics_topic));
|
||||
notifyOnScriptW("template_paginator", () => q(!Template_paginator));
|
||||
|
|
|
@ -284,8 +284,9 @@
|
|||
console.log("dataPollInput: ", dataPollInput);
|
||||
if(dataPollInput == undefined) return;
|
||||
if(dataPollInput != (pollInputIndex-1)) return;
|
||||
|
||||
$(".poll_content_row .formitem").append("<div class='pollinput' data-pollinput='"+pollInputIndex+"'><input type='checkbox' disabled /><label class='pollinputlabel'></label><input form='quick_post_form' name='pollinputitem["+pollInputIndex+"]' class='pollinputinput' type='text' placeholder='Add new poll option' /></div>");
|
||||
$(".poll_content_row .formitem").append(Template_topic_c_poll_input({
|
||||
Index: pollInputIndex,
|
||||
}));
|
||||
pollInputIndex++;
|
||||
console.log("new pollInputIndex: ", pollInputIndex);
|
||||
$(".pollinputinput").off("click");
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
{{range .Header.PreScriptsAsync}}
|
||||
<script async type="text/javascript" src="/static/{{.}}"></script>{{end}}
|
||||
<meta property="x-loggedin" content="{{.CurrentUser.Loggedin}}" />
|
||||
<script type="text/javascript" src="/static/init.js?i=6"></script>
|
||||
<script type="text/javascript" src="/static/init.js?i=7"></script>
|
||||
{{range .Header.ScriptsAsync}}
|
||||
<script async type="text/javascript" src="/static/{{.}}"></script>{{end}}
|
||||
<script type="text/javascript" src="/static/jquery-3.1.1.min.js"></script>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<div class='pollinput' data-pollinput='{{.Index}}'>
|
||||
<input type='checkbox' disabled />
|
||||
<label class='pollinputlabel'></label>
|
||||
<input form='quick_post_form' name='pollinputitem[{{.Index}}]' class='pollinputinput' type='text' placeholder='{{lang "topic.reply_add_poll_option"}}' />
|
||||
</div>
|
|
@ -27,7 +27,7 @@
|
|||
</div>
|
||||
{{else}}<div class="opt locked_opt" title="{{lang "topics_locked_tooltip"}}" aria-label="{{lang "topics_locked_aria"}}"><a></a></div>{{end}}
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
<div style="clear:both;"></div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -978,6 +978,12 @@ input[type=checkbox]:checked + label .sel {
|
|||
.poll_results {
|
||||
margin-left: 12px;
|
||||
}
|
||||
.pollinput {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.pollinput:last-child {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.ip_item {
|
||||
display: none;
|
||||
|
|
Loading…
Reference in New Issue