You can now quote posts with the quote button.

Back to Site now links back to the site again.
Localised what to do with this topic for a single topic.
Improved the margins before and after blockquotes for various scenarios including one on it's own, one with content after and one with content before.
Don't bother rendering the opening post source block if it's a guest viewing the page in topic.html
Removed some obsolete inline styles from topic.html

Added the topic.quote_button_text phrase.
Added the topic_list.what_to_do_single phrase.
Added the topic.quote_tooltip phrase.
Added the topic.quote_aria phrase.
This commit is contained in:
Azareal 2019-03-25 13:30:56 +10:00
parent 23a0bf3f41
commit f11f85a1f4
13 changed files with 86 additions and 22 deletions

View File

@ -378,6 +378,7 @@
"topic.plus":"+",
"topic.plus_one":"+1",
"topic.gap_up":" up",
"topic.quote_button_text":"Quote",
"topic.edit_button_text":"Edit",
"topic.delete_button_text":"Delete",
"topic.ip_button_text":"IP",
@ -553,6 +554,7 @@
"topic_list.moderate_tooltip":"Moderate",
"topic_list.moderate_aria":"Moderate Posts",
"topic_list.what_to_do":"What do you want to do with these {0} topics?",
"topic_list.what_to_do_single":"What do you want to do with this topic?",
"topic_list.moderate_delete":"Delete them",
"topic_list.moderate_lock":"Lock them",
"topic_list.moderate_move":"Move them",
@ -599,6 +601,8 @@
"topic.unlike_aria":"Unlike this topic",
"topic.like_tooltip":"Like",
"topic.like_aria":"Like this topic",
"topic.quote_tooltip":"Quote Topic",
"topic.quote_aria":"Quote this topic",
"topic.edit_tooltip":"Edit Topic",
"topic.edit_aria":"Edit this topic",
"topic.delete_tooltip":"Delete Topic",

View File

@ -7,6 +7,7 @@ var moreTopicCount = 0;
var conn = false;
var selectedTopics = [];
var attachItemCallback = function(){}
var quoteItemCallback = function(){}
var baseTitle = document.title;
var wsBackoff = 0;
@ -749,8 +750,7 @@ function mainInit(){
// Remove any handlers already attached to the submitter
$(".submit_edit").unbind("click");
$(".submit_edit").click(function(event)
{
$(".submit_edit").click(function(event) {
event.preventDefault();
var outData = {isJs: "1"}
var blockParent = $(this).closest('.editable_parent');
@ -793,6 +793,23 @@ function mainInit(){
}
});
$(".quote_item").click(function(){
event.preventDefault();
event.stopPropagation();
let source = this.closest(".post_item").getElementsByClassName("edit_source")[0];
let content = document.getElementById("input_content")
console.log("content.value", content.value);
let item;
if(content.value == "") item = "<blockquote>" + source.innerHTML + "</blockquote>"
else item = "\r\n<blockquote>" + source.innerHTML + "</blockquote>";
content.value = content.value + item;
console.log("content.value", content.value);
// For custom / third party text editors
quoteItemCallback(source.innerHTML,item);
});
$(this).click(() => {
$(".selectedAlert").removeClass("selectedAlert");
$("#back").removeClass("alertActive");
@ -935,7 +952,7 @@ function mainInit(){
else attachItem = "\r\n//" + window.location.host + "/attachs/" + hash + "." + ext;
content.value = content.value + attachItem;
console.log("content.value", content.value);
// For custom / third party text editors
attachItemCallback(attachItem);
});
@ -1021,7 +1038,7 @@ function mainInit(){
$(this).click(function(){
selectedTopics.push(parseInt($(this).attr("data-tid"),10));
if(selectedTopics.length==1) {
var msg = "What do you want to do with this topic?";
var msg = phraseBox["topic_list"]["topic_list.what_to_do_single"];
} else {
var msg = "What do you want to do with these "+selectedTopics.length+" topics?";
}

View File

@ -54,26 +54,32 @@
<article {{scope "opening_post"}} itemscope itemtype="http://schema.org/CreativeWork" class="rowblock post_container top_post" aria-label="{{lang "topic.opening_post_aria"}}">
<div class="rowitem passive editable_parent post_item {{.Topic.ClassName}}" style="background-image: url({{.Topic.Avatar}}), url(/static/{{.Header.Theme.Name}}/post-avatar-bg.jpg);background-position: 0px {{if le .Topic.ContentLines 5}}-1{{end}}0px;background-repeat:no-repeat, repeat-y;">
<p class="hide_on_edit topic_content user_content" itemprop="text" style="margin:0;padding:0;">{{.Topic.ContentHTML}}</p>
<textarea name="topic_content" class="show_on_edit topic_content_input">{{.Topic.Content}}</textarea>
<span class="hide_on_edit topic_content user_content" itemprop="text" style="margin:0;padding:0;">{{.Topic.ContentHTML}}</span>
{{if .CurrentUser.Loggedin}}<textarea name="topic_content" class="show_on_edit topic_content_input edit_source">{{.Topic.Content}}</textarea>{{end}}
<span class="controls{{if .Topic.LikeCount}} has_likes{{end}}" aria-label="{{lang "topic.post_controls_aria"}}">
<a href="{{.Topic.UserLink}}" class="username real_username" rel="author">{{.Topic.CreatedByName}}</a>&nbsp;&nbsp;
{{if .CurrentUser.Perms.LikeItem}}<a href="/topic/like/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}" class="mod_button"{{if .Topic.Liked}} title="{{lang "topic.unlike_tooltip"}}" aria-label="{{lang "topic.unlike_aria"}}"{{else}} title="{{lang "topic.like_tooltip"}}" aria-label="{{lang "topic.like_aria"}}"{{end}} style="color:#202020;">
{{if .CurrentUser.Loggedin}}
{{if .CurrentUser.Perms.LikeItem}}<a href="/topic/like/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}" class="mod_button" {{if .Topic.Liked}}title="{{lang "topic.unlike_tooltip"}}" aria-label="{{lang "topic.unlike_aria"}}"{{else}}title="{{lang "topic.like_tooltip"}}" aria-label="{{lang "topic.like_aria"}}"{{end}}>
<button class="username like_label {{if .Topic.Liked}}remove_like{{else}}add_like{{end}}"></button></a>{{end}}
<a href="" class="mod_button quote_item" title="{{lang "topic.quote_tooltip"}}" aria-label="{{lang "topic.quote_aria"}}"><button class="username quote_label"></button></a>
{{if not .Topic.IsClosed or .CurrentUser.Perms.CloseTopic}}
{{if .CurrentUser.Perms.EditTopic}}<a href='/topic/edit/{{.Topic.ID}}' class="mod_button open_edit" style="font-weight:normal;" title="{{lang "topic.edit_tooltip"}}" aria-label="{{lang "topic.edit_aria"}}"><button class="username edit_label"></button></a>{{end}}
{{if .CurrentUser.Perms.EditTopic}}<a href='/topic/edit/{{.Topic.ID}}' class="mod_button open_edit" title="{{lang "topic.edit_tooltip"}}" aria-label="{{lang "topic.edit_aria"}}"><button class="username edit_label"></button></a>{{end}}
{{end}}
{{if .CurrentUser.Perms.DeleteTopic}}<a href='/topic/delete/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}' class="mod_button" style="font-weight:normal;" title="{{lang "topic.delete_tooltip"}}" aria-label="{{lang "topic.delete_aria"}}"><button class="username delete_label"></button></a>{{end}}
{{if .CurrentUser.Perms.DeleteTopic}}<a href='/topic/delete/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}' class="mod_button" title="{{lang "topic.delete_tooltip"}}" aria-label="{{lang "topic.delete_aria"}}"><button class="username delete_label"></button></a>{{end}}
{{if .CurrentUser.Perms.CloseTopic}}{{if .Topic.IsClosed}}<a class="mod_button" href='/topic/unlock/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}' style="font-weight:normal;" title="{{lang "topic.unlock_tooltip"}}" aria-label="{{lang "topic.unlock_aria"}}"><button class="username unlock_label"></button></a>{{else}}<a href='/topic/lock/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}' class="mod_button" style="font-weight:normal;" title="{{lang "topic.lock_tooltip"}}" aria-label="{{lang "topic.lock_aria"}}"><button class="username lock_label"></button></a>{{end}}{{end}}
{{if .CurrentUser.Perms.CloseTopic}}{{if .Topic.IsClosed}}<a class="mod_button" href='/topic/unlock/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}' title="{{lang "topic.unlock_tooltip"}}" aria-label="{{lang "topic.unlock_aria"}}"><button class="username unlock_label"></button></a>{{else}}<a href='/topic/lock/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}' class="mod_button" title="{{lang "topic.lock_tooltip"}}" aria-label="{{lang "topic.lock_aria"}}"><button class="username lock_label"></button></a>{{end}}{{end}}
{{if .CurrentUser.Perms.PinTopic}}{{if .Topic.Sticky}}<a class="mod_button" href='/topic/unstick/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}' style="font-weight:normal;" title="{{lang "topic.unpin_tooltip"}}" aria-label="{{lang "topic.unpin_aria"}}"><button class="username unpin_label"></button></a>{{else}}<a href='/topic/stick/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}' class="mod_button" style="font-weight:normal;" title="{{lang "topic.pin_tooltip"}}" aria-label="{{lang "topic.pin_aria"}}"><button class="username pin_label"></button></a>{{end}}{{end}}
{{if .CurrentUser.Perms.ViewIPs}}<a class="mod_button" href='/users/ips/?ip={{.Topic.IPAddress}}' style="font-weight:normal;" title="{{lang "topic.ip_tooltip"}}" aria-label="The poster's IP is {{.Topic.IPAddress}}"><button class="username ip_label"></button></a>{{end}}
<a href="/report/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}&type=topic" class="mod_button report_item" style="font-weight:normal;" title="{{lang "topic.flag_tooltip"}}" aria-label="{{lang "topic.flag_aria"}}" rel="nofollow"><button class="username flag_label"></button></a>
{{if .CurrentUser.Perms.PinTopic}}{{if .Topic.Sticky}}<a class="mod_button" href='/topic/unstick/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}' title="{{lang "topic.unpin_tooltip"}}" aria-label="{{lang "topic.unpin_aria"}}"><button class="username unpin_label"></button></a>{{else}}<a href='/topic/stick/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}' class="mod_button" title="{{lang "topic.pin_tooltip"}}" aria-label="{{lang "topic.pin_aria"}}"><button class="username pin_label"></button></a>{{end}}{{end}}
{{if .CurrentUser.Perms.ViewIPs}}<a class="mod_button" href='/users/ips/?ip={{.Topic.IPAddress}}' title="{{lang "topic.ip_tooltip"}}" aria-label="The poster's IP is {{.Topic.IPAddress}}"><button class="username ip_label"></button></a>{{end}}
{{end}}
<a href="/report/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}&type=topic" class="mod_button report_item" title="{{lang "topic.flag_tooltip"}}" aria-label="{{lang "topic.flag_aria"}}" rel="nofollow"><button class="username flag_label"></button></a>
<a class="username hide_on_micro like_count" aria-label="{{lang "topic.like_count_aria"}}">{{.Topic.LikeCount}}</a><a class="username hide_on_micro like_count_label" title="{{lang "topic.like_count_tooltip"}}"></a>

View File

@ -64,8 +64,9 @@
{{template "topic_alt_userinfo.html" .Topic }}
<div class="content_container">
<div class="hide_on_edit topic_content user_content" itemprop="text">{{.Topic.ContentHTML}}</div>
{{if .CurrentUser.Loggedin}}{{if .CurrentUser.Perms.EditTopic}}<textarea name="topic_content" class="show_on_edit topic_content_input">{{.Topic.Content}}</textarea>
{{if .CurrentUser.Loggedin}}<textarea name="topic_content" class="show_on_edit topic_content_input edit_source">{{.Topic.Content}}</textarea>
{{if .CurrentUser.Perms.EditTopic}}
{{if .Topic.Attachments}}<div class="show_on_edit attach_edit_bay" type="topic" id="{{.Topic.ID}}">
{{range .Topic.Attachments}}
<div class="attach_item{{if .Image}} attach_image_holder{{end}}">
@ -88,6 +89,7 @@
<div class="action_button_left">
{{if .CurrentUser.Loggedin}}
{{if .CurrentUser.Perms.LikeItem}}<a href="/topic/like/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}" class="action_button like_item {{if .Topic.Liked}}remove_like{{else}}add_like{{end}}" aria-label="{{lang "topic.like_aria"}}" data-action="like"></a>{{end}}
<a href="" class="action_button quote_item" aria-label="{{lang "topic.quote_aria"}}" data-action="quote"></a>
{{if not .Topic.IsClosed or .CurrentUser.Perms.CloseTopic}}
{{if .CurrentUser.Perms.EditTopic}}<a href="/topic/edit/{{.Topic.ID}}" class="action_button open_edit" aria-label="{{lang "topic.edit_aria"}}" data-action="edit"></a>{{end}}
{{end}}
@ -123,4 +125,4 @@
</main>
{{template "footer.html" . }}
{{template "footer.html" . }}

View File

@ -6,9 +6,10 @@
<span itemprop="text">{{.ActionType}}</span>
{{else}}
<div class="editable_block user_content" itemprop="text">{{.ContentHtml}}</div>
{{if $.CurrentUser.Loggedin}}{{if $.CurrentUser.Perms.EditReply}}
{{if $.CurrentUser.Loggedin}}
<div class="edit_source auto_hide">{{.Content}}</div>
{{if $.CurrentUser.Perms.EditReply}}
{{if .Attachments}}<div class="show_on_edit show_on_block_edit attach_edit_bay" type="reply" id="{{.ID}}">
{{range .Attachments}}
<div class="attach_item{{if .Image}} attach_image_holder{{end}}">
@ -31,6 +32,7 @@
<div class="action_button_left">
{{if $.CurrentUser.Loggedin}}
{{if $.CurrentUser.Perms.LikeItem}}<a href="/reply/like/submit/{{.ID}}?session={{$.CurrentUser.Session}}" class="action_button like_item {{if .Liked}}remove_like{{else}}add_like{{end}}" aria-label="{{lang "topic.post_like_aria"}}" data-action="like"></a>{{end}}
<a href="" class="action_button quote_item" aria-label="{{lang "topic.quote_aria"}}" data-action="quote"></a>
{{if not $.Topic.IsClosed or $.CurrentUser.Perms.CloseTopic}}
{{if $.CurrentUser.Perms.EditReply}}<a href="/reply/edit/submit/{{.ID}}?session={{$.CurrentUser.Session}}" class="action_button edit_item" aria-label="{{lang "topic.post_edit_aria"}}" data-action="edit"></a>{{end}}
{{end}}

View File

@ -7,14 +7,16 @@
{{else}}
<article {{scope "post"}} id="post-{{.ID}}" itemscope itemtype="http://schema.org/CreativeWork" class="rowitem passive deletable_block editable_parent post_item {{.ClassName}}" style="background-image: url({{.Avatar}}), url(/static/{{$.Header.Theme.Name}}/post-avatar-bg.jpg);background-position: 0px {{if le .ContentLines 5}}-1{{end}}0px;background-repeat:no-repeat, repeat-y;">
{{/** TODO: We might end up with <br>s in the inline editor, fix this **/}}
<p class="editable_block user_content" itemprop="text" style="margin:0;padding:0;">{{.ContentHtml}}</p>
{{if $.CurrentUser.Loggedin}}{{if $.CurrentUser.Perms.EditReply}}<div class="auto_hide edit_source">{{.Content}}</div>{{end}}{{end}}
<span class="editable_block user_content" itemprop="text" style="margin:0;padding:0;">{{.ContentHtml}}</span>
{{if $.CurrentUser.Loggedin}}<div class="auto_hide edit_source">{{.Content}}</div>{{end}}
<span class="controls{{if .LikeCount}} has_likes{{end}}">
<a href="{{.UserLink}}" class="username real_username" rel="author">{{.CreatedByName}}</a>&nbsp;&nbsp;
{{if $.CurrentUser.Perms.LikeItem}}{{if .Liked}}<a href="/reply/like/submit/{{.ID}}?session={{$.CurrentUser.Session}}" class="mod_button" title="{{lang "topic.post_like_tooltip"}}" aria-label="{{lang "topic.post_like_aria"}}"><button class="username like_label remove_like"></button></a>{{else}}<a href="/reply/like/submit/{{.ID}}?session={{$.CurrentUser.Session}}" class="mod_button" title="{{lang "topic.post_unlike_tooltip"}}" aria-label="{{lang "topic.post_unlike_aria"}}"><button class="username like_label add_like"></button></a>{{end}}{{end}}
<a href="" class="mod_button quote_item" title="{{lang "topic.quote_tooltip"}}" aria-label="{{lang "topic.quote_aria"}}"><button class="username quote_label"></button></a>
{{if not $.Topic.IsClosed or $.CurrentUser.Perms.CloseTopic}}
{{if $.CurrentUser.Perms.EditReply}}<a href="/reply/edit/submit/{{.ID}}?session={{$.CurrentUser.Session}}" class="mod_button" title="{{lang "topic.post_edit_tooltip"}}" aria-label="{{lang "topic.post_edit_aria"}}"><button class="username edit_item edit_label"></button></a>{{end}}
{{end}}

View File

@ -1001,8 +1001,12 @@ blockquote {
margin: 0px;
background-color: #EEEEEE;
padding: 12px;
margin-top: 12px;
margin-bottom: -3px;
}
blockquote:first-child {
margin-top: 0px;
}
.post_item {
display: flex;
margin-bottom: 16px;
@ -1120,6 +1124,9 @@ blockquote {
.button_container .open_edit:after, .edit_item:after{
content: "{{lang "topic.edit_button_text" . }}";
}
.quote_item:after {
content: "{{lang "topic.quote_button_text" . }}";
}
.delete_item:after {
content: "{{lang "topic.delete_button_text" . }}";
}

View File

@ -6,16 +6,21 @@
console.log("af")
let loggedIn = document.head.querySelector("[property='x-loggedin']").content;
if(loggedIn) {
if(navigator.userAgent.indexOf("Firefox") != -1) $.trumbowyg.svgPath = "/static/trumbowyg/ui/icons.svg";
// Is there we way we can append instead? Maybe, an editor plugin?
attachItemCallback = function(attachItem) {
let currentContent = $('#input_content').trumbowyg('html');
$('#input_content').trumbowyg('html', currentContent);
}
quoteItemCallback = function() {
let currentContent = $('#input_content').trumbowyg('html');
$('#input_content').trumbowyg('html', currentContent);
}
$(".topic_name_row").click(function(){
$(".topic_create_form").addClass("selectedInput");
});
//$.trumbowyg.svgPath = false;
// TODO: Bind this to the viewport resize event
var btnlist = [];

View File

@ -1,5 +1,5 @@
<div class="above_right">
<div class="left_bit">{{lang "panel_back_to_site"}}</div>
<div class="left_bit"><a href="/">{{lang "panel_back_to_site"}}</a></div>
<div class="right_bit">
<img src="{{.CurrentUser.MicroAvatar}}" height=32 width=32 />
<span>{{lang "panel_welcome"}}{{.CurrentUser.Name}}</span></div>

View File

@ -735,14 +735,19 @@ blockquote {
border-radius: 3px;
padding: 8px;
margin: 0px;
margin-top: 8px;
margin-bottom: 8px;
}
blockquote + br {
display: none;
}
blockquote:only-child {
margin-top: 0px;
margin-bottom: 0px;
}
blockquote:first-child {
margin-top: 0px;
}
.post_item {
display: flex;
margin-bottom: 12px;
@ -903,7 +908,7 @@ input[type=checkbox]:checked + label .sel {
.ip_item_button:after {
content: "{{lang "topic.ip_button_text" . }}";
}{{$p := .}}
{{range (toArr "delete" "lock" "unlock" "pin" "unpin" "report")}}
{{range (toArr "quote" "delete" "lock" "unlock" "pin" "unpin" "report")}}
.{{.}}_item:after {
content: "{{lang (concat "topic." . "_button_text") ($p) }}";
}{{end}}

View File

@ -41,6 +41,9 @@
margin-top: 16px;
font-size: 18px;
}
.above_right .left_bit a {
color: #bbbbbb;
}
.above_right .right_bit {
margin-left: auto;
display: flex;

View File

@ -303,7 +303,7 @@ h1, h2, h3 {
.like_label:before {
content: "{{lang "topic.plus_one" . }}";
}{{$out := .}}
{{range (toArr "edit" "delete" "pin" "lock" "unlock" "unpin" "ip" "flag")}}
{{range (toArr "quote" "edit" "delete" "pin" "lock" "unlock" "unpin" "ip" "flag")}}
.{{.}}_label:before {
content: "{{lang (concat "topic." . "_button_text") ($out) }}";
}{{end}}
@ -891,8 +891,12 @@ input[type=checkbox]:checked + label.poll_option_label .sel {
blockquote {
background-color: rgb(71,71,71);
margin: 0px;
margin-top: 10px;
padding: 10px;
}
blockquote:first-child {
margin-top: 0px;
}
/* Profiles */
#profile_left_lane {

View File

@ -709,6 +709,9 @@ button.username {
font-size: 17px;
}
.quote_label:before {
content: "💬";
}
.edit_label:before {
content: "🖊️";
}
@ -760,8 +763,12 @@ blockquote {
margin: 0px;
display: inline-block;
width: 100%;
margin-top: 8px;
margin-bottom: 8px;
}
blockquote:first-child {
margin-top: 0px;
}
.level {
float: right;
color: #505050;